Skip to content

Commit 624bb6c

Browse files
committed
chore(exporters): remove deprecated prometheus opts, use otel translator
1 parent 4450030 commit 624bb6c

File tree

4,914 files changed

+1541317
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,914 files changed

+1541317
-7
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require (
1313
github.com/prometheus/client_golang v1.23.2
1414
github.com/prometheus/client_model v0.6.2
1515
github.com/prometheus/common v0.67.5
16+
github.com/prometheus/otlptranslator v1.0.0
1617
github.com/prometheus/procfs v0.19.2
1718
github.com/shirou/gopsutil/v4 v4.25.12
1819
github.com/spf13/pflag v1.0.10
@@ -62,7 +63,6 @@ require (
6263
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
6364
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
6465
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
65-
github.com/prometheus/otlptranslator v1.0.0 // indirect
6666
github.com/tklauser/go-sysconf v0.3.16 // indirect
6767
github.com/tklauser/numcpus v0.11.0 // indirect
6868
github.com/x448/float16 v0.8.4 // indirect

pkg/exporters/prometheusexporter/prometheus_exporter.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"strconv"
2323

2424
"github.com/prometheus/client_golang/prometheus/promhttp"
25+
"github.com/prometheus/otlptranslator"
2526
"go.opentelemetry.io/otel/exporters/prometheus"
2627
"k8s.io/klog/v2"
2728

@@ -40,9 +41,8 @@ func NewExporterOrDie(npdo *options.NodeProblemDetectorOptions) types.Exporter {
4041

4142
// Create Prometheus exporter with options to prevent automatic suffixing
4243
promExporter, err := prometheus.New(
43-
prometheus.WithoutCounterSuffixes(), // Don't add _total suffix to counters
44-
prometheus.WithoutUnits(), // Don't add unit-based suffixes like _ratio
45-
prometheus.WithoutScopeInfo(), // Don't add otel_scope_* labels
44+
prometheus.WithTranslationStrategy(otlptranslator.NoTranslation), // Don't add suffixes or escape
45+
prometheus.WithoutScopeInfo(), // Don't add otel_scope_* labels
4646
)
4747
if err != nil {
4848
klog.Fatalf("Failed to create Prometheus exporter: %v", err)

pkg/util/otel/common_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"sync"
2222
"testing"
2323

24+
"github.com/prometheus/otlptranslator"
2425
"go.opentelemetry.io/otel/exporters/prometheus"
2526
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
2627
"go.opentelemetry.io/otel/sdk/metric/metricdata"
@@ -182,9 +183,8 @@ func TestPrometheusExporterWithoutScopeLabels(t *testing.T) {
182183

183184
// Create a Prometheus exporter with WithoutScopeInfo to remove all scope labels
184185
promExporter, err := prometheus.New(
185-
prometheus.WithoutScopeInfo(), // Remove all otel_scope_* labels
186-
prometheus.WithoutCounterSuffixes(), // Don't add _total suffix to counters
187-
prometheus.WithoutUnits(), // Don't add unit-based suffixes
186+
prometheus.WithoutScopeInfo(), // Remove all otel_scope_* labels
187+
prometheus.WithTranslationStrategy(otlptranslator.NoTranslation), // Don't add suffixes or escape
188188
)
189189
if err != nil {
190190
t.Fatalf("Failed to create Prometheus exporter: %v", err)

vendor/cloud.google.com/go/auth/CHANGES.md

Lines changed: 454 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/cloud.google.com/go/auth/LICENSE

Lines changed: 202 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/cloud.google.com/go/auth/README.md

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)