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 <223565+codeboten@users.noreply.github.com>
  • Loading branch information
codeboten committed Aug 9, 2024
1 parent 7638bb2 commit 898de22
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 1,041 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 @@ -29,10 +29,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 @@ -91,9 +88,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
347 changes: 0 additions & 347 deletions service/internal/proctelemetry/config.go

This file was deleted.

Loading

0 comments on commit 898de22

Please sign in to comment.