MindFlavor / prometheus_wireguard_exporter

A Prometheus exporter for WireGuard, written in Rust.
https://mindflavor.github.io/prometheus_wireguard_exporter
MIT License
492 stars 51 forks source link

InfluxDB v2 scrapers will fail to scrape this endpoint #111

Closed L1Cafe closed 1 year ago

L1Cafe commented 1 year ago

Hello! Continuing on the conversation from https://github.com/influxdata/influxdb/issues/20193

Your exporter fails to declare a Content-Type HTTP header.

This means that InfluxDB v2 (without my patch) will not be able to collect this data.

Ideally, InfluxDB v2 should fix this behaviour, but considering major web browsers also fall back to text/plain when the Content-Type is not provided, it would be very useful to fix it here, as well. Should be a really short patch. Let me know if you want me to write it for you.

MindFlavor commented 1 year ago

Hi L1Cafe, the exporter sends back content-type: text/plain; version=0.0.4. Doesn't it work?

image
L1Cafe commented 1 year ago

Hi @MindFlavor , thanks for getting back to me.

I verified (and merged my patch) into InfluxDB v2 that assumes text/plain when this exporter doesn't return such header.

I verified this using the browser inspector as well as Burp Suite. The Wireguard exporter is most definitely not returning such header when I tested it.

However, three other things could be going on:

Let's do one thing, leave this issue open, I'll test this out by compiling from source and come back to you if a patch is necessary.

MindFlavor commented 1 year ago

Yes the older version was definitely not sending the header. It has been added to the depending crate prometheus_exporter_base in this PR: https://github.com/MindFlavor/prometheus_exporter_base/pull/25. The dependency has been updated here: https://github.com/MindFlavor/prometheus_wireguard_exporter/commit/61de41169befdd7366067ec0e7515a1197a692e4 .

So content-type should be available since version 3.6.2, not before 👍

L1Cafe commented 1 year ago

OK, my apologies for reporting an older bug. I'll just test on upstream before opening issues next time. Thanks for the quick reply!