diff --git a/instrumentation/runtime/example/go.mod b/instrumentation/runtime/example/go.mod index 65dc02bf21e..975eac1c9c0 100644 --- a/instrumentation/runtime/example/go.mod +++ b/instrumentation/runtime/example/go.mod @@ -8,6 +8,7 @@ require ( go.opentelemetry.io/contrib/instrumentation/runtime v0.36.1 go.opentelemetry.io/otel v1.10.0 go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v0.32.1 + go.opentelemetry.io/otel/metric v0.32.1 go.opentelemetry.io/otel/sdk v1.10.0 go.opentelemetry.io/otel/sdk/metric v0.32.1 ) @@ -16,7 +17,6 @@ require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - go.opentelemetry.io/otel/metric v0.32.1 // indirect go.opentelemetry.io/otel/trace v1.10.0 // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/instrumentation/runtime/example/main.go b/instrumentation/runtime/example/main.go index d114c004a36..a7fa8446b34 100644 --- a/instrumentation/runtime/example/main.go +++ b/instrumentation/runtime/example/main.go @@ -26,6 +26,7 @@ import ( "go.opentelemetry.io/contrib/instrumentation/runtime" "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric" + "go.opentelemetry.io/otel/metric/global" "go.opentelemetry.io/otel/sdk/metric" "go.opentelemetry.io/otel/sdk/resource" semconv "go.opentelemetry.io/otel/semconv/v1.11.0" @@ -51,6 +52,7 @@ func main() { log.Fatal(err) } }() + global.SetMeterProvider(provider) ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt) defer cancel()