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

fix: stop incrementing activity on empty agent stats#15204

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
f0ssel merged 10 commits intomainfromf0ssel/last_used_at_inc_2
Oct 25, 2024

Conversation

f0ssel
Copy link
Contributor

@f0sself0ssel commentedOct 23, 2024
edited
Loading

Closes#15174

This adds safeguards around when we decide to bump workspace activity to limit it to only bump if we have active connections to the workspace.

I also cleaned up some code, mostly async code that no longer needed to be async because we moved so many operations to batchers that don't do IO on theAdd calls.

@f0sself0ssel requested a review fromjohnstcnOctober 23, 2024 18:55
@f0sself0ssel changed the titlefix: stop incrementing on empty agent statsfix: stop incrementing activity on empty agent statsOct 23, 2024
Copy link
Member

@johnstcnjohnstcn left a comment
edited
Loading

Choose a reason for hiding this comment

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

Looks good to me! Thanks for finding this! Just need to fix up the failing tests.


typeBatcherinterface {
Add(now time.Time,agentID uuid.UUID,templateID uuid.UUID,userID uuid.UUID,workspaceID uuid.UUID,st*agentproto.Stats,usagebool)error
Add(now time.Time,agentID uuid.UUID,templateID uuid.UUID,userID uuid.UUID,workspaceID uuid.UUID,st*agentproto.Stats,usagebool)
Copy link
Member

Choose a reason for hiding this comment

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

praise: This does make the whole interface more convenient to use 👍

err:=r.opts.StatsBatcher.Add(now,workspaceAgent.ID,workspace.TemplateID,workspace.OwnerID,workspace.ID,stats,usage)
// update prometheus metrics
ifr.opts.UpdateAgentMetricsFn!=nil {
user,err:=r.opts.Database.GetUserByID(ctx,workspace.OwnerID)
Copy link
Member

Choose a reason for hiding this comment

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

thought (non-blocking): It's unfortunate to have to do this just to get the username related to the workspace.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Yeah we just have generally avoided database types that embed other types as a default strategy which leads to cleaner types but unfortunately sometimes more fetching. I think it's OK for now and can always be optimized if found to be a bottleneck later. It's a good goal to get this func as low IO as possible.

Base automatically changed fromf0ssel/last_used_at_inc tomainOctober 24, 2024 19:12
@f0sself0sselenabled auto-merge (squash)October 25, 2024 16:02
@f0sself0ssel merged commit0dd942e intomainOct 25, 2024
26 checks passed
@f0sself0ssel deleted the f0ssel/last_used_at_inc_2 branchOctober 25, 2024 16:49
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsOct 25, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.

Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@f0sself0ssel

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

last_used_at continues to increment with workspace-usage experiment

2 participants

@f0ssel@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp