-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[cmd/mdatagen] add field for configuring individual metric interval #12317
base: main
Are you sure you want to change the base?
[cmd/mdatagen] add field for configuring individual metric interval #12317
Conversation
@@ -13,7 +13,7 @@ import ( | |||
// MetricConfig provides common config for a particular metric. | |||
type MetricConfig struct { | |||
Enabled bool `mapstructure:"enabled"` | |||
|
|||
Interval uint64 `mapstructure:"interval"` |
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.
What does an interval mean for a metric? Most of our scrapers scrape all metrics in one RPC/REST call... How would this be supported?
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.
Apologies for the confusion in the description. This is primarily intended for database scrapers. Since these metrics are queried directly from the database and some of them are resource-intensive, it would be beneficial to allow certain metrics to be scraped less frequently.
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.
We should make the generation of this config optional then.
So, do you mean that in the SQL world, every metric is a sql request?
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.
I cannot speak for all databases, but let's take MSSQL and PostgreSQL as examples. In the contrib repository, these metrics are collected by sending SQL queries.
For reference:
PostgreSQL: client.go#L293
MSSQL: queries.go#L14
I will update the code to make this behavior optional
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.
updated, please take a look, thanks!
Codecov ReportAttention: Patch coverage is
❌ Your patch check has failed because the patch coverage (94.11%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #12317 +/- ##
=======================================
Coverage 91.55% 91.55%
=======================================
Files 467 467
Lines 25652 25703 +51
=======================================
+ Hits 23485 23533 +48
- Misses 1768 1770 +2
- Partials 399 400 +1 ☔ View full report in Codecov by Sentry. |
@cuichenli please add a changelog entry in https://github.com/open-telemetry/opentelemetry-collector/tree/main/.chloggen |
thanks, updated! |
Description
Add an
Interval
field to the individual metric configuration, allowing users to specify custom intervals for each metric. This enables flexibility in cases where different metrics require distinct collection intervals.Note: Additional changes are needed in the receiver layer to fully support this functionality.