Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 2, 2023

Conversation

eerhardt
Copy link
Member

@eerhardt eerhardt commented Nov 2, 2023

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
Member

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
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
Member

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
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 eerhardt changed the title Implement RabbitMQ logging (#662) [release/8.0-preview1] Implement RabbitMQ logging (#662) Nov 2, 2023
@davidfowl davidfowl merged commit 32661ad into release/8.0-preview1 Nov 2, 2023
6 checks passed
@davidfowl davidfowl deleted the Port662 branch November 2, 2023 22:14
joperezr added a commit that referenced this pull request Nov 14, 2023
@danmoseley danmoseley added the area-components Issues pertaining to Aspire Component 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-components Issues pertaining to Aspire Component packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants