-
Notifications
You must be signed in to change notification settings - Fork 144
Create OTLP Metrics Exporter in AKS Auto-Attach Scenarios #1467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create OTLP Metrics Exporter in AKS Auto-Attach Scenarios #1467
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request adds OTLP metrics export functionality to the AKS Auto-Attach scenarios by enabling the AKSLoader class to create and configure an OTLP metric reader based on environment variables. The changes allow metrics to be exported to custom OTLP endpoints alongside existing Azure Monitor telemetry.
- Added logic to create OTLP metric readers when
OTEL_METRICS_EXPORTER=otlpand OTLP endpoints are configured - Updated package dependencies for Azure Monitor OpenTelemetry
- Applied type assertion fixes for log record processors
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/agent/aksLoader.ts | Added OTLP metric reader creation logic with environment variable detection |
| test/unitTests/agent/aksLoader.tests.ts | Added comprehensive unit tests for OTLP metric reader configuration scenarios |
| src/main.ts | Applied type assertion fix for OTLP log processor |
| src/shim/telemetryClient.ts | Applied type assertion fix for attribute log processor |
| package.json | Updated Azure Monitor OpenTelemetry dependency and relaxed SDK logs version constraint |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| exportIntervalMillis: OTLP_METRIC_EXPORTER_EXPORT_INTERVAL, | ||
| }); | ||
|
|
||
| metricReaders.push(otlpMetricReader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have views in place here? how do you manage the fact that certain metrics should end in Azure Monitor Exporter and some others in OTLP exporter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be managed by: Azure/azure-sdk-for-js#32793
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re: our conversation on this today, the reason the OTELRESOURCE metric is never sent to AMW is that it's not an OTel metric at all. We create it manually in the exporter explicitly as a breeze metric: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/monitor/monitor-opentelemetry-exporter/src/utils/common.ts/#L242
This pull request introduces support for configuring an OTLP metric reader in the
AKSLoaderclass based on environment variables, allowing metrics to be exported to a custom endpoint. It also updates dependencies and applies minor type assertion changes, with comprehensive unit tests added to verify the new metric reader logic.AKSLoader metric reader enhancements:
AKSLoaderto create and attach an OTLP metric reader whenOTEL_METRICS_EXPORTERis set to"otlp"and an OTLP endpoint is provided via environment variables. The metric reader is added to the loader's options for use by downstream telemetry components. [1] [2]Unit tests for metric reader configuration:
aksLoader.tests.tsto verify that the OTLP metric reader is correctly created and configured based on environment variables, including cases for both general and metrics-specific endpoints, as well as negative cases where the metric reader should not be created.Dependency updates:
@azure/monitor-opentelemetryfrom version^1.12.0to^1.13.1and relaxed the version constraint for@opentelemetry/sdk-logsto allow compatible updates. [1] [2]Type assertion fixes:
as anytype assertions when pushing log record processors to address type compatibility in bothmain.tsandtelemetryClient.ts. [1] [2]