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

[bug] Prometheus Input -> Prometheus Client Output Using Namedrop: Metric Types Are Lost, Metrics Have Mangled Names With E.g _counter / _gauge Suffixes #4501

Closed
victorkamenov opened this issue Aug 1, 2018 · 2 comments · Fixed by #4481
Labels
bug unexpected problem or unintended behavior
Milestone

Comments

@victorkamenov
Copy link

victorkamenov commented Aug 1, 2018

Relevant telegraf.conf:

###############################################################################
#                            OUTPUT PLUGINS                                   #
###############################################################################

# Configuration for the Prometheus client to spawn
[[outputs.prometheus_client]]
  namedrop = ["blah_*"]

  ## Address to listen on
  listen = ":9001"
  path = "/outputs/prometheus"

  ## Interval to expire metrics and not deliver to prometheus, 0 == no expiration
  expiration_interval = "$EXPIRE_INTERVAL"

  ## Collectors to enable, valid entries are "gocollector" and "process".
  ## If unset, both are enabled.
  collectors_exclude = ["gocollector", "process"]
	

###############################################################################
#                            INPUT PLUGINS                                    #
###############################################################################
[[inputs.prometheus]]
  ## An array of urls to scrape metrics from.
  urls = ["http://localhost:9091/metrics"]

System info:

Telegraf v1.7.2 (git: release-1.7 c6feb05)
Windows 10

Steps to reproduce:

  1. Have the scrape target configured in the Prometheus Input Plugin URL conf ready (I used out of the box Prometheus Pushgateway, any other Prometheus target should do).
  2. Run telegraf.exe -config newconf.txt

Expected behavior:

At the prometheus_client output path, I should see metrics similar to what I get on the Pushgateway's /metrics default telemetry endpoint.

Attaching a Pushgateway output sample:
pushgateway.txt

Actual behavior:

Instead, I see that the metric types are lost - please compare the metrics from the Pushgateway sample above (pushgateway.txt) and Telegraf (prometheus_client.txt) below:

prometheus_client.txt

The loss of metric types leads to _counter and _gauge suffixes being added to metric names , and for summaries and histograms - names with the quantiles in them, it seems, and without the related tags.

Additional info:

If I remove the
namedrop = ["blah_*"]

line in the prometheus_output client configuration, it works as expected, and the output produced by prometheus_client is without _gauge and _counter suffixes:

prometheus_client_without_namedrop.txt

I suspect the problem is in

internal/models/running_output.go , line 113 :
m, _ = metric.New(name, tags, fields, t)

I guess the metric type is lost there, when the metric is copied.

Changing the line to:
m, _ = metric.New(name, tags, fields, t, m.Type())

seems to fix the problem - metric types are no longer lost, metric names are not mangled with _counter and _gauge suffixes, but I don't know if this fix introduces other problems.

Thank you.

@victorkamenov victorkamenov changed the title Namedrop in Prometheus Client Output, Combined with Promethus Input: Metric Types are Lost, Metrics Have Mangled Names With _counter / _gauge Suffixes Namedrop in Prometheus Client Output: Metric Types are Lost, Metrics Have Mangled Names With _counter / _gauge Suffixes Aug 1, 2018
@victorkamenov victorkamenov changed the title Namedrop in Prometheus Client Output: Metric Types are Lost, Metrics Have Mangled Names With _counter / _gauge Suffixes [bug] Prometheus Input -> Prometheus Client Output Using Namedrop: Metric Types are Lost, Metrics Have Mangled Names With _counter / _gauge Suffixes Aug 1, 2018
@victorkamenov victorkamenov changed the title [bug] Prometheus Input -> Prometheus Client Output Using Namedrop: Metric Types are Lost, Metrics Have Mangled Names With _counter / _gauge Suffixes [bug] Prometheus Input -> Prometheus Client Output Using Namedrop: Metric Types Are Lost, Metrics Have Mangled Names With _counter / _gauge Suffixes Aug 1, 2018
@glinton glinton added the bug unexpected problem or unintended behavior label Aug 1, 2018
@ghost
Copy link

ghost commented Aug 14, 2018

any updates?

@glinton
Copy link
Contributor

glinton commented Aug 14, 2018

I believe the fix has been released in Telegraf 1.7.3

@danielnelson danielnelson added this to the 1.7.3 milestone Aug 15, 2018
@victorkamenov victorkamenov changed the title [bug] Prometheus Input -> Prometheus Client Output Using Namedrop: Metric Types Are Lost, Metrics Have Mangled Names With _counter / _gauge Suffixes [bug] Prometheus Input -> Prometheus Client Output Using Namedrop: Metric Types Are Lost, Metrics Have Mangled Names With E.g _counter / _gauge Suffixes Sep 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants