mirror of https://github.com/knative/pkg.git
Fix otel exported names (#3226)
* Fix otel exported names * based on feedback from OTel devs these settings will become the default * gofumpt --------- Co-authored-by: Dave Protasowski <dprotaso@gmail.com>
This commit is contained in:
parent
19d3cc2da0
commit
98fbab2143
2
go.mod
2
go.mod
|
|
@ -20,6 +20,7 @@ require (
|
||||||
github.com/kelseyhightower/envconfig v1.4.0
|
github.com/kelseyhightower/envconfig v1.4.0
|
||||||
github.com/openzipkin/zipkin-go v0.4.3
|
github.com/openzipkin/zipkin-go v0.4.3
|
||||||
github.com/prometheus/client_golang v1.22.0
|
github.com/prometheus/client_golang v1.22.0
|
||||||
|
github.com/prometheus/common v0.65.0
|
||||||
github.com/spf13/pflag v1.0.6
|
github.com/spf13/pflag v1.0.6
|
||||||
github.com/tsenart/vegeta/v12 v12.12.0
|
github.com/tsenart/vegeta/v12 v12.12.0
|
||||||
go.opencensus.io v0.24.0
|
go.opencensus.io v0.24.0
|
||||||
|
|
@ -87,7 +88,6 @@ require (
|
||||||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
|
||||||
github.com/pkg/errors v0.9.1 // indirect
|
github.com/pkg/errors v0.9.1 // indirect
|
||||||
github.com/prometheus/client_model v0.6.2 // indirect
|
github.com/prometheus/client_model v0.6.2 // indirect
|
||||||
github.com/prometheus/common v0.65.0 // indirect
|
|
||||||
github.com/prometheus/procfs v0.16.1 // indirect
|
github.com/prometheus/procfs v0.16.1 // indirect
|
||||||
github.com/prometheus/statsd_exporter v0.22.7 // indirect
|
github.com/prometheus/statsd_exporter v0.22.7 // indirect
|
||||||
github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529 // indirect
|
github.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529 // indirect
|
||||||
|
|
|
||||||
|
|
@ -23,13 +23,22 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
|
"github.com/prometheus/common/model"
|
||||||
otelprom "go.opentelemetry.io/otel/exporters/prometheus"
|
otelprom "go.opentelemetry.io/otel/exporters/prometheus"
|
||||||
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
|
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
|
||||||
"knative.dev/pkg/observability/metrics/prometheus"
|
"knative.dev/pkg/observability/metrics/prometheus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
//nolint:staticcheck
|
||||||
|
model.NameValidationScheme = model.LegacyValidation
|
||||||
|
}
|
||||||
|
|
||||||
func buildPrometheus(_ context.Context, cfg Config) (sdkmetric.Reader, shutdownFunc, error) {
|
func buildPrometheus(_ context.Context, cfg Config) (sdkmetric.Reader, shutdownFunc, error) {
|
||||||
r, err := otelprom.New()
|
r, err := otelprom.New(
|
||||||
|
otelprom.WithoutCounterSuffixes(),
|
||||||
|
otelprom.WithoutUnits(),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, noopFunc, fmt.Errorf("unable to create otel prometheus exporter: %w", err)
|
return nil, noopFunc, fmt.Errorf("unable to create otel prometheus exporter: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue