Fix mypy errors for exporter and distro#45132
Open
rads-1996 wants to merge 5 commits intoAzure:mainfrom
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Azure Monitor OpenTelemetry logging integration to address mypy issues by aligning with newer OpenTelemetry log types/exporter interfaces and adjusting internal processors and tests accordingly.
Changes:
- Switch log record typing from
ReadableLogRecordtoReadWriteLogRecordacross processors, managers, samples, and tests. - Update log exporter typing from
LogExportertoLogRecordExporterand rename local variables accordingly. - Add/adjust typing suppressions and small defensive checks to satisfy mypy.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/monitor/azure-monitor-opentelemetry/samples/logging/modify_logs.py | Updates sample processor signature to ReadWriteLogRecord and adds a mypy suppression for attribute/index access. |
| sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py | Renames local log exporter variable to match log-record terminology used by the processor. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/tests/performance_counters/test_processor.py | Updates test mocks to use ReadWriteLogRecord. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/tests/performance_counters/test_performance_counters.py | Updates test mocks to use ReadWriteLogRecord. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_processor.py | Updates processor typing to ReadWriteLogRecord and exporter type to LogRecordExporter. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_exporter.py | Tweaks typing/docstrings and adds guards/type suppressions for mypy compatibility. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_processor.py | Updates processor signature to ReadWriteLogRecord and propagates the new type. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_manager.py | Updates log record typing and adds suppressions on metric instrument creation calls. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_performance_counters/_processor.py | Updates processor signature to ReadWriteLogRecord and propagates the new type. |
| sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_performance_counters/_manager.py | Updates manager log-record typing from readable to read/write log records. |
sdk/monitor/azure-monitor-opentelemetry-exporter/tests/performance_counters/test_processor.py
Show resolved
Hide resolved
...azure-monitor-opentelemetry-exporter/tests/performance_counters/test_performance_counters.py
Outdated
Show resolved
Hide resolved
sdk/monitor/azure-monitor-opentelemetry/samples/logging/modify_logs.py
Outdated
Show resolved
Hide resolved
...onitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_processor.py
Show resolved
Hide resolved
...onitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_processor.py
Outdated
Show resolved
Hide resolved
...-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/_quickpulse/_manager.py
Show resolved
Hide resolved
...monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/_exporter.py
Show resolved
Hide resolved
1b7b8f2 to
db1dc5f
Compare
JacksonWeber
approved these changes
Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.