Multiple data points when using push/influx/write endpoint

I’m trying to use the HTTP Metrics integration type and am pushing the example metric from the configuration details using curl:

API_KEY="id:api-key"
URL="https://influx-prod-10-prod-us-central-0.grafana.net/api/v1/push/influx/write"

curl -X  POST -H  "Authorization: Bearer $API_KEY" -H  "Content-Type: text/plain" "$URL" -d "test,bar_label=abc,source=grafana_cloud_docs metric=35.2"

However when I view that metric in the Explore panel in Grafana it always shows as five or six datapoints, all with different timestamps. Why is that?

Welcome @swandog

I am confused. Is your data in InfluxDB or Prometheus? Your screenshot seems to indicate that you have selected Prometheus as the datasource.

My data is just this string “test,bar_label=abc,source=grafana_cloud_docs metric=35.2” that I’m posting through curl. I’m basically looking at this tutorial and sending Influx data, Push metrics from Influx Telegraf to Prometheus | Grafana Cloud documentation

I can confirm that only one point is being ingested, the numerous points you see are an artefact of the way data is queried, especially when it is sparse.

You’re seeing multiple points instead of one on the graph because of a combination of Prometheus range queries and staleness.

The range query evaluates test_metric{} at every step in the time range, each evaluation will look for the latest value of test_metric{} in the five minutes before the evaluation time (due to staleness handling). So if you ingest a single sample and have a step time of 1m in your range query you’ll get one point per minute appear on the graph during the staleness period.

Also, one thing to note, you’re ingesting a metric called test but the value is being supplied via metric=35.2, and so the metric part is used to form part of the series name, hence you’re seeing test_metric. If the value is provided via a string such as value=35.2 then value will not be appended onto the series name, this is the only special case here. (I’ll link to the code in a new reply as I’m limited to two links as a “new user” of the community!)

Also, if you ingest more points then the staleness querying will no longer be an issue.

I’ll also see if we can also mention the above in the docs you linked to, to save any future confusion.

2 Likes
  • For the strings appended to metric names part, you can see this in the influx proxy code which is open source for anyone to peruse and contribute to.
1 Like

I’ll also see if we can also mention the above in the docs you linked to, to save any future confusion.

I added a section to the docs to clarify this too: Push metrics from Influx Telegraf to Prometheus | Grafana Cloud documentation

1 Like