@@ -11,6 +11,7 @@ import (
1111 "github.com/google/uuid"
1212 "go.opentelemetry.io/otel"
1313 "go.opentelemetry.io/otel/metric"
14+ otelsdk "go.opentelemetry.io/otel/sdk"
1415 sdkmetric "go.opentelemetry.io/otel/sdk/metric"
1516 "go.opentelemetry.io/otel/sdk/metric/metricdata"
1617 "go.opentelemetry.io/otel/sdk/resource"
@@ -146,7 +147,7 @@ func defaultResourceOptions() []resource.Option {
146147 semconv .ServiceInstanceID (uuid .NewString ()),
147148 ),
148149 resource .WithFromEnv (),
149- resource .WithTelemetrySDK ( ),
150+ resource .WithDetectors ( telemetrySDK {} ),
150151 }
151152}
152153
@@ -157,7 +158,10 @@ func (r *telemetryResource) AppendOptions(opts ...resource.Option) {
157158 r .opts = append (r .opts , opts ... )
158159}
159160
160- type serviceNameDetector struct {}
161+ type (
162+ serviceNameDetector struct {}
163+ telemetrySDK struct {}
164+ )
161165
162166func (serviceNameDetector ) Detect (ctx context.Context ) (* resource.Resource , error ) {
163167 return resource .StringDetector (
@@ -169,6 +173,16 @@ func (serviceNameDetector) Detect(ctx context.Context) (*resource.Resource, erro
169173 ).Detect (ctx )
170174}
171175
176+ // Detect returns a *Resource that describes the OpenTelemetry SDK used.
177+ func (telemetrySDK ) Detect (context.Context ) (* resource.Resource , error ) {
178+ return resource .NewWithAttributes (
179+ semconv .SchemaURL ,
180+ semconv .TelemetrySDKName ("opentelemetry" ),
181+ semconv .TelemetrySDKLanguageGo ,
182+ semconv .TelemetrySDKVersion (otelsdk .Version ()),
183+ ), nil
184+ }
185+
172186// cliReader is an implementation of Reader that will automatically
173187// report to a designated Exporter when Shutdown is called.
174188type cliReader struct {
0 commit comments