graphite-project / carbon

Carbon is one of the components of Graphite, and is responsible for receiving metrics over the network and writing them down to disk using a storage backend.
http://graphite.readthedocs.org/
Apache License 2.0
1.5k stars 490 forks source link

[Q] Does aggregation-rule works with tagged metrics? #887

Open whispererli opened 4 years ago

whispererli commented 4 years ago

Hello all,

I got a question regarding how to apply aggregation rules to tagged metrics. My test metrics are looking like: request_count;app=test;api=test1;status_code=400 and my aggregation rule is: request_count;app=<env>;api=<api>;status_code=<status_code> (60) = sum request_count;app=<\<env>>;api=<\<api>>;status_code=<\<status_code>> When inject the metrics to carbon-aggregator I got follow errors: 27/03/2020 17:09:37 :: [console] Couldn't match metric request_count;app=test;api=test1;status_code=400 with any aggregation rule. Passing on un-aggregated. 27/03/2020 17:09:37 :: [console] Couldn't match metric request_count;app=test;api=test1;status_code=200 with any aggregation rule. Passing on un-aggregated. 27/03/2020 17:09:37 :: [console] Couldn't match metric request_count;app=test;api=test3;status_code=200 with any aggregation rule. Passing on un-aggregated. Changed aggregation rule to request_count (60) = sum request_count also not works. Can't find an example about how to set aggregation rule with tagged metrics. Is there a way to do that? Thanks very much!

whispererli commented 4 years ago

So looks like it's not supported, from the function 'build_regex' the above pattern will build to: request_count;app=(?P<env>[^.]+?);api=<api>;status_code=<status_code> which only replace the first tag...

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

f-michaut commented 4 years ago

Hello, I have some tagged series and I'd like to aggregate them. I couldn't find any exemple to use tagged series with carbon-aggregator, is there a way to do so ?

deniszh commented 4 years ago

Unfortunately, as @whispererli found, currently it's not supported.

f-michaut commented 4 years ago

Are you planning to implement this ?

I think it would be verry usefull, as tagged series are verry powerfull. But if we can't agregate them, we will run into some limitations... For instance, I have a lot of tagged series, and aggregating them at querry time is verry expensive, my dashboard take a lot of time to load. With carbon-aggregator supporting tagged series it wouldn't be a problem at all.

deniszh commented 4 years ago

I'm suspecting that would be quite non-trivial task, unfortunately. Worth to try, of course, but not sure that I can do that.