Skip to content

Add OpenTelemetry integration and code refactoring#66

Merged
ahanafy merged 10 commits into
mainfrom
ah-telemetry
May 3, 2026
Merged

Add OpenTelemetry integration and code refactoring#66
ahanafy merged 10 commits into
mainfrom
ah-telemetry

Conversation

@ahanafy

@ahanafy ahanafy commented May 1, 2026

Copy link
Copy Markdown
Collaborator

Introduce OpenTelemetry helpers for metrics and tracing in MPIC components, enhancing observability. Refactor code for improved readability by adjusting line breaks in method calls across multiple files.

@ahanafy
ahanafy marked this pull request as ready for review May 1, 2026 19:06
@ahanafy
ahanafy requested review from Copilot and sciros May 1, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OpenTelemetry-based tracing/metrics hooks across the MPIC coordinator and checker components to improve observability, plus minor refactors/formatting and a small telemetry helper module to centralize meter/tracer access.

Changes:

  • Introduce get_meter / get_tracer helpers and export them from open_mpic_core.
  • Add tracing spans and metrics (counters + histograms) to DCV, CAA, and coordinator execution paths.
  • Refactor/rewrap several method calls and blocks while integrating telemetry.

Reviewed changes

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

Show a summary per file
File Description
src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py Adds spans + request/duration metrics around DCV validation paths.
src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Adds spans + coordinator/perspective outcome metrics around orchestration and remote calls.
src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py Adds spans + request/duration metrics around CAA lookup/check logic.
src/open_mpic_core/common_util/telemetry.py New helper module to return global OTEL meter/tracer (no-op if unconfigured).
src/open_mpic_core/init.py Re-exports telemetry helpers from the package root.
pyproject.toml Adds opentelemetry-api dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py
Comment thread src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py
Comment thread src/open_mpic_core/mpic_coordinator/mpic_coordinator.py
Comment thread src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py
Comment thread src/open_mpic_core/mpic_coordinator/mpic_coordinator.py
Comment thread src/open_mpic_core/mpic_coordinator/mpic_coordinator.py
ahanafy and others added 2 commits May 1, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OpenTelemetry API-based helpers and instruments MPIC core components (coordinator, DCV checker, CAA checker) with tracing spans and basic request/duration metrics to improve observability, plus minor refactoring/formatting and a targeted unit test for CAA span error recording.

Changes:

  • Introduce get_meter / get_tracer helpers (no-op safe when no SDK is configured) and export them from open_mpic_core.
  • Add OTEL tracing spans + counters/histograms across coordinator/DCV/CAA flows, including exception recording.
  • Add a unit test asserting span exception/status behavior for CAA lookup failures; add opentelemetry-api dependency.

Reviewed changes

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

Show a summary per file
File Description
src/open_mpic_core/common_util/telemetry.py New helper module for fetching OTEL Meter/Tracer from global providers.
src/open_mpic_core/__init__.py Re-exports telemetry helpers for use across the library.
src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py Adds spans and request/duration metrics around DCV operations (overall + DNS/HTTP).
src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py Adds spans and request/duration metrics around CAA checks and DNS lookup.
src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Adds spans and metrics for coordinator lifecycle and remote perspective calls/responses.
tests/unit/open_mpic_core/test_mpic_caa_checker.py Adds test coverage for span error recording on CAA DNS lookup failure.
pyproject.toml Adds opentelemetry-api as a runtime dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pyproject.toml Outdated
Comment thread src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Outdated
Comment thread src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py
Comment thread src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py Outdated
Comment thread src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Outdated
…in CAA and DCV checkers

Co-authored-by: Copilot <copilot@github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OpenTelemetry-based tracing/metrics instrumentation to core MPIC components to improve observability, plus minor refactors to restructure call formatting and timing measurement.

Changes:

  • Introduce get_meter / get_tracer helper utilities and export them from open_mpic_core.
  • Instrument MPIC Coordinator, DCV Checker, and CAA Checker with OTel spans and metrics (counters + histograms).
  • Add a unit test asserting CAA lookup failures record exceptions and set span error status.

Reviewed changes

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

Show a summary per file
File Description
tests/unit/open_mpic_core/test_mpic_caa_checker.py Adds a unit test validating span exception/status behavior on CAA lookup failures.
src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py Adds OTel tracer/meter initialization and records request counts + duration histograms for DCV checks.
src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Adds OTel spans plus coordinator/request/remote-error/perspective-response metrics.
src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py Adds OTel spans, request counter, and duration histograms for CAA checks and DNS lookup timing.
src/open_mpic_core/common_util/telemetry.py New helper module providing get_meter / get_tracer accessors.
src/open_mpic_core/init.py Re-exports get_meter / get_tracer from the public package API.
pyproject.toml Adds opentelemetry-api runtime dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py
Comment thread src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py
Comment thread src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py
Comment thread src/open_mpic_core/mpic_coordinator/mpic_coordinator.py
…ceptions and setting error statuses for DNS and HTTP lookup failures

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds OpenTelemetry-based tracing and metrics instrumentation to core MPIC components (coordinator, DCV checker, CAA checker) via shared helper accessors, and extends unit tests to validate span error/exception recording behavior.

Changes:

  • Introduce get_meter / get_tracer helpers and export them from open_mpic_core.
  • Add counters/histograms and spans to MPIC Coordinator, DCV checker, and CAA checker (including exception recording and span error status).
  • Add/extend unit tests covering span creation and exception/status behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/open_mpic_core/common_util/telemetry.py New OpenTelemetry accessors for meters/tracers (API-only dependency).
src/open_mpic_core/__init__.py Re-export telemetry helpers for internal consumers.
src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Add coordinator-level spans + request/response/error metrics; record exceptions on span errors.
src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py Add DCV request span + per-protocol spans and duration metrics; record exceptions/status on failures.
src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py Add CAA check + DNS lookup spans and duration/request metrics; record exceptions/status on lookup failures.
tests/unit/open_mpic_core/test_mpic_coordinator.py Add span-related tests for coordinator and remote-call failure.
tests/unit/open_mpic_core/test_mpic_dcv_checker.py Add tests asserting exception recording/status on DNS/HTTP validation failures.
tests/unit/open_mpic_core/test_mpic_caa_checker.py Add test asserting exception recording/status on CAA lookup failure.
pyproject.toml Add opentelemetry-api dependency.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/unit/open_mpic_core/test_mpic_coordinator.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-class OpenTelemetry (OTel) tracing + metrics hooks across core MPIC components to improve observability, plus some refactoring/formatting adjustments to accommodate the new instrumentation.

Changes:

  • Introduce get_meter / get_tracer helpers (no-op safe when no SDK is configured) and export them from open_mpic_core.
  • Add spans, exception recording, span error status, and basic counters/histograms for MPIC coordinator, DCV checker, and CAA checker.
  • Extend unit tests to validate span creation and exception/status recording behavior.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/open_mpic_core/common_util/telemetry.py New OTel accessor helpers wrapping global providers (no-op safe).
src/open_mpic_core/__init__.py Re-export telemetry helpers for package-level access.
src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py Add spans + metrics for DCV checks and HTTP/DNS sub-operations, including exception recording.
src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py Add spans + metrics around CAA checks and DNS lookup timing, including exception recording.
src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Add coordinator + remote-call spans/metrics and counters for perspective outcomes/errors.
tests/unit/open_mpic_core/test_mpic_dcv_checker.py Add tests ensuring DNS/HTTP lookup errors record exceptions and set span error status.
tests/unit/open_mpic_core/test_mpic_caa_checker.py Add tests ensuring DNS lookup failures record exceptions and set span error status.
tests/unit/open_mpic_core/test_mpic_coordinator.py Add tests ensuring coordinator span starts and remote failures record exceptions/status.
pyproject.toml Add pinned runtime dependency on opentelemetry-api.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces OpenTelemetry-based tracing/metrics helpers and instruments key MPIC components (DCV checker, CAA checker, and coordinator) to emit spans and basic request/latency metrics, alongside minor refactors to improve readability and resilience.

Changes:

  • Add get_meter / get_tracer helpers (re-exported from open_mpic_core) and add opentelemetry-api as a dependency.
  • Instrument DCV checker, CAA checker, and MPIC coordinator with spans, exception recording, and counters/histograms for request counts and durations.
  • Extend unit tests to validate span creation and error-status/exception recording behavior.

Reviewed changes

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

Show a summary per file
File Description
tests/unit/open_mpic_core/test_mpic_dcv_checker.py Adds span error-recording assertions for DNS/HTTP lookup failures.
tests/unit/open_mpic_core/test_mpic_coordinator.py Adds span-start and remote-failure span error-recording tests.
tests/unit/open_mpic_core/test_mpic_caa_checker.py Adds span error-recording assertions for DNS lookup failures.
src/open_mpic_core/mpic_dcv_checker/mpic_dcv_checker.py Adds tracer/meter instrumentation, spans around check + DNS/HTTP validations, and duration/request metrics.
src/open_mpic_core/mpic_coordinator/mpic_coordinator.py Adds coordinator/remote-call spans, request/duration counters, and defensive handling for unexpected gather() results.
src/open_mpic_core/mpic_caa_checker/mpic_caa_checker.py Adds spans/metrics for CAA checks and DNS lookup timing with exception recording on failures.
src/open_mpic_core/common_util/telemetry.py New helper module providing versioned OpenTelemetry meter/tracer accessors.
src/open_mpic_core/init.py Re-exports get_meter / get_tracer from common_util.telemetry.
pyproject.toml Adds pinned runtime dependency on opentelemetry-api.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@birgelee

birgelee commented May 1, 2026

Copy link
Copy Markdown
Member

This looks good to me.

@ahanafy
ahanafy merged commit 5f97019 into main May 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants