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

Add v2 write + query endpoints #95

Merged
merged 2 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down