From 2b72d218405a0f661b6ac4e8b21a4b4d36702e19 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 7 Jun 2022 15:16:48 +0300 Subject: [PATCH] docs/CHANGELOG.md: document e755d0ec3f7e24e9b7d8fa28ff7bb86a5864450a --- app/vmagent/main.go | 16 +++++++++++++--- app/vminsert/main.go | 6 ++++-- docs/CHANGELOG.md | 1 + 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/app/vmagent/main.go b/app/vmagent/main.go index c7b0e3b54..5d019d831 100644 --- a/app/vmagent/main.go +++ b/app/vmagent/main.go @@ -179,6 +179,11 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { } path := strings.Replace(r.URL.Path, "//", "/", -1) + if strings.HasPrefix(path, "datadog/") { + // Trim suffix from paths starting from /datadog/ in order to support legacy DataDog agent. + // See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2670 + path = strings.TrimSuffix(path, "/") + } switch path { case "/api/v1/write": prometheusWriteRequests.Inc() @@ -263,7 +268,7 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true - case "/datadog/intake/": + case "/datadog/intake": datadogIntakeRequests.Inc() w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{}`) @@ -361,6 +366,11 @@ func processMultitenantRequest(w http.ResponseWriter, r *http.Request, path stri httpserver.Errorf(w, r, "cannot obtain auth token: %s", err) return true } + if strings.HasPrefix(p.Suffix, "datadog/") { + // Trim suffix from paths starting from /datadog/ in order to support legacy DataDog agent. + // See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2670 + p.Suffix = strings.TrimSuffix(p.Suffix, "/") + } switch p.Suffix { case "prometheus/", "prometheus", "prometheus/api/v1/write": prometheusWriteRequests.Inc() @@ -444,7 +454,7 @@ func processMultitenantRequest(w http.ResponseWriter, r *http.Request, path stri w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true - case "datadog/intake/": + case "datadog/intake": datadogIntakeRequests.Inc() w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{}`) @@ -481,7 +491,7 @@ var ( datadogValidateRequests = metrics.NewCounter(`vmagent_http_requests_total{path="/datadog/api/v1/validate", protocol="datadog"}`) datadogCheckRunRequests = metrics.NewCounter(`vmagent_http_requests_total{path="/datadog/api/v1/check_run", protocol="datadog"}`) - datadogIntakeRequests = metrics.NewCounter(`vmagent_http_requests_total{path="/datadog/intake/", protocol="datadog"}`) + datadogIntakeRequests = metrics.NewCounter(`vmagent_http_requests_total{path="/datadog/intake", protocol="datadog"}`) promscrapeTargetsRequests = metrics.NewCounter(`vmagent_http_requests_total{path="/targets"}`) promscrapeServiceDiscoveryRequests = metrics.NewCounter(`vmagent_http_requests_total{path="/service-discovery"}`) diff --git a/app/vminsert/main.go b/app/vminsert/main.go index 57e79200b..c279c81eb 100644 --- a/app/vminsert/main.go +++ b/app/vminsert/main.go @@ -190,6 +190,8 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { } if strings.HasPrefix(p.Suffix, "datadog/") { + // Trim suffix from paths starting from /datadog/ in order to support legacy DataDog agent. + // See https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2670 p.Suffix = strings.TrimSuffix(p.Suffix, "/") } switch p.Suffix { @@ -278,7 +280,7 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool { w.WriteHeader(202) fmt.Fprintf(w, `{"status":"ok"}`) return true - case "datadog/intake/": + case "datadog/intake": datadogIntakeRequests.Inc() w.Header().Set("Content-Type", "application/json") fmt.Fprintf(w, `{}`) @@ -323,7 +325,7 @@ var ( datadogValidateRequests = metrics.NewCounter(`vm_http_requests_total{path="/insert/{}/datadog/api/v1/validate", protocol="datadog"}`) datadogCheckRunRequests = metrics.NewCounter(`vm_http_requests_total{path="/insert/{}/datadog/api/v1/check_run", protocol="datadog"}`) - datadogIntakeRequests = metrics.NewCounter(`vm_http_requests_total{path="/insert/{}/datadog/intake/", protocol="datadog"}`) + datadogIntakeRequests = metrics.NewCounter(`vm_http_requests_total{path="/insert/{}/datadog/intake", protocol="datadog"}`) _ = metrics.NewGauge(`vm_metrics_with_dropped_labels_total`, func() float64 { return float64(atomic.LoadUint64(&storage.MetricsWithDroppedLabels)) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index e5664756e..d913bb164 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -28,6 +28,7 @@ The following tip changes can be tested by building VictoriaMetrics components f * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `-promscrape.suppressScrapeErrorsDelay` command-line flag, which can be used for delaying and aggregating the logging of per-target scrape errors. This may reduce the amounts of logs when `vmagent` scrapes many unreliable targets. See [this feature request](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2575). Thanks to @jelmd for [the initial implementation](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2576). * FEATURE: [vmagent](https://docs.victoriametrics.com/vmagent.html): add `-promscrape.cluster.name` command-line flag, which allows proper data de-duplication when the same target is scraped from multiple [vmagent clusters](https://docs.victoriametrics.com/vmagent.html#scraping-big-number-of-targets). See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2679). +* BUGFIX: support for data ingestion in [DataDog format](https://docs.victoriametrics.com/Single-server-VictoriaMetrics.html#how-to-send-data-from-datadog-agent) from legacy clients / agents. See [this pull request](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2670). Thanks to @elProxy for the fix. * BUGFIX: [vmalert](https://docs.victoriametrics.com/vmalert.html): properly apply `alert_relabel_configs` relabeling rules to `-notifier.config` according to [these docs](https://docs.victoriametrics.com/vmalert.html#notifier-configuration-file). Thanks to @spectvtor for [the bugfix](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/2633). * BUGFIX: deny [background merge](https://valyala.medium.com/how-victoriametrics-makes-instant-snapshots-for-multi-terabyte-time-series-data-e1f3fb0e0282) when the storage enters read-only mode, e.g. when free disk space becomes lower than `-storage.minFreeDiskSpaceBytes`. Background merge needs additional disk space, so it could result in `no space left on device` errors. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/2603).