Skip to content

Commit

Permalink
[wip] use otel-go config package to configure MeterProvider
Browse files Browse the repository at this point in the history
This removes all the code that was mostly a duplication of the code that exists in
otel-go contrib's config package.

Signed-off-by: Alex Boten <[email protected]>
  • Loading branch information
codeboten committed Jul 11, 2024
1 parent 879afdd commit a9d3f59
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 785 deletions.
14 changes: 12 additions & 2 deletions internal/testutil/testutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func GetAvailableLocalIPv6Address(t testing.TB) string {
return endpoint
}

func ptr[T any](v T) *T {
return &v
}

func GetAvailableLocalAddressPrometheus(t testing.TB) *config.Prometheus {
address := GetAvailableLocalAddress(t)
host, port, err := net.SplitHostPort(address)
Expand All @@ -97,8 +101,14 @@ func GetAvailableLocalAddressPrometheus(t testing.TB) *config.Prometheus {
return nil
}
return &config.Prometheus{
Host: &host,
Port: &portInt,
Host: &host,
Port: &portInt,
WithoutScopeInfo: ptr(true),
WithoutTypeSuffix: ptr(true),
WithoutUnits: ptr(true),
WithResourceConstantLabels: &config.IncludeExclude{
Included: []string{"*"},
},
}
}

Expand Down
6 changes: 3 additions & 3 deletions service/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ require (
go.opentelemetry.io/contrib/config v0.8.0
go.opentelemetry.io/contrib/propagators/b3 v1.28.0
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0
go.opentelemetry.io/otel/exporters/prometheus v0.50.0
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0
go.opentelemetry.io/otel/metric v1.28.0
go.opentelemetry.io/otel/sdk v1.28.0
go.opentelemetry.io/otel/sdk/metric v1.28.0
Expand Down Expand Up @@ -87,9 +84,12 @@ require (
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.53.0 // indirect
go.opentelemetry.io/contrib/zpages v0.53.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.4.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.28.0 // indirect
go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.28.0 // indirect
go.opentelemetry.io/otel/log v0.4.0 // indirect
go.opentelemetry.io/otel/sdk/log v0.4.0 // indirect
Expand Down
295 changes: 0 additions & 295 deletions service/internal/proctelemetry/config.go

This file was deleted.

Loading

0 comments on commit a9d3f59

Please sign in to comment.