Skip to content

[cmd/mdatagen] add field for configuring individual metric interval #12317

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

cuichenli
Copy link

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.

@cuichenli cuichenli requested review from dmitryax and a team as code owners February 7, 2025 04:02
@@ -13,7 +13,7 @@ import (
// MetricConfig provides common config for a particular metric.
type MetricConfig struct {
Enabled bool `mapstructure:"enabled"`

Interval uint64 `mapstructure:"interval"`
Copy link
Member

@bogdandrutu bogdandrutu Feb 7, 2025

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?

Copy link
Author

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.

Copy link
Member

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?

Copy link
Author

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

Copy link
Author

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!

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 94.11765% with 3 lines in your changes missing coverage. Please review.

Project coverage is 91.55%. Comparing base (0d2f646) to head (4c6e2db).
Report is 243 commits behind head on main.

Files with missing lines Patch % Lines
...plereceiver/internal/metadata/generated_metrics.go 93.61% 2 Missing and 1 partial ⚠️

❌ Your patch status 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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dmitryax
Copy link
Member

@cuichenli
Copy link
Author

@cuichenli please add a changelog entry in main/.chloggen

thanks, updated!

Copy link
Contributor

github-actions bot commented Mar 5, 2025

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added Stale and removed Stale labels Mar 5, 2025
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Mar 20, 2025
Copy link
Contributor

github-actions bot commented Apr 3, 2025

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants