Skip to content

Commit 34cd769

Browse files
committed
sdk/log: update ExampleProcessor_eventName to use otel.event.name attribute
1 parent d0483a7 commit 34cd769

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sdk/log/example_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ func ignoreLogs(ctx context.Context) bool {
112112
return ok
113113
}
114114

115-
// Use a processor which sets EventName on log records having "event.name" string attribute.
115+
// Use a processor which sets EventName on log records having "otel.event.name" string attribute.
116116
// This is useful for users of logging libraries that do not support
117117
// setting the event name on log records, but do support attributes.
118118
func ExampleProcessor_eventName() {
@@ -132,17 +132,17 @@ func ExampleProcessor_eventName() {
132132
}
133133

134134
// EventNameProcessor is a [log.Processor] that sets the EventName
135-
// on log records having "event.name" string attribute.
135+
// on log records having "otel.event.name" string attribute.
136136
// It is useful for logging libraries that do not support
137137
// setting the event name on log records,
138138
// but do support attributes.
139139
type EventNameProcessor struct{}
140140

141-
// OnEmit sets the EventName on log records having an "event.name" string attribute.
141+
// OnEmit sets the EventName on log records having an "otel.event.name" string attribute.
142142
// The original attribute is not removed.
143143
func (*EventNameProcessor) OnEmit(_ context.Context, record *log.Record) error {
144144
record.WalkAttributes(func(kv logapi.KeyValue) bool {
145-
if kv.Key == "event.name" && kv.Value.Kind() == logapi.KindString {
145+
if kv.Key == "otel.event.name" && kv.Value.Kind() == logapi.KindString {
146146
record.SetEventName(kv.Value.AsString())
147147
}
148148
return true

0 commit comments

Comments
 (0)