From fe47da30178893c668027415752be9a28281c76f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Paj=C4=85k?= Date: Fri, 7 Nov 2025 10:55:09 +0100 Subject: [PATCH] sdk/log: update ExampleProcessor_eventName to use otel.event.name attribute (#7568) Per https://github.com/open-telemetry/semantic-conventions/issues/2913 and https://github.com/open-telemetry/semantic-conventions/pull/2914 Related semconv PR: - https://github.com/open-telemetry/semantic-conventions/pull/3034 --- sdk/log/example_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sdk/log/example_test.go b/sdk/log/example_test.go index c8a43a166..ff9cc5c9b 100644 --- a/sdk/log/example_test.go +++ b/sdk/log/example_test.go @@ -112,7 +112,7 @@ func ignoreLogs(ctx context.Context) bool { return ok } -// Use a processor which sets EventName on log records having "event.name" string attribute. +// Use a processor which sets EventName on log records having "otel.event.name" string attribute. // This is useful for users of logging libraries that do not support // setting the event name on log records, but do support attributes. func ExampleProcessor_eventName() { @@ -132,17 +132,17 @@ func ExampleProcessor_eventName() { } // EventNameProcessor is a [log.Processor] that sets the EventName -// on log records having "event.name" string attribute. +// on log records having "otel.event.name" string attribute. // It is useful for logging libraries that do not support // setting the event name on log records, // but do support attributes. type EventNameProcessor struct{} -// OnEmit sets the EventName on log records having an "event.name" string attribute. +// OnEmit sets the EventName on log records having an "otel.event.name" string attribute. // The original attribute is not removed. func (*EventNameProcessor) OnEmit(_ context.Context, record *log.Record) error { record.WalkAttributes(func(kv logapi.KeyValue) bool { - if kv.Key == "event.name" && kv.Value.Kind() == logapi.KindString { + if kv.Key == "otel.event.name" && kv.Value.Kind() == logapi.KindString { record.SetEventName(kv.Value.AsString()) } return true