Skip to content

Allow log and metric exporters/processers in configure_azure_monitor #44366

@eavanvalkenburg

Description

@eavanvalkenburg

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The configure_azure_monitor method is awesome, sets up everything nicely, however it is quite strange that only Span Processers can be added (to load additional span exporters), but you can't do the same for Log exporters and metrics exporters. Because I want to be able to simultaneously send telemetry to both azure and a local dashboard (in my case both AIToolkit in vscode, Aspire dashboard and Langfuse on docker). But I can only achieve that for spans, but not for metrics and logs, which is inconsistent.

Describe the solution you'd like
A clear and concise description of what you want to happen.
current code:

# exporters: list["LogRecordExporter | SpanExporter | MetricExporter"]
span_processors = [BatchSpanProcessor(exp) for exp in exporters if isinstance(exp, SpanExporter)]

configure_azure_monitor(
            connection_string=self.applicationinsights_connection_string,
            enable_live_metrics=self.applicationinsights_live_metrics,
            credential=credential,
            resource=self.resource,
            span_processors=span_processors,
            views=self._get_metrics_views(),
            logger_name="agent_framework",
        )

to:

# exporters: list["LogRecordExporter | SpanExporter | MetricExporter"]
span_processors = [BatchSpanProcessor(exp) for exp in exporters if isinstance(exp, SpanExporter)]
log_processors = [BatchLogRecordProcessor(exp) for exp in exporters if isinstance(exp, LogRecordExporter)]
metric_readers = [PeriodicExportingMetricReader(exp, ...) for exp in exporters if isinstance(exp, MetricExporter)]

configure_azure_monitor(
            connection_string=self.applicationinsights_connection_string,
            enable_live_metrics=self.applicationinsights_live_metrics,
            credential=credential,
            resource=self.resource,
            span_processors=span_processors,
            log_processors=log_processors,
            metric_readers=metric_readers,
            views=self._get_metrics_views(),
            logger_name="agent_framework",
        )

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Alternative is to set things up yourself, but the totality of the setup that is done by the configure function is so vast and non-trivial that that leads to a lot of code duplication.

Additional context
Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

Labels

Monitor - DistroMonitor OpenTelemetry Distrocustomer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions