opentelemetry-go icon indicating copy to clipboard operation
opentelemetry-go copied to clipboard

Consider using go module paths for scope name in demos

Open dashpole opened this issue 1 year ago • 3 comments

Problem Statement

I noticed the rolldice example has a single-word name for the meter and tracer:

https://github.com/open-telemetry/opentelemetry-go/blob/ca93aae3e9f6922f623d193fac84b13f26dfc0b3/example/dice/rolldice.go#L12-L17

I haven't checked other examples, but IMO we should consider doing this across all of them.

Proposed Solution

Since many users will use this as a starting point for their code, would it make more sense to use a "real" scope name? E.g. go.opentelemetry.io/otel/example/dice?

Alternatives

Keep simpler names for samples

dashpole avatar May 24 '24 00:05 dashpole

Also, should we document the convention that the go import path of the library producing the telemetry should be used as the scope name?

dashpole avatar May 24 '24 00:05 dashpole

Also, should we document the convention that the go import path of the library producing the telemetry should be used as the scope name?

SGTM. Only question is where should we document this? Package docs?

MrAlias avatar May 30 '24 20:05 MrAlias

To complete this, the docs site will need to be updated as well.

MrAlias avatar May 30 '24 20:05 MrAlias

Also, should we document the convention that the go import path of the library producing the telemetry should be used as the scope name?

We already document this directly for the Meter and Tracer:

  • https://github.com/open-telemetry/opentelemetry-go/blob/d595dab76fd30a34ef8c739effc7c845c24dd21f/trace/trace.go#L548-L551
  • https://github.com/open-telemetry/opentelemetry-go/blob/d595dab76fd30a34ef8c739effc7c845c24dd21f/metric/meter.go#L26-L29

We should add this to the LoggerProvider: https://github.com/open-telemetry/opentelemetry-go/blob/d595dab76fd30a34ef8c739effc7c845c24dd21f/log/provider.go#L19-L25

@dashpole do you think this is adequate documentation?

MrAlias avatar Jul 11 '24 18:07 MrAlias

We should add this to the LoggerProvider:

#5613

MrAlias avatar Jul 11 '24 18:07 MrAlias

@dashpole do you think this is adequate documentation?

yes, thank you!

dashpole avatar Jul 12 '24 13:07 dashpole