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

[Feature request] Add some small things to make output plugin writing easier #564

Closed
gena01 opened this issue Jan 21, 2016 · 2 comments
Closed

Comments

@gena01
Copy link

gena01 commented Jan 21, 2016

So I've been hacking on a little output plugin and I noticed a few things:

  • metrics in telegraf don't have types (internally). Various Input plugins can inject various types, but those are not saved internally.
  • When sending points to some external services which do have various supported types (gauge, counter, cumulative_counter, etc..) you have to either pick one like "gauge" as default or figure out some sort of complex configuration to map metrics to proper types. (I guess InfluxDb doesn't have types either?) Is it possible to somehow add this in?
  • "points" are not documented. Took me some time to figure out what they actually contain.
  • "tags" which are attached to points seem to be on only one level. One possible scenario I am running into is that "host" level tags like: "host", "dc", etc... are listed on the same level as lets say "diskio" tags. Ideally I'd like to separate those out into two separate buckets, but this is not an easy task since I can't easily tell which came from a plugin scope and which came from the global one. If i send those tags as is then the dataset gets somewhat polluted and it's harder to find what came from where on the graphics/analysis side. One thing i was thinking was to see if I can somehow tell the type of a tag and prefix those by a plugin name for my particular output plugin (or not prefix it for some default/global tags).

P.S. Let me know if I should split this up and how, and I'll try my best.

@sparrc
Copy link
Contributor

sparrc commented Jan 21, 2016

@gena01

some thoughts:

  • Re "types" metrics in Telegraf do have types, it is the influxdb client.Point type. This type is more low-level because it corresponds to an entry in a database. The types that you're referencing "gauge" and "counter" are specific metric types to prometheus and statsd and don't exist in the database. There are many systems that come up with their own special type of metrics, so it's not clear to me the benefit of Telegraf adopting these. IMO, it's better for Telegraf to keep it's types low-level, which allows for greater flexibility.
  • Re "points" I agree that I should make an interface within Telegraf to wrap client.Point so that the available methods can be seen within the repo.
  • Re "tags" I'm not sure I understand this use-case, Why do you need to know why tags came from plugin or global scope? The whole point of global tags is that they apply to each collected metric, why do you want them in a different scope from the plugin tags? From an InfluxDB perspective, each tag is relevant to the metric, global and plugin, so you can make queries like
SELECT usage_idle FROM cpu WHERE host='foo' AND cpu='cpu-total'

where cpu is a plugin tag and host is a global tag.

@gena01
Copy link
Author

gena01 commented Jan 22, 2016

In regards to tags. That query looks like InfluxDb query and it might be fine there. The system I am pushing stats to everything is flat (one big bucket). There are no "metric" tables. There is no "FROM". Think of dumping everything into one influxdb "metric" table/metric. Then you can have the same "name" tag coming from multiple plugins potentially clashing the dataset and making filtering harder if tags is all you have.

sparrc added a commit that referenced this issue Jan 23, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 23, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 25, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 25, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 25, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 25, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 25, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 25, 2016
As of now, this is pretty much just a wrapper around client.Point, but
this gives latitude to expand functionality more easily.

closes #564
sparrc added a commit that referenced this issue Jan 27, 2016
This will basically make the root directory a place for storing the
major telegraf interfaces, which will make telegraf's godoc looks quite
a bit nicer. And make it easier for contributors to lookup the few data
types that they actually care about.

closes #564
@sparrc sparrc closed this as completed in 9c0d14b Jan 28, 2016
sparrc added a commit that referenced this issue Jan 28, 2016
This will basically make the root directory a place for storing the
major telegraf interfaces, which will make telegraf's godoc looks quite
a bit nicer. And make it easier for contributors to lookup the few data
types that they actually care about.

closes #564
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants