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

test: fix flake, TestLabelsAggregation update & collect timing#19654

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

Closed
Emyrk wants to merge3 commits intomainfromstevenmasley/TestLabelsAggregation

Conversation

Emyrk
Copy link
Member

If you see the logs, thecollect happens before theupdate metrics

    t.go:106: 2025-08-30 11:43:03.849 [debu]  prometheusmetrics: update metrics    t.go:106: 2025-08-30 11:43:03.850 [debu]  prometheusmetrics: collect metrics    t.go:106: 2025-08-30 11:43:03.850 [debu]  prometheusmetrics: update metrics    aggregator_test.go:201:         Error Trace:/home/steven/go/src/github.com/coder/coder/coderd/prometheusmetrics/aggregator_test.go:201                    /home/steven/go/src/github.com/coder/coder/coderd/prometheusmetrics/aggregator_test.go:629                    /home/steven/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.6.linux-amd64/src/runtime/asm_amd64.s:1700        Error:      Not equal:                     expected: 8                    actual  : 1        Test:       TestLabelsAggregation/single_label_aggregation,_aggregating_to_single_metric    aggregator_test.go:613:         Error Trace:/home/steven/go/src/github.com/coder/coder/coderd/prometheusmetrics/aggregator_test.go:613        Error:      Condition never satisfied        Test:       TestLabelsAggregation/single_label_aggregation,_aggregating_to_single_metric

@EmyrkEmyrk changed the titletest: TestLabelsAggregation flake based on metric collect timingtest: fix flake, TestLabelsAggregation update & collect timingAug 30, 2025
Comment on lines +619 to +626
// This code makes sure all updates are processed before we start a collection.
// We do this by grepping the logs for "update metrics" messages, which are logged
// every time an update is processed.
//
// This is not ideal as the code relies on implementation details (the log message),
require.Eventually(t,func()bool {
returnstrings.Count(updateWatch.String(),"update metrics")==len(tc.given)
},testutil.WaitMedium,testutil.IntervalFast)
Copy link
MemberAuthor

@EmyrkEmyrkAug 30, 2025
edited
Loading

Choose a reason for hiding this comment

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

This is a really unfortunate fix. There is no way to hook into the timing. Maybe with quartz?

The issue istime.Now() is called before the channel enqueue. So to do this with quartz, we would need to add some othertime.Now() function in the update select case.

Copy link
Member

Choose a reason for hiding this comment

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

This may need to be some kind of buffer protected by a mutex, or perhaps a buffered channel instead?

@ethanndickson
Copy link
Member

ethanndickson commentedSep 2, 2025
edited
Loading

Steven's on PTO, and I'm pretty sure I fixed this in#19599, feel free to reopen if it comes back.

@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 2, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@johnstcnjohnstcnjohnstcn approved these changes

@sreyasreyasreya approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@Emyrk@ethanndickson@sreya@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp