Skip to content

Conversation

@jeremydvoss
Copy link
Member

@jeremydvoss jeremydvoss commented Jan 14, 2026

Description

Issue: langchain-ai/langchain-azure#234

On Mac, the I/O performance counter is not available. This was a known limitation, but the warning log it produced in _PerformanceCountersManager led to a circular dependency. As a log, it triggered the _PerformanceCountersLogRecordProcessor which in turn relied on _PerformanceCountersManager. This led to an infinite lock on the singleton.

To solve this, I moved the Metrics pipeline set up to before Logs and Tracing. This way, the Performance Counters are fully set up before the _PerformanceCountersLogRecordProcessor and _PerformanceCountersSpanProcessor are added. I also removed the log itself because it is not useful as a warning. If a customer is on a Mac or another OS that does not have process I/O, there is nothing for them to do. They will still be able to get all the other Performance Counters.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

@github-actions github-actions bot added Monitor - Distro Monitor OpenTelemetry Distro Monitor - Exporter Monitor OpenTelemetry Exporter labels Jan 14, 2026
@jeremydvoss jeremydvoss marked this pull request as ready for review January 14, 2026 23:25
Copilot AI review requested due to automatic review settings January 14, 2026 23:25
Copy link
Contributor

Copilot AI left a 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 PR fixes a circular dependency issue in Performance Counters on Mac and other platforms where process I/O counters are unavailable. When _PerformanceCountersManager logged a warning about unavailable I/O counters, it triggered the _PerformanceCountersLogRecordProcessor, which in turn tried to access the not-yet-initialized singleton, causing an infinite lock.

Changes:

  • Reordered pipeline setup to initialize metrics (with Performance Counters) before tracing and logging
  • Removed non-actionable warning log for unavailable I/O counters on Mac/Linux
  • Added test coverage to verify metrics setup occurs before logging and tracing setup

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
azure/monitor/opentelemetry/_configure.py Moved metrics pipeline setup before tracing and logging to ensure Performance Counters are initialized before processors
azure/monitor/opentelemetry/exporter/_performance_counters/_manager.py Removed non-actionable warning log for unavailable Process I/O Rate counter
tests/test_configure.py Added test assertions to verify metrics setup order precedes logging and tracing
CHANGELOG.md Documented bug fix with placeholder PR number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Monitor - Distro Monitor OpenTelemetry Distro Monitor - Exporter Monitor OpenTelemetry Exporter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants