From a1735d96417e79ac742d89995c3fc1ec2795d017 Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush <25692880+danquack@users.noreply.github.com> Date: Tue, 1 Mar 2022 13:38:40 -0500 Subject: [PATCH 1/2] Add v2 write + query endpoints Signed-off-by: Daniel Quackenbush <25692880+danquack@users.noreply.github.com> --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 1348b75..2c8a370 100644 --- a/main.go +++ b/main.go @@ -352,12 +352,15 @@ func main() { go c.serveUdp() http.HandleFunc("/write", c.influxDBPost) + http.HandleFunc("/api/v2/write", c.influxDBPost) // Some InfluxDB clients try to create a database. http.HandleFunc("/query", func(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, `{"results": []}`) }) - + http.HandleFunc("/api/v2/query", func(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, ``) + }) // Some InfluxDB clients want to check if the http server is an influx endpoint http.HandleFunc("/ping", func(w http.ResponseWriter, r *http.Request) { // InfluxDB returns a 204 on success. From 265919a3edf411842ee0f813276291b7bea7586c Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush <25692880+danquack@users.noreply.github.com> Date: Thu, 3 Mar 2022 10:24:58 -0500 Subject: [PATCH 2/2] Add details about v2 support Signed-off-by: Daniel Quackenbush <25692880+danquack@users.noreply.github.com> --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 200666d..9b69b60 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ transforms them and exposes them for consumption by Prometheus. This exporter supports float, int and boolean fields. Tags are converted to Prometheus labels. -The exporter also listens on a UDP socket, port 9122 by default, where it -exposes influxDB metrics using `/metrics` endpoint +The exporter also listens on a UDP socket, port 9122 by default, as well as the [v2 HTTP endpoints](#v2-support), where it +exposes InfluxDB metrics using `/metrics` endpoint and exposes exporter's self metrics using `/metrics/exporter` endpoint. ## Timestamps @@ -75,6 +75,10 @@ Or if you want to use UDP instead: Note that Telegraf already supports outputing Prometheus metrics over HTTP via [`outputs.prometheus_client`][telegraf], which avoids having to also run the influxdb_exporter. +## V2 Support +InfluxDB V2 Support is currently in progress. Supported features include: +- Querying for a null result +- Writing data to the exporter - ignores [auth](https://github.com/prometheus/influxdb_exporter/issues/79) and metadata components (org, buckets) [circleci]: https://circleci.com/gh/prometheus/influxdb_exporter [hub]: https://hub.docker.com/r/prom/influxdb-exporter/