Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add agent metadata#6614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ammario merged 85 commits intomainfromagent-metadata
Mar 31, 2023
Merged

feat: add agent metadata#6614

ammario merged 85 commits intomainfromagent-metadata
Mar 31, 2023

Conversation

ammario
Copy link
Member

@ammarioammario commentedMar 15, 2023
edited
Loading

Resolves#3480
Screen Shot 2023-03-27 at 2 34 46 PM

resource"coder_agent""main" {...metadata {display_name="Process Count"key="process_count"script="ps aux | wc -l"interval=1timeout=1  }metadata {display_name="Load Average"key="load"script="awk '{print $1}' /proc/loadavg"interval=1timeout=1  }metadata {display_name="Disk Usage"key="disk"script="df -h | awk '$6 ~ /^\\/$/ { print $5 }'"interval=1timeout=1  }}

Now

  • Publish new version of our terraform provider
  • Create endpoint for streaming metadata updates
  • Write basic, acceptable frontend
  • Show errors correctly in the frontend
  • Write stories for the frontend!
  • Get CollectedAt on the serverand send age in seconds to avoid issues caused by time drift between the agent, server, and browser. Also this protects the integrity of the system if coder is ran close to a black hole.
  • Write docs
  • Mark as alpha

Later

  • Update example templates to showcase dynamic metadata
  • Allow showing "expanded view" of metadata of everything passed the newline

ghuntley reacted with heart emoji
@ammarioammario self-assigned thisMar 15, 2023
@matifali
Copy link
Member

What do you mean by dynamic metadata?
For example, indexing the 'options' map can show the currently selectedcoder_parameter.
Is it something like changing inside the workspace like anyENV_VARIABLE?

@ammario
Copy link
MemberAuthor

@matifali — see screenshot I added to original post.

matifali reacted with thumbs up emoji

@ammarioammario requested a review fromkylecarbsMarch 28, 2023 21:02
PostLifecycle(ctx context.Context,state agentsdk.PostLifecycleRequest)error
PostAppHealth(ctx context.Context,req agentsdk.PostAppHealthsRequest)error
PostStartup(ctx context.Context,req agentsdk.PostStartupRequest)error
PostMetadata(ctx context.Context,keystring,req agentsdk.PostMetadataRequest)error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

If someone has a lot of metadata, I could see us wanting to debounce some of the requests... e.g. 5 things polling each second * 1000 workspaces = alot of requests

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I considered this but didn't want to pursue optimizing it immediately because the feature is very optional and there's a clear path to adding a WebSocket endpoint to improve performance when the time comes.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

A WebSocket endpoint would add substantial complexity (making this harder to review...) and bug risk.

ifmd.Interval==0 {
continue
}
ifcollectedAt.Add(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

How is this possible?

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

See new comment

@ammarioammario requested a review fromkylecarbsMarch 30, 2023 23:18
@ammario
Copy link
MemberAuthor

@kylecarbs — made some minor changes, and fixed one concurrency bug... you should take another look at the short diff.

// We send the result to the channel in the goroutine to avoid
// sending the same result multiple times. So, we don't care about
// the return values.
flight.DoChan(md.Key,func() (interface{},error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why useDoChan instead ofDo?

Copy link
MemberAuthor

@ammarioammarioMar 31, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

It's to not block the loop, and a bit cleaner than wrapping the whole thing in a goroutine.

@ammarioammario merged commitca4fa81 intomainMar 31, 2023
@ammarioammario deleted the agent-metadata branchMarch 31, 2023 20:26
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMar 31, 2023
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@kylecarbskylecarbskylecarbs approved these changes

+1 more reviewer

@coadlercoadlercoadler left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

@ammarioammario

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Agent Metadata

4 participants

@ammario@matifali@coadler@kylecarbs

[8]ページ先頭

©2009-2025 Movatter.jp