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

Add ability to map string fields to numeric fields #2791

Closed
bluebob opened this issue May 12, 2017 · 8 comments
Closed

Add ability to map string fields to numeric fields #2791

bluebob opened this issue May 12, 2017 · 8 comments
Labels
feature request Requests for new plugin and for new features to existing plugins
Milestone

Comments

@bluebob
Copy link

bluebob commented May 12, 2017

Feature Request

Proposal:

Introduce a numeric "cluster_health" or "cluster_status" value

Current behavior:

Current implementation has a status field which is a text object, having values "green", "yellow" or "red".

Desired behavior:

Add a numeric representation of this field, called cluster_health, cluster_status or just health. I suggest a simple mapping of 0, 1 and 2 for green,yellow and red.

Use case: [Why is this important (helps with prioritizing requests)]

The "SignalFX" plugin for CollectD already has this behaviour. Having a numeric field permits Grafana presentation of state with time, so showing when a cluster went into a degraded or failed state. This can be very useful in tracking down root cause. Current text-based representation has to be converted to a number in order to do this, which is cumbersome.
Alerting rules are also simplified, since != 0 means intervention is needed

@phemmer
Copy link
Contributor

phemmer commented May 12, 2017

Just for references:
Here's a grafana feature request which is to allow colorizing table / singlestat based on string values: grafana/grafana#3601
Here's a influxdb feature request which would allow conditional substitution of values ("case when" stuff): influxdata/influxdb#5383
Here's a telegraf feature request that would allow consitional substitution of values: #2667 (there's other issues with similar discussions about the end goal there, but can't find them at the moment)

And just for clarification, I'm not saying this request should be closed, just throwing out some related stuff.

@bluebob
Copy link
Author

bluebob commented May 12, 2017

Thanks. That info will be really handy as a "stop gap". 👍

@danielnelson
Copy link
Contributor

I think it is best to implement this with some enhancements to the #2667 proposal. I'll write a follow up over there.

@danielnelson
Copy link
Contributor

Changing my mind on this, I guess it doesn't make sense to have a general purpose transform plugin so we would want a "enum" or "case" processor for this.

Here is my first idea for how to configure the processor. I don't love it, so hopefully we can improve on the idea.

[[processors.enum]]
  namepass = ["elasticsearch"]
  [[processors.enum.fields]]
    key = "health"
    [processors.enum.table]
      green = 0
      yellow = 1
      red = 2

@danielnelson danielnelson reopened this May 16, 2017
@danielnelson danielnelson changed the title [Feature request] Elasticsearch, numeric "health" value Add ability to map string fields to numeric fields May 19, 2017
@phemmer
Copy link
Contributor

phemmer commented Jun 24, 2017

Kind of a crazy ass idea, but what about embedding kapacitor in telegraf? We wouldn't put the whole thing in, just the stream processing engine.
There are a lot of open issues about people (myself included) wanting to tweak the input that comes from plugins. It seems like instead of introducing a ton of very specific capabilities to handle each individual need, we could put in a general purpose processor that could meet any need. And then instead of writing one from scratch, use one that already exists.

Or, to go batshit insane, what if telegraf were gone, and the input plugins were kapacitor input plugins. Yes kapacitor would need to be modified to make the management easier. But just throwing at the wall to see what sticks. There's quite a bit of overlap between kapacitor and telegraf.

@danielnelson
Copy link
Contributor

I'd love to do it but I guess it's a fair amount of work.

@danielnelson danielnelson added the feature request Requests for new plugin and for new features to existing plugins label Aug 23, 2017
@danielnelson danielnelson mentioned this issue Feb 9, 2018
3 tasks
@dupondje
Copy link
Contributor

dupondje commented Jul 2, 2019

This is also fixed! :)

@danielnelson
Copy link
Contributor

Closed in #3772

@danielnelson danielnelson added this to the 1.8.0 milestone Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Requests for new plugin and for new features to existing plugins
Projects
None yet
Development

No branches or pull requests

4 participants