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

metrics: support relabel aggregate #2130

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qiuqiu-007
Copy link

@qiuqiu-007 qiuqiu-007 commented Mar 5, 2024

in order to aggregate metrics to node (or others) level, here add an optional to action, which is "aggregate_label". the usage is similar to action "drop_label". For example:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '[ \
   { \
     "source_labels": [ \
       "__name__" \
     ], \
     "action": "aggregate_label", \
     "target_label": "shard", \
     "regex": "column_family_live_sstable" \
   } \
 ]' 'http://localhost:10000/v2/metrics-config/'

Signed-off-by: qiulijuan2qiulijuan2_yewu@cmss.chinamobile.com

inorder to aggregate metrics to node (or others) level, here add an optional to action, which is "aggregate_label". the usage is similar to action "drop_label".
For example:
```
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '[ \
   { \
     "source_labels": [ \
       "__name__" \
     ], \
     "action": "aggregate_label", \
     "target_label": "shard", \
     "regex": "column_family_live_sstable" \
   } \
 ]' 'http://localhost:10000/v2/metrics-config/'
```
Signed-off-by: qiulijuan2<qiulijuan2_yewu@cmss.chinamobile.com>
@tchaikov tchaikov requested a review from amnonh March 5, 2024 07:53
@amnonh
Copy link
Contributor

amnonh commented Mar 5, 2024

I'm not sure if aggregate should be done on a metric level or on a metric family level, see my pr #2121

@qiuqiu-007
Copy link
Author

I'm not sure if aggregate should be done on a metric level or on a metric family level, see my pr #2121

In my opinion, first of all, this way is convenient to set a single metric or a group metrics to be aggregated, so just add a function to relabel_config, secondly, it changes the minimum range of code.

@amnonh
Copy link
Contributor

amnonh commented Mar 5, 2024

Most of the time, aggregation is on the metric family level, a single instance cannot be aggregated, which which metrics?
As far as I can tell, the code itself just adds a list of aggregate labels to a metric, but without changing the prometheus code it does not add any functionality.

Please do not merge

@qiuqiu-007
Copy link
Author

In prometheus.cc, it seems that aggregate operation is done during http request ? And in registration time, it just sends the aggregate_labels arg to stored in map , right? @amnonh

@amnonh
Copy link
Contributor

amnonh commented Mar 5, 2024

Prometheus takes the relabel from the metrics family, that's why it make more sense to put the configuration at that level

@qiuqiu-007
Copy link
Author

qiuqiu-007 commented Mar 5, 2024

Prometheus takes the relabel from the metrics family, that's why it make more sense to put the configuration at that level

Do u mean that add the aggregate_labels to struct of metric_info makes no sense, even thought send the aggregate_labels value to the metric_family_info ?

@qiuqiu-007
Copy link
Author

qiuqiu-007 commented Mar 7, 2024

@amnonh Here are three points I'm interested in :

  • if update_aggregate_labels will be release in newer Scylla version, if yes, which version ?
  • skip_when_empty is added to the relabel_config function, then why this aggregate_labels can not be an info added to metric_info? Both of them can be a member of metric label? What is the point to group metric level and metric_family level?
  • How can I test Adding Metrics family config #2121 ? Is it similar to relabel_config which could update by http requests?

@qiuqiu-007
Copy link
Author

ping @amnonh I am eager to receive your reply.

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.

None yet

2 participants