grobian / carbon-c-relay

Enhanced C implementation of Carbon relay, aggregator and rewriter
Apache License 2.0
380 stars 107 forks source link

Cannot rewrite internal metrics #249

Closed pawellesniewski closed 7 years ago

pawellesniewski commented 7 years ago

Relating: #25 and #113 unfortunately with version v2.5 (f9ec80) it is not possible to rewrite internal carbon-c-relay metrics.

My sample configuration:

rewrite ^carbon_relays_([^.]+)
    into my.custom.prefix.c-relay.\1;

cluster graphite
    forward
        graphite.localdomain:2003 proto tcp
    ;

send statistics to graphite
    stop;

match *
    send to
        graphite
    ;

but metrics are still send in unchanged format:

carbon_relays_my-host1.dispatcher3.sleepTime_us 4677455648 1485428310
carbon_relays_my-host1.dispatcher4.metricsReceived 668 1485428310
carbon_relays_my-host1.dispatcher4.metricsBlackholed 666 1485428310
carbon_relays_my-host1.dispatcher4.wallTime_us 2060582 1485428310
carbon_relays_my-host1.dispatcher4.sleepTime_us 4677443757 1485428310
carbon_relays_my-host1.metricsReceived 2855 1485428310
carbon_relays_my-host1.metricsBlackholed 2849 1485428310
carbon_relays_my-host1.dispatch_wallTime_us 8261002 1485428310

am i doing something wrong?

grobian commented 7 years ago

Drop the send statistics to graphite bit, then your rewrite rule should match.

grobian commented 7 years ago

You did uncover a bug here, by the way, thanks. I'm looking into how hard it would be to allow you to just define the prefix yourself instead of having to rewrite it.

pawellesniewski commented 7 years ago

Thanks! :)

grobian commented 7 years ago

I'm working on a new config option to set the prefix in any way you like.

grobian commented 7 years ago

I've implemented statistics prefix with whatever.you.like for the next release.