Fix RabbitMQ log forwarder EventId names in structured logs#17355
Open
alirezafzali wants to merge 1 commit into
Open
Fix RabbitMQ log forwarder EventId names in structured logs#17355alirezafzali wants to merge 1 commit into
alirezafzali wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR adjusts RabbitMQ EventSource log forwarding to avoid populating EventId.Name with the EventSource level name, and adds a regression test to validate that behavior.
Changes:
- Stop passing
eventData.EventNamewhen constructingEventIdduring EventSource forwarding. - Extend the test logger to record
EventIdvalues. - Add a new unit test asserting
EventId.Idis forwarded whileEventId.Nameremains empty.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/Aspire.RabbitMQ.Client.Tests/AspireRabbitMQLoggingTests.cs | Adds a test for EventId name suppression; updates test logger to capture EventId. |
| src/Components/Aspire.RabbitMQ.Client/RabbitMQEventSourceLogForwarder.cs | Changes EventId construction to omit Name, preventing level name being forwarded. |
| LogInfo("info"); | ||
| LogWarn("warn"); | ||
| LogError("error", new InvalidOperationException("test")); | ||
|
|
Contributor
Author
There was a problem hiding this comment.
The other unit tests in this file don’t wait after Log*. EventSource forwarding is synchronous once the listener is started. Happy to restructure if maintainers prefer a different pattern.
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 17355Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 17355" |
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.
Description
RabbitMQ's
EventSourceuses event names"Info","Warn", and"Error"that mirror log level.RabbitMQEventSourceLogForwarderwas passing those intoILoggerasEventId.Name, so the Aspire dashboard structured log UI showed misleading event names (e.g."Error") instead of leaving the event name unset.This change forwards only the numeric RabbitMQ event id (
1/2/3) and omits the level-like name. Log level continues to come fromLogLevelas before.Duplicate log message text in structured logs was already addressed in #6827; this completes the remaining part of #2967.
Changes:
RabbitMQEventSourceLogForwarder.cs: usenew EventId(eventData.EventId)instead of includingeventData.EventNameAspireRabbitMQLoggingTests.cs: addForwardsEventIdWithoutLevelNameregression testDependencies: None
Fixes #2967
Checklist
<remarks />and<code />elements on your triple slash comments?