Skip to content

[release/8.0-preview1] Implement RabbitMQ logging (#662) - #665

Merged
David Fowler (davidfowl) merged 1 commit into
release/8.0-preview1from
Port662
Nov 2, 2023
Merged

[release/8.0-preview1] Implement RabbitMQ logging (#662)#665
David Fowler (davidfowl) merged 1 commit into
release/8.0-preview1from
Port662

Conversation

@eerhardt

Copy link
Copy Markdown
Member

Port #662

Customer Impact

Without this, users of the RabbitMQ component won't get logs for error messages, warnings, etc.

  • Implement RabbitMQ logging

Add an EventSource listener to listen to the RabbitMQ event source which logs info, warn, and error messages. Forward these messages to an ILogger.

Fix #564

  • Stop coding like a dinosaur.

* Implement RabbitMQ logging

Add an EventSource listener to listen to the RabbitMQ event source which logs info, warn, and error messages. Forward these messages to an ILogger.

Fix #564

* Stop coding like a dinosaur.

protected sealed override void OnEventWritten(EventWrittenEventArgs eventData)
{
// Workaround https://github.com/dotnet/corefx/issues/42600

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.

is this copied from some old place?
looks like this was duped against something else, but indeed that is still active.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, the original implementation was taken from the Azure SDK.

When was debugging, I was getting OnEventWritten called for EventCounter EventSources that I wasn't even listening to. 😞


// Special case the Error event so the Exception Details are written correctly
if (eventData.EventId == 3 &&
eventData.EventName == "Error" &&

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.

is EventName ever not "Error" when EventId is 3?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I wanted to be super safe here. RabbitMQ has made breaking changes to their event source, so I wanted to ensure we didn't start crashing on a new version if they make even more breaking changes.

See rabbitmq/rabbitmq-dotnet-client#1027 (comment)

@eerhardt Eric Erhardt (eerhardt) changed the title Implement RabbitMQ logging (#662) [release/8.0-preview1] Implement RabbitMQ logging (#662) Nov 2, 2023
@davidfowl
David Fowler (davidfowl) merged commit 32661ad into release/8.0-preview1 Nov 2, 2023
Jose Perez Rodriguez (joperezr) added a commit that referenced this pull request Nov 14, 2023
@danmoseley Dan Moseley (danmoseley) added the area-integrations Issues pertaining to Aspire Integrations packages label Nov 16, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants