-
Notifications
You must be signed in to change notification settings - Fork 854
Adding EventName to LogRecord #6306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
c6434bb
b27aa04
df7575c
0e9c401
87c3e1a
8df756a
4267ca3
e23c391
5d5da56
9bf9d01
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,13 @@ Notes](../../RELEASENOTES.md). | |
| write position, resulting in gRPC protocol errors. | ||
| ([#6280](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6280)) | ||
|
|
||
| * If `EventName` is specified either through `ILogger` or the experimental | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good writeup! |
||
| log bridge API, it is exported as `EventName` by default instead of | ||
| `logrecord.event.name` which was previously behind the | ||
| `OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES` feature flag. | ||
| Note that exporting `logrecord.event.id` is still behind that same feature | ||
| flag. ([#6306](https://github.com/open-telemetry/opentelemetry-dotnet/pull/6306)) | ||
|
|
||
| ## 1.12.0 | ||
|
|
||
| Released 2025-Apr-29 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| OpenTelemetry.Logs.LogRecord.EventName.get -> string? | ||
| OpenTelemetry.Logs.LogRecord.EventName.set -> void |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -254,6 +254,15 @@ public string? Body | |
| set => this.Data.Body = value; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the name of the event associated with the log. | ||
| /// </summary> | ||
| public string? EventName | ||
|
||
| { | ||
| get => this.ILoggerData.EventId.Name; | ||
| set => this.ILoggerData.EventId = new EventId(this.ILoggerData.EventId.Id, value); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the raw state attached to the log. | ||
| /// </summary> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| using Microsoft.Extensions.Logging; | ||
| using OpenTelemetry.Internal; | ||
|
|
||
| namespace OpenTelemetry.Logs; | ||
|
|
@@ -35,6 +36,7 @@ public override void EmitLog(in LogRecordData data, in LogRecordAttributeList at | |
|
|
||
| logRecord.Data = data; | ||
| logRecord.ILoggerData = default; | ||
| logRecord.ILoggerData.EventId = new EventId(0, data.EventName); | ||
|
||
|
|
||
| logRecord.Logger = this; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,7 +221,5 @@ message LogRecord { | |
| // as an event. | ||
| // | ||
| // [Optional]. | ||
| // | ||
| // Status: [Development] | ||
| string event_name = 12; | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This should be added below the existing entries in the "Unreleased" section