influxdata / influxdb-csharp

A .NET library for efficiently sending points to InfluxDB 1.x

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filters

bnayae opened this issue · comments

I'm considering to contribute filtering capability backed into the configuration flow.
The idea behind it is to enable better control over the metrics you sending over the wire at runtime.

You may want limited amount of metrics that will give general health indication,
but when you got indication that something may went wrong,
you may want to illuminate specific spot by open other metrics.

In terms of Api I'm considering something similar to Serilog's filtering.
My suggestion is:

Metrics.Collector = new CollectorConfiguration()
.Filter.Tags.Match(tags => tags.ContainsKey("host") && tags["host"] == "BnayaMac")
.Tags.Exists.All(() => new[] { "Dev", "Staging" })
.Tags.Exists.Any(() => new[] { "OperationA", "OperationB" })
.Fields.Match(fileds => fileds.ContainsKey("cpu") && fileds["cpu"] > 80)

What do you think about the Api?

Thanks for the heads-up, Bnaya. This isn't a feature I've personally been looking for, but I can't speak for everyone else - will keep this here so we can collect feedback. Cheers!