Skip to content

Mapping enrichers with Resource attributes #119

Open
@cecilphillip

Description

@cecilphillip

Given a configuration similar to the following, would it possible to flow enriched properties to OTEL Resource attributes. For instances, I'd want to be able to set the host.name attribute with the value from WithMachineName.

Log.Logger = new LoggerConfiguration()
    .MinimumLevel.Information()
    .Enrich.FromLogContext()
    .Enrich.WithThreadId()
    .Enrich.WithEnvironmentName()
    .Enrich.WithMachineName()
    .WriteTo.Console(outputTemplate: outputTemplate)
    .WriteTo.OpenTelemetry(opts =>
    {
        opts.ResourceAttributes = new Dictionary<string, object>
        {
            ["service.name"] = "BackendApiService"
        };
    })
    .CreateLogger();

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions