Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testcase to check for missing labels from the generated metrics #116

Merged

Conversation

prateeknayak
Copy link
Contributor

We have been using avalanche to test out remote write capability in our distributed metrics architecture, we noticed that avalanche wasn't adding any labels let alone the --const-labels to the metrics. The solution in the PR should hopefully fix it.
Following are the changes in the PR

  • Added a test to check for labels in the generated metrics
  • Updated line 516-517 in metrics/serve.go to fix the issue

col.Stop(nil)
})

time.Sleep((2 * time.Second))
Copy link
Member

@bwplotka bwplotka Jan 14, 2025

Choose a reason for hiding this comment

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

Do you mind using some kind of wait e.g. assert.Eventually instead of sleep - much more efficient and reliable - or even better simply hijack (listen to) c.updateNotifyCh?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the feedback @bwplotka it makes sense , I have updated the test to use the c.upateNotifyCh for assertions

Copy link
Member

@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Thanks, I merged #113 first, hope that's ok, but this test is must-have! Added one suggestion, otherwise LGTM, thanks!

@prateeknayak prateeknayak force-pushed the fix-metrics-missing-labels branch from 893f13a to e003269 Compare January 15, 2025 07:28
@bwplotka
Copy link
Member

Do you mind rebasing? There are some unrelated changes now in this PR

@prateeknayak prateeknayak force-pushed the fix-metrics-missing-labels branch from 7e2ed92 to 7ccc990 Compare January 16, 2025 08:09
Copy link
Collaborator

@saswatamcode saswatamcode left a comment

Choose a reason for hiding this comment

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

Thanks!
Just updating the PR title as it adds testcase

@saswatamcode saswatamcode changed the title Fixes missing labels from the generated metrics Add testcase to check for missing labels from the generated metrics Jan 16, 2025
@saswatamcode saswatamcode merged commit ad973cf into prometheus-community:main Jan 16, 2025
6 checks passed
@prateeknayak prateeknayak deleted the fix-metrics-missing-labels branch February 1, 2025 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants