Skip to content

[feature request] Support populating new LogRecord.EventName from log record EventId #6108

@lmolkova

Description

@lmolkova

Package

OpenTelemetry

Is your feature request related to a problem?

Since LogRecord now has top-level EventName proto field, OTel should support mapping EventId.EventName provided to ILogger.Log.

What is the expected behavior?

This example

var foodRecallNotice = new FoodRecallNotice
{
BrandName = "Contoso",
ProductDescription = "Salads",
ProductType = "Food & Beverages",
RecallReasonDescription = "due to a possible health risk from Listeria monocytogenes",
CompanyName = "Contoso Fresh Vegetables, Inc.",
};
logger.FoodRecallNotice(foodRecallNotice);
// Dispose logger factory before the application ends.
// This will flush the remaining logs and shutdown the logging pipeline.
loggerFactory.Dispose();
internal static partial class LoggerExtensions
{
[LoggerMessage(LogLevel.Critical)]
public static partial void FoodRecallNotice(
this ILogger logger,
[LogProperties(OmitReferenceName = true)] in FoodRecallNotice foodRecallNotice);
}

should produce a LogRecord (over OTLP) with EventName property set instead of event.name.

Which alternative solutions or features have you considered?

n/a

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageNew issues which have not been classified or triaged by a community memberpkg:OpenTelemetryIssues related to OpenTelemetry NuGet package

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions