Skip to content

Commit eafa057

Browse files
committed
apply review feedback
Signed-off-by: alex boten <[email protected]>
1 parent 1df799e commit eafa057

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

otelconf/config.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ import (
1010
"log"
1111
"os"
1212

13-
"go.opentelemetry.io/otel"
1413
apilog "go.opentelemetry.io/otel/log"
15-
"go.opentelemetry.io/otel/log/global"
1614
nooplog "go.opentelemetry.io/otel/log/noop"
1715
"go.opentelemetry.io/otel/metric"
1816
noopmetric "go.opentelemetry.io/otel/metric/noop"
@@ -89,14 +87,22 @@ func init() {
8987
log.Fatal(err)
9088
}
9189

92-
// Set the global providers.
93-
otel.SetTracerProvider(s.TracerProvider())
94-
otel.SetMeterProvider(s.MeterProvider())
95-
global.SetLoggerProvider(s.LoggerProvider())
9690
sdk = &s
9791
}
9892

99-
// Shutdown calls the shutdown function of the global SDK instantiated if
93+
// Global returns the globally configured SDK only instantiated
94+
// through the use of the `OTEL_EXPERIMENTAL_CONFIG_FILE“ environment
95+
// variable.
96+
func Global() SDK {
97+
if sdk != nil {
98+
return *sdk
99+
}
100+
return noopSDK
101+
}
102+
103+
// Shutdown calls the `Shutdown` function of the globally configured SDK only instantiated
104+
// through the use of the `OTEL_EXPERIMENTAL_CONFIG_FILE“ environment
105+
// variable.
100106
func Shutdown(ctx context.Context) {
101107
if sdk == nil {
102108
return

0 commit comments

Comments
 (0)