Skip to content

[bug] Body and the {OriginalFormat} attribute of LogRecord data don't work together when using logging bridge API. #6109

Open
@juliuskoval

Description

@juliuskoval

Package

OpenTelemetry.Exporter.OpenTelemetryProtocol

Package Version

Package Name Version
OpenTelemetry.Exporter.OpenTelemetryProtocal 1.11.0-rc.1

Runtime Version

net9.0

Description

If I populate the Body property of the LogRecordData that I'm trying to emit with the formatted message and create a LogRecordAttributeList with the {OriginalFormat} attribute and pass it to the EmitLog method, the body of the exported log will be the value of {OriginalFormat} and the attribute itself as well as the Body of the LogRecordData won't be there.

Steps to Reproduce

using OpenTelemetry.Logs;

#pragma warning disable OTEL1001
using var provider = Sdk
    .CreateLoggerProviderBuilder()
    .AddOtlpExporter()
    .Build();
    
var logger = provider.GetLogger();

var data = new LogRecordData
{
    Body = "formatted message"
};

var attributes = new LogRecordAttributeList { { "{OriginalFormat}", "original format" } };

logger.EmitLog(data, attributes);

Thread.Sleep(10000);

Expected Result

The body of the exported log will be the Body property of the LogRecordData that I emitted and there will be the {OriginalFormat} attribute.

Actual Result

See description

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageNew issues which have not been classified or triaged by a community memberpkg:OpenTelemetry.Exporter.OpenTelemetryProtocolIssues related to OpenTelemetry.Exporter.OpenTelemetryProtocol NuGet package

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions