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

Feature Request and Question: Background Worker Health Checks #1365

Open
aligneddev opened this issue Dec 13, 2024 · 1 comment
Open

Feature Request and Question: Background Worker Health Checks #1365

aligneddev opened this issue Dec 13, 2024 · 1 comment
Labels
enhancement New feature or request Needs: triage 🔍 Pending a first pass to read, tag, and assign

Comments

@aligneddev
Copy link

aligneddev commented Dec 13, 2024

I have a few AddHostedService, background worker containers running in Azure Container apps. There are health, liveness and readiness probes I wanted to use.

The document doesn't show an example of using the built in AddHealthChecks.

I have RabbitMQ, Redis, and Ngpsql checks I would like to add. I was wondering if my service lost connection to RabbitMq/Redis if a health check would cause a restart and then possible heal that connection

Question 1: Is ASP.Net required for these health checks and probes?

Question 2: Does .Net Aspire have the capability for probes and health checks for background services, with the Aspire Packages?

Describe the solution you'd like.

I would like to use the built in AddHealthChecks capabilities for a background service.

I would like to see an example in the Microsoft Docs on the best approaches and pro/cons of this approach.

Describe alternatives you've considered.
A clear and concise description of any alternative solutions or features you've considered. is informative using TCP to enable K8s health probes. I believe the same approach would work in ACA. There's a lot of custom code here, Is this the best approach?

Additional context.

    public static void Main(string[] args)
    {
        CreateHostBuilder(args).Build().Run();
    }

    public static HostApplicationBuilder CreateHostBuilder(string[] args)
    {
        var builder = Host.CreateApplicationBuilder(args);
        // a lot of setup and custom code

        builder.Services.AddHostedService<MessageQueueProcessor>();
        return builder;
    }

Thank you.

@aligneddev aligneddev added the enhancement New feature or request label Dec 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 Pending a first pass to read, tag, and assign label Dec 13, 2024
@aligneddev
Copy link
Author

aligneddev commented Dec 13, 2024

I did find a Microsoft doc which mentions Kubernetes and a HealthCheckPublisher and will look at that more.

Maybe I just need to use WebApplication.CreateBuilder for my worker service...

Here's more discussion on StackOverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Needs: triage 🔍 Pending a first pass to read, tag, and assign
Projects
None yet
Development

No branches or pull requests

1 participant