Skip to content

Azure Monitor OpenTelemetry LogRecordProcessor #39430

Open
@rossgrambo

Description

@rossgrambo

Is your feature request related to a problem? Please describe.
I can add attributes to Spans by passing in span_processors to configure_azure_monitor. I cannot add attributes to logs or exceptions since I'm unable to pass LogRecordProcessor.

Describe the solution you'd like
azure-monitor-opentelemetry offers developers to pass log_record_processors in it's configure_azure_monitor method just like span processors [here].(

:keyword list[~opentelemetry.sdk.trace.SpanProcessor] span_processors: List of `SpanProcessor` objects
)

Describe alternatives you've considered
A workaround would be to directly add the processors to OpenTelemetry. This doesn't guarantee I'll add to the correct logger- unless I string map between mine and the one created in the configure_azure_monitor method. This seems brittle (and hard to recommend our customers/developers to do).

Additional context
I'd love to hear alternatives. The short of my situation is that I need to add client.id to all spans and logs during a request (it is passed in the request object). I'm currently using baggage to hold the "client.id": "foo" when a request comes in. My primary goal is for this attribute to appear on exceptions and custom events.

This is a pattern we will document and recommend developers to use when using our service and azure monitor together- so I'm more concerned with doing things right rather than simply getting something to work.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions