-
Notifications
You must be signed in to change notification settings - Fork 675
feat: annotate sampled profiles #4375
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
Conversation
f454f27
to
a6250c7
Compare
PeriodLimitMb int `json:"periodLimitMb"` | ||
LimitResetTime int64 `json:"limitResetTime"` | ||
SamplingPeriodSec int `json:"samplingPeriodSec"` | ||
SamplingRequests int `yaml:"samplingRequests"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yaml?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, good thing is it hasn't been used yet :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for annotating sampled profiles with distributor sampling information. This allows profiling UIs to visualize sampling and enables future metrics adjustments based on sampling data.
Key changes:
- Introduces a new annotation system for tracking sampling sources with usage group and probability information
- Refactors existing throttling annotations to use a centralized annotation package
- Updates sampling logic to return sampling source information instead of just usage group matches
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/distributor/sampling/config.go | Adds Source struct to track sampling metadata |
pkg/distributor/annotation/annotation.go | New shared annotation constants and types |
pkg/distributor/annotation/throttling.go | Refactored throttling annotation logic from ingestlimits |
pkg/distributor/annotation/sampling.go | New sampling annotation creation logic |
pkg/distributor/model/push.go | Updates to use new annotation package and adds MarkSampledRequest method |
pkg/distributor/distributor.go | Modified sampling logic to track and annotate sampling sources |
pkg/distributor/model/push_test.go | Updated test references to new annotation constants |
pkg/distributor/distributor_test.go | Updated test expectations for new sampling.Source return type |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
PeriodLimitMb int `json:"periodLimitMb"` | ||
LimitResetTime int64 `json:"limitResetTime"` | ||
SamplingPeriodSec int `json:"samplingPeriodSec"` | ||
SamplingRequests int `yaml:"samplingRequests"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The struct tag should be json:"samplingRequests"
instead of yaml:"samplingRequests"
to match the other fields in this JSON-serialized struct.
SamplingRequests int `yaml:"samplingRequests"` | |
SamplingRequests int `json:"samplingRequests"` |
Copilot uses AI. Check for mistakes.
Co-authored-by: Tolya Korniltsev <[email protected]>
Annotating profiles that are subject to distributor sampling. Similar to #3956, with a bit of refactoring to make things cleaner. The annotations will allow sampling to be visualized in profiling UIs and in the future adjust metrics generated from profiles (cc @alsoba13).