beyla icon indicating copy to clipboard operation
beyla copied to clipboard

Update OTEL instrumentation scope

Open mariomac opened this issue 1 year ago • 2 comments

According to:

https://opentelemetry.io/docs/specs/otel/common/mapping-to-non-otlp/#instrumentationscope

otel.library.name is deprecated in favour of otel.scope.name

mariomac avatar Feb 19 '24 09:02 mariomac

I'm curious if this is reference to the test files? (That's the only place I see the otel.library.name show up):

➜  grep -r "otel.library.name" . --exclude-dir=./vendor
./test/integration/red_test_rust.go:            {Key: "otel.library.name", Type: "string", Value: "github.com/grafana/beyla"},
./test/integration/traces_test.go:              {Key: "otel.library.name", Type: "string", Value: "github.com/grafana/beyla"},
./test/integration/traces_test.go:              {Key: "otel.library.name", Type: "string", Value: "github.com/grafana/beyla"},
./test/integration/traces_test.go:              {Key: "otel.library.name", Type: "string", Value: "github.com/grafana/beyla"},
./test/integration/components/jaeger/jaeger_test.go:            `:[{"key":"otel.library.name","type":"string","value":"github.com/grafana/beyla"},{"key":"span.kind"`+
./test/integration/components/jaeger/jaeger_test.go:            `1eef766536d58ec8"}],"startTime":1686641491455316,"duration":476,"tags":[{"key":"otel.library.name","type":"string`+
./test/integration/components/jaeger/jaeger_test.go:            `artTime":1686641491452470,"duration":3322,"tags":[{"key":"otel.library.name","type":"string","value":"github.com/`+
./test/integration/components/jaeger/jaeger_test.go:            `a","references":[],"startTime":1686641494868532,"duration":1108,"tags":[{"key":"otel.library.name","type":"string`+
./test/integration/components/jaeger/jaeger_test.go:            `6641494869530,"duration":109,"tags":[{"key":"otel.library.name","type":"string","value":"github.com/grafana/ebpf-`+
./test/integration/components/jaeger/jaeger_test.go:            `otel.library.name","type":"string","value":"github.com/grafana/beyla"},{"key":"span.kind","type":"s`+

If so, it seems like the definitions from semconv (example) might be useful?

Maybe something like this:

Existing

//  ... test/integration/traces_test.go
// ...
	jaeger.Diff([]jaeger.Tag{
		{Key: "otel.library.name", Type: "string", Value: "github.com/grafana/beyla"},
		{Key: "telemetry.sdk.language", Type: "string", Value: "go"},
		{Key: "telemetry.sdk.name", Type: "string", Value: "beyla"},
		{Key: "service.namespace", Type: "string", Value: "integration-test"},
		serviceInstance,
	}, process.Tags)

Leveraging the semconv definitions

// ..
	jaeger.Diff([]jaeger.Tag{
		keyValueToJaegerTag(semconv.OTelScopeName("github.com/grafana/beyla")),
		keyValueToJaegerTag(semconv.TelemetrySDKLanguageGo),
		keyValueToJaegerTag(semconv.TelemetrySDKName("beyla")),
		keyValueToJaegerTag(semconv.ServiceNamespace("integration-test")),
		serviceInstance,
	}, process.Tags)
	assert.Empty(t, sd, sd.String())
// ...

// .. likely in some other helper location: 

func keyValueToJaegerTag(kv attribute.KeyValue) jaeger.Tag {
	return jaeger.Tag{
		Key:   string(kv.Key),
		Type:  kv.Value.Type().String(),
		Value: kv.Value.AsInterface(),
	}
}

(My thought is since semconv gets autogenerated using the semantic-conventions repo, the deprecation info would be more readily available.)

carrbs avatar Feb 29 '24 22:02 carrbs

Hi @carrbs ! This actually references the generation of this value by the OTEL library, which is not explicit. Fixing this issue would probably require to the OpenTelemetry library and managing any breaking changes we could get.

mariomac avatar Mar 04 '24 09:03 mariomac