From 5938fd70005c04e3bfd1b1d638719e96cc3bb897 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:57:07 +0000 Subject: [PATCH 1/5] chore(deps): Bump github.com/prometheus/common from 0.65.0 to 0.66.1 Bumps [github.com/prometheus/common](https://github.com/prometheus/common) from 0.65.0 to 0.66.1. - [Release notes](https://github.com/prometheus/common/releases) - [Changelog](https://github.com/prometheus/common/blob/main/CHANGELOG.md) - [Commits](https://github.com/prometheus/common/compare/v0.65.0...v0.66.1) --- updated-dependencies: - dependency-name: github.com/prometheus/common dependency-version: 0.66.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index c7f82c28c1b56..fa1ac6d5af3df 100644 --- a/go.mod +++ b/go.mod @@ -174,7 +174,7 @@ require ( github.com/prometheus-community/pro-bing v0.7.0 github.com/prometheus/client_golang v1.23.0 github.com/prometheus/client_model v0.6.2 - github.com/prometheus/common v0.65.0 + github.com/prometheus/common v0.66.1 github.com/prometheus/procfs v0.17.0 github.com/prometheus/prometheus v0.54.1 github.com/rabbitmq/amqp091-go v1.10.0 diff --git a/go.sum b/go.sum index 9e6cfdb189ac5..f10cfb9317450 100644 --- a/go.sum +++ b/go.sum @@ -2169,8 +2169,8 @@ github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7q github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.65.0 h1:QDwzd+G1twt//Kwj/Ww6E9FQq1iVMmODnILtW1t2VzE= -github.com/prometheus/common v0.65.0/go.mod h1:0gZns+BLRQ3V6NdaerOhMbwwRbNh9hkGINtQAsP5GS8= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= From 0f6cf8c5297239e95961a7a4a6713273c4bbc072 Mon Sep 17 00:00:00 2001 From: Maya Strandboge Date: Wed, 10 Sep 2025 08:18:07 -0600 Subject: [PATCH 2/5] Fix deprecation warnings --- plugins/serializers/prometheus/convert.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/serializers/prometheus/convert.go b/plugins/serializers/prometheus/convert.go index a1d7fc4d97de9..62019f5dbf30d 100644 --- a/plugins/serializers/prometheus/convert.go +++ b/plugins/serializers/prometheus/convert.go @@ -86,7 +86,7 @@ func sanitize(name string, table table) (string, bool) { // SanitizeMetricName checks if the name is a valid Prometheus metric name. // If not, it attempts to replace invalid runes with an underscore to create a valid name. func SanitizeMetricName(name string) (string, bool) { - if model.IsValidLegacyMetricName(name) { + if model.LegacyValidation.IsValidMetricName(name) { return name, true } return sanitize(name, metricNameTable) @@ -95,7 +95,7 @@ func SanitizeMetricName(name string) (string, bool) { // SanitizeLabelName checks if the name is a valid Prometheus label name. // If not, it attempts to replace invalid runes with an underscore to create a valid name. func SanitizeLabelName(name string) (string, bool) { - if model.LabelName(name).IsValidLegacy() { + if model.LegacyValidation.IsValidLabelName(name) { return name, true } return sanitize(name, labelNameTable) From 037217504dbd29a4087eef7ce033b91bbbf3df56 Mon Sep 17 00:00:00 2001 From: Maya Strandboge Date: Wed, 10 Sep 2025 08:36:27 -0600 Subject: [PATCH 3/5] Fix test failures --- plugins/parsers/prometheus/parser.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/parsers/prometheus/parser.go b/plugins/parsers/prometheus/parser.go index e2d5a937c675f..ca3944ef3ae82 100644 --- a/plugins/parsers/prometheus/parser.go +++ b/plugins/parsers/prometheus/parser.go @@ -33,7 +33,7 @@ func (p *Parser) SetDefaultTags(tags map[string]string) { func (p *Parser) Parse(data []byte) ([]telegraf.Metric, error) { // Determine the metric transport-type derived from the response header and // create a matching decoder. - format := expfmt.NewFormat(expfmt.TypeProtoCompact) + format := expfmt.NewFormat(expfmt.TypeTextPlain) if len(p.Header) > 0 { format = expfmt.ResponseFormat(p.Header) switch format.FormatType() { From 483268ce2f28448f6c745d951bb3a3c5dcd178e0 Mon Sep 17 00:00:00 2001 From: Maya Strandboge Date: Wed, 10 Sep 2025 08:41:31 -0600 Subject: [PATCH 4/5] Add additional fall back --- plugins/parsers/prometheus/parser.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/parsers/prometheus/parser.go b/plugins/parsers/prometheus/parser.go index ca3944ef3ae82..f2fe0fd2526a5 100644 --- a/plugins/parsers/prometheus/parser.go +++ b/plugins/parsers/prometheus/parser.go @@ -43,6 +43,9 @@ func (p *Parser) Parse(data []byte) ([]telegraf.Metric, error) { if !bytes.HasSuffix(data, []byte("\n")) { data = append(data, []byte("\n")...) } + // As of prometheus common 0.66.0, ProtoText is disallowed from the decoder. Before this version, it used + // to fall back to TextPlain, so we do that here instead to mimic the old behavior. + format = expfmt.NewFormat(expfmt.TypeTextPlain) case expfmt.TypeUnknown: p.Log.Debugf("Unknown format %q... Trying to continue...", p.Header.Get("Content-Type")) } From 867a29cab72c3e0f8b5d811e4416f117f0ad1bda Mon Sep 17 00:00:00 2001 From: Maya Strandboge Date: Wed, 10 Sep 2025 09:15:21 -0600 Subject: [PATCH 5/5] Improve fallback handling --- plugins/parsers/prometheus/parser.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/parsers/prometheus/parser.go b/plugins/parsers/prometheus/parser.go index f2fe0fd2526a5..e378db644e858 100644 --- a/plugins/parsers/prometheus/parser.go +++ b/plugins/parsers/prometheus/parser.go @@ -43,8 +43,10 @@ func (p *Parser) Parse(data []byte) ([]telegraf.Metric, error) { if !bytes.HasSuffix(data, []byte("\n")) { data = append(data, []byte("\n")...) } - // As of prometheus common 0.66.0, ProtoText is disallowed from the decoder. Before this version, it used - // to fall back to TextPlain, so we do that here instead to mimic the old behavior. + fallthrough + case expfmt.TypeProtoCompact: + // As of prometheus common 0.66.0, ProtoText and ProtoCompact are disallowed from the decoder. Before this + // version, it used to fall back to TextPlain, so we do that here instead to mimic the old behavior. format = expfmt.NewFormat(expfmt.TypeTextPlain) case expfmt.TypeUnknown: p.Log.Debugf("Unknown format %q... Trying to continue...", p.Header.Get("Content-Type"))