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

Eventhubs health check (retargeted for main) #4139

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

oising
Copy link
Contributor

@oising oising commented May 10, 2024

Original: #4050

Closes #3980

Microsoft Reviewers: Open in CodeFlow

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-codeflow for labeling automated codeflow. intentionally a different color! label May 10, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label May 10, 2024
@@ -101,4 +105,41 @@ protected static string GetNamespaceFromSettings(AzureMessagingEventHubsSettings
$"the '{configurationSectionName}' configuration section.");
}
}

protected sealed class AzureEventHubHealthCheck : IHealthCheck, IAsyncDisposable
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason we aren't using https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/tree/master/src/HealthChecks.Azure.Messaging.EventHubs? Typically we try to use those because they are the "best practice", and if they aren't meeting our needs, we should update them to meet our needs.

That way any improvements can be used by anyone - not just Aspire.

Copy link
Contributor Author

@oising oising May 17, 2024

Choose a reason for hiding this comment

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

I knew about these packages but when I looked for an eventhubs one, it was not in the public feed. I am confused by this new information.

Edit: So yeah, look at the service bus component (from which I based this one) -- it's using https://www.nuget.org/packages/AspNetCore.HealthChecks.AzureServiceBus which I believed to be an official package. I searched for AspNetCore.HealthChecks.AzureEventHubs and came up empty. Tried a few variants, got nothing. So wrote my own.

Turns out other components are using third party healthchecks so you have a larger consistency problem than just EH :/

Copy link
Member

Choose a reason for hiding this comment

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

Each package needs to be added, I will do that for this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If MSFT have official HC packages you should be using them in all components. This doesn't seem to be the case...

Copy link
Member

Choose a reason for hiding this comment

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

Done

Copy link
Member

Choose a reason for hiding this comment

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

If MSFT have official HC packages you should be using them in all components. This doesn't seem to be the case...

Microsoft doesn't have any "official health check" packages. .NET Aspire has been using https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks. See https://github.com/dotnet/aspire/tree/main/src/Components#health-checks

Copy link
Contributor Author

@oising oising May 27, 2024

Choose a reason for hiding this comment

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

I should be able to switch to using the 3rd party package some time this week. (The relevant nuget package wasn't in the dotnet-public feed -- @ReubenBond added it for me)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Were you able to use the package from https://github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks?

Doing it right at this moment.

};

// At this point, the connection string or credential should already be validated by the AddClient call
_probe = !string.IsNullOrEmpty(settings.ConnectionString) ?
Copy link
Member

Choose a reason for hiding this comment

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

There is another case that I am now handling in #4209 where the EventHub is not part of the connection string but defined in the settings

https://github.com/dotnet/aspire/pull/4209/files#diff-55b0ddc0e2f1aec7c2af54c1f06af30b30ad2aaf09a64c725e209ae393d87eafR54-R57

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-codeflow for labeling automated codeflow. intentionally a different color! community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EventHub component does not have health check
3 participants