From 434a5803e70a4dba2e05decf28bbf5272aeab245 Mon Sep 17 00:00:00 2001 From: Nikolay Date: Thu, 29 Feb 2024 16:58:49 +0100 Subject: [PATCH] app/{vmagent,vminsert}: adds /v1/metrics suffix for opentelemetry route path (#5871) * app/{vmagent,vminsert}: adds /v1/metrics suffix for opentelemetry route path it must fix compatibility with opentemetry-collector [spec](https://opentelemetry.io/docs/specs/otlp/\#otlphttp-request) this suffix is hard-coded and cannot be changed with collector configuration * Apply suggestions from code review --------- Co-authored-by: Aliaksandr Valialkin --- app/vmagent/main.go | 2 +- app/vminsert/main.go | 2 +- docs/CHANGELOG.md | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/vmagent/main.go b/app/vmagent/main.go index e7c9b92a8..48b145055 100644 --- a/app/vmagent/main.go +++ b/app/vmagent/main.go @@ -313,7 +313,7 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { influxQueryRequests.Inc() influxutils.WriteDatabaseNames(w) return true - case "/opentelemetry/api/v1/push": + case "/opentelemetry/api/v1/push", "/opentelemetry/v1/metrics": opentelemetryPushRequests.Inc() if err := opentelemetry.InsertHandler(nil, r); err != nil { opentelemetryPushErrors.Inc() diff --git a/app/vminsert/main.go b/app/vminsert/main.go index a5d54553c..0779f675b 100644 --- a/app/vminsert/main.go +++ b/app/vminsert/main.go @@ -216,7 +216,7 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool { addInfluxResponseHeaders(w) influxutils.WriteDatabaseNames(w) return true - case "/opentelemetry/api/v1/push": + case "/opentelemetry/api/v1/push", "/opentelemetry/v1/metrics": opentelemetryPushRequests.Inc() if err := opentelemetry.InsertHandler(r); err != nil { opentelemetryPushErrors.Inc() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 671390f3f..e995d3d23 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -47,6 +47,7 @@ See also [LTS releases](https://docs.victoriametrics.com/LTS-releases.html). * BUGFIX: downgrade Go builder from `1.22.0` to `1.21.7`, since `1.22.0` contains [the bug](https://github.com/golang/go/issues/65705), which can lead to deadlocked HTTP connections to remote storage systems, scrape targets and service discovery endpoints at [vmagent](https://docs.victoriametrics.com/vmagent/). This may result in incorrect service discovery, target scraping and failed sending samples to remote storage. * BUGFIX: all VictoriaMetrics components: return back periodic closing of incoming connections to `-httpListenAddr` every 2 minutes, which was disabled in [v1.98.0](https://github.com/VictoriaMetrics/VictoriaMetrics/releases/tag/v1.98.0) when addressing [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1304#issuecomment-1636997037). See [this comment](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1304#issuecomment-1961891450) for details on why the periodic closing of incoming connections has been returned back. +* BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): accept OpenTelemetry data at `/opentelemetry/v1/metrics`, since the `/v1/metrics` suffix is hardcoded at [OpenTelemetry protocol specification](https://opentelemetry.io/docs/specs/otlp/#otlphttp-request). * BUGFIX: [vmagent](https://docs.victoriametrics.com/vmagent.html): fix possible deadlock when [sharding among remote storages](https://docs.victoriametrics.com/vmagent/#sharding-among-remote-storages) is enabled with `-remoteWrite.shardByURL` command-line flag. Thanks to @penguinlav for [the fix](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5834) for [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5833). * BUGFIX: fix the misleading error `0ms is out of allowed range [0 ...` when passing `step=0` to [/api/v1/query](https://docs.victoriametrics.com/keyconcepts/#instant-query) or [/api/v1/query_range](https://docs.victoriametrics.com/keyconcepts/#range-query). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5795).