grobian / carbon-c-relay

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

[Feature Request] add a input data syntax check filter. #142

Closed toni-moreno closed 7 years ago

toni-moreno commented 8 years ago

Could be interesting if c-relay could add a syntax filter avoiding sending malformed data:

"metric-name value timestamp"

to the graphite backend.

A logfile with this errors and the IP origin will be wellcomed also.

Thank you very much.

grobian commented 8 years ago

I think this request is similar to PR #87 right?

toni-moreno commented 8 years ago

Hi @grobian . This issue is similar but not exactly the same.

in https://github.com/grobian/carbon-c-relay/pull/87 , you will log "unwanted" this is metrics that you don't have any "match" rule.

In this issue what I need is a syntax check for valid metrics.

These metrics are valid metrics to graphite in "PlainText Format"

system.cpu.wait  80 1454056517
system.disk.io  25.0 1454056517

and these other are invalid to graphite

system.cpu.wait  OK 1454056517              #bad value
system.cpu.wait  OK 12343                   #bad timestamp
system.cpu.wait  25 OK                      #bad timestamp
system   cpu  wait  25.0 1454056517         #bad number of parameters

Right now carbon-c-relay is relaying invalid metrics if a correct match rule found. I need to stop these invalid metrics before to reach the graphite backend.

piotr1212 commented 8 years ago

I'm not sure if I understand, that is exactly what is requested in https://github.com/grobian/carbon-c-relay/pull/87 And partially implemented in https://github.com/piotr1212/carbon-c-relay/commits/filter2 @grobian made some changes since then and suggested to use a regex which is a much better idea than the ugly parsing I did...

grobian commented 8 years ago

@toni-moreno do you mean #78 (iso #87)? It's all a bit confusing right now :)

toni-moreno commented 8 years ago

Hi @grobian what @piotr1212 have been done at https://github.com/grobian/carbon-c-relay/pull/87 is exactly what we need.

Thank you !!!

grobian commented 7 years ago

I've introduced a validate clause to match rules