Skip to content

Align messaging diagnostics#9488

Merged
PascalSenn merged 5 commits intomainfrom
pse/cleanup-messaging-diagnostics
Mar 30, 2026
Merged

Align messaging diagnostics#9488
PascalSenn merged 5 commits intomainfrom
pse/cleanup-messaging-diagnostics

Conversation

@PascalSenn
Copy link
Copy Markdown
Member

@PascalSenn PascalSenn commented Mar 30, 2026

No description provided.

Copilot AI review requested due to automatic review settings March 30, 2026 19:36
Copy link
Copy Markdown
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 refactors Mocha’s messaging diagnostics from a single IBusDiagnosticObserver to a listener-based model (IMessagingDiagnosticEventListener / IMessagingDiagnosticEvents) that supports multiple registered listeners and aligns error-path signaling across dispatch/receive/consume.

Changes:

  • Replace IBusDiagnosticObserver with IMessagingDiagnosticEvents and listener/aggregation infrastructure.
  • Update dispatch/consume instrumentation middlewares to emit error events on exceptions.
  • Update tests and the OpenTelemetry example to use the new diagnostic listener registration APIs.

Reviewed changes

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

Show a summary per file
File Description
src/Mocha/test/Mocha.Tests/Middlewares/Receive/ReceiveInstrumentationMiddlewareTests.cs Updates tests to use IMessagingDiagnosticEvents and renamed error callback expectations.
src/Mocha/test/Mocha.Tests/Middlewares/Dispatch/DispatchInstrumentationMiddlewareTests.cs Updates tests to use IMessagingDiagnosticEvents.
src/Mocha/test/Mocha.Tests/Middlewares/Consume/ConsumerInstrumentationMiddlewareTests.cs Updates tests to use IMessagingDiagnosticEvents.
src/Mocha/src/Mocha/Observability/NoOpBusDiagnosticObserver.cs Removes old no-op observer implementation.
src/Mocha/src/Mocha/Observability/IBusDiagnosticObserver.cs Removes old observer interface.
src/Mocha/src/Mocha/Observability/Configuration/InstrumentationBusExtensions.cs Adds listener registration APIs (AddDiagnosticEventListener) and updates AddInstrumentation().
src/Mocha/src/Mocha/Middlewares/Receive/ReceiveInstrumentationMiddleware.cs Switches receive instrumentation to IMessagingDiagnosticEvents.
src/Mocha/src/Mocha/Middlewares/Dispatch/DispatchInstrumentationMiddleware.cs Switches to IMessagingDiagnosticEvents and adds dispatch error callback on exception.
src/Mocha/src/Mocha/Middlewares/Consume/ConsumerInstrumentationMiddleware.cs Switches to IMessagingDiagnosticEvents and adds consume error callback on exception.
src/Mocha/src/Mocha/Instrumentation/NoopMessagingDiagnosticEvents.cs Introduces no-op diagnostics implementation for the new model.
src/Mocha/src/Mocha/Instrumentation/MessagingDiagnosticEventListener.cs Adds a base class with no-op defaults and a shared empty scope.
src/Mocha/src/Mocha/Instrumentation/IMessagingDiagnosticEvents.cs Introduces the new diagnostics events interface used by middlewares.
src/Mocha/src/Mocha/Instrumentation/IMessagingDiagnosticEventListener.cs Introduces the listener interface (multiple implementations supported).
src/Mocha/src/Mocha/Instrumentation/AggregateMessagingDiagnosticEvents.cs Adds aggregation over multiple listeners, returning an aggregate scope.
src/Mocha/src/Mocha/Instrumentation/ActivityMessagingDiagnosticListener.cs Replaces prior OpenTelemetry observer with an Activity-based listener implementation.
src/Mocha/src/Mocha/Builder/MessageBusBuilder.cs Resolves listeners and selects no-op/single/aggregate diagnostics for runtime.
src/Mocha/src/Examples/Observability/OpenTelemetry/OpenTelemetryExample.cs Updates example to register instrumentation + a custom listener via the new APIs.
Comments suppressed due to low confidence (1)

src/Mocha/src/Mocha/Instrumentation/ActivityMessagingDiagnosticListener.cs:7

  • This change replaces the previously public OpenTelemetry diagnostic observer type with an internal listener (ActivityMessagingDiagnosticListener). If OpenTelemetryDiagnosticObserver was part of the public surface area, this is a breaking change for consumers who referenced it directly. Consider keeping a public, obsolete shim type (forwarding to the new listener model) or documenting the migration path in release notes.

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

@github-actions github-actions bot added the 📚 documentation This issue is about working on our documentation. label Mar 30, 2026
@PascalSenn PascalSenn merged commit 907a36b into main Mar 30, 2026
129 checks passed
@PascalSenn PascalSenn deleted the pse/cleanup-messaging-diagnostics branch March 30, 2026 21:26
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (7c63577) to head (1d9dc97).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9488   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

📚 documentation This issue is about working on our documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants