Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] update resource initialization #2844

Merged
merged 8 commits into from Apr 25, 2022
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions website_docs/manual.md
Expand Up @@ -46,15 +46,22 @@ func newExporter(ctx context.Context) /* (someExporter.Exporter, error) */ {
}

func newTraceProvider(exp sdktrace.SpanExporter) *sdktrace.TracerProvider {
// The service.name attribute is required.
resource := resource.NewWithAttributes(
semconv.SchemaURL,
semconv.ServiceNameKey.String("ExampleService"),
// Ensure default SDK resources and the required service name are set.
r, err := resource.Merge(
resource.Default(),
resource.NewWithAttributes(
semconv.SchemaURL,
semconv.ServiceNameKey.String("ExampleService"),
)
)

if err != nil {
panic(err)
}

return sdktrace.NewTracerProvider(
sdktrace.WithBatcher(exp),
sdktrace.WithResource(resource),
sdktrace.WithResource(r),
)
}

Expand Down