Skip to content

Commit

Permalink
[runtime] fix runtime example: set provider to global meter provider (#…
Browse files Browse the repository at this point in the history
…2823)

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>

Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
  • Loading branch information
fatsheep9146 and MrAlias authored Oct 11, 2022
1 parent c797670 commit 92fb703
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion instrumentation/runtime/example/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions instrumentation/runtime/example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -51,6 +52,7 @@ func main() {
log.Fatal(err)
}
}()
global.SetMeterProvider(provider)

ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()
Expand Down

0 comments on commit 92fb703

Please sign in to comment.