From 9d6f31811ef7dba46ca8caf84f9ea7a130ab4aae Mon Sep 17 00:00:00 2001 From: Vishwesh Bankwar Date: Mon, 7 Aug 2023 09:23:10 -0700 Subject: [PATCH] [Otlp] Rename ilogger event id and name attributes --- .../Implementation/LogRecordExtensions.cs | 4 ++-- .../OtlpLogExporterTests.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/LogRecordExtensions.cs b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/LogRecordExtensions.cs index 294ce6454f2..0452ed286bb 100644 --- a/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/LogRecordExtensions.cs +++ b/src/OpenTelemetry.Exporter.OpenTelemetryProtocol/Implementation/LogRecordExtensions.cs @@ -95,12 +95,12 @@ internal static OtlpLogs.LogRecord ToOtlpLog(this LogRecord logRecord, SdkLimitO if (logRecord.EventId.Id != default) { - otlpLogRecord.AddIntAttribute(nameof(logRecord.EventId.Id), logRecord.EventId.Id, attributeCountLimit); + otlpLogRecord.AddIntAttribute("dotnet.ilogger.event_id", logRecord.EventId.Id, attributeCountLimit); } if (!string.IsNullOrEmpty(logRecord.EventId.Name)) { - otlpLogRecord.AddStringAttribute(nameof(logRecord.EventId.Name), logRecord.EventId.Name, attributeValueLengthLimit, attributeCountLimit); + otlpLogRecord.AddStringAttribute("dotnet.ilogger.event_name", logRecord.EventId.Name, attributeValueLengthLimit, attributeCountLimit); } if (logRecord.Exception != null) diff --git a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs index 5125094074f..f09d8c63c5d 100644 --- a/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs +++ b/test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs @@ -267,7 +267,7 @@ public void CheckToOtlpLogRecordEventId() var otlpLogRecordAttributes = otlpLogRecord.Attributes.ToString(); // Event - Assert.Contains("Id", otlpLogRecordAttributes); + Assert.Contains("dotnet.ilogger.event_id", otlpLogRecordAttributes); Assert.Contains("10", otlpLogRecordAttributes); logRecords.Clear(); @@ -283,9 +283,9 @@ public void CheckToOtlpLogRecordEventId() otlpLogRecordAttributes = otlpLogRecord.Attributes.ToString(); // Event - Assert.Contains("Id", otlpLogRecordAttributes); + Assert.Contains("dotnet.ilogger.event_id", otlpLogRecordAttributes); Assert.Contains("10", otlpLogRecordAttributes); - Assert.Contains("Name", otlpLogRecordAttributes); + Assert.Contains("dotnet.ilogger.event_name", otlpLogRecordAttributes); Assert.Contains("MyEvent10", otlpLogRecordAttributes); }