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

Arcus.Templates.AzureFunctions.Http & Health Check #378

Closed
pim-simons opened this issue Jun 7, 2021 · 9 comments
Closed

Arcus.Templates.AzureFunctions.Http & Health Check #378

pim-simons opened this issue Jun 7, 2021 · 9 comments
Labels
feature All issues related to new features runtime:azure-functions All issues related to templates forAzure Functions
Milestone

Comments

@pim-simons
Copy link
Contributor

pim-simons commented Jun 7, 2021

Is your feature request related to a problem? Please describe.
I always include a health check endpoint in my HTTP triggered Azure Functions, that way I can add it to my availability checks in Application Insights and have some pro-active monitoring on my HTTP triggered Functions. Is it possible to add this to the Arcus.Templates.AzureFunctions.Http template?

Describe the solution you'd like
Maybe we can add an opt-in for this in the template. I always use the Azure Function Health Check Library from here: https://github.com/keithsmith21/AzureFunctionHealth, unfortunately there is nu nuget package available for this (keithsmith21/AzureFunctionHealth#1). Maybe we could leverage that or do something similar?

Describe alternatives you've considered
Not adding it 😉

Additional context
none

@tomkerkhove
Copy link
Contributor

Looks like that project is nice, but no longer maintained.

I would suggest to fork the repo and make it available under Arcus.WebApi.Health.AzureFunctions which we can use here. What do you think @stijnmoreels?

@stijnmoreels
Copy link
Member

stijnmoreels commented Jun 8, 2021

Yes, I think that's a good idea. I stared a discussion #320 a while back for this topic.
Also: would you expose this forked repo as its own repo in the Arcus org or do you mean a new project in the Web API repo?

@stijnmoreels stijnmoreels added feature All issues related to new features runtime:azure-functions All issues related to templates forAzure Functions labels Jun 8, 2021
@stijnmoreels stijnmoreels added this to the v0.7.0 milestone Jun 8, 2021
@stijnmoreels
Copy link
Member

@pim-simons , is there a reason you choose to use this (https://github.com/keithsmith21/AzureFunctionHealth) library instead of the Microsoft health checks package? The .AddHealthChecks is available on the IServiceCollection of the IFunctionsHostBuilder in your Azure Functions project. As far as we could test is this working for us.

@pim-simons
Copy link
Contributor Author

I never got the Microsoft health check to work, as stated in https://github.com/keithsmith21/AzureFunctionHealth: "The traditional health checks registered in an aspnetcore API included the HealthCheckPublisherHostedService as a HostedService which is not possible or desired to run in an Azure Function.".

But this is from quite some time ago, so maybe things have changed and we can now use the Microsoft package.

@tomkerkhove
Copy link
Contributor

Would you mind giving it a go and tell us if it works nowadays? Otherwise it's a bit of a pity to maintain this.

@pim-simons
Copy link
Contributor Author

Will put it on my to-do list 👍

@pim-simons
Copy link
Contributor Author

Just checked, the Microsoft health checks package now work fine as well! So we don't need any extra code for this.
Could be an idea to include something like this in the template:

services.AddHealthChecks()
    .AddCheck("Example", () =>
        HealthCheckResult.Healthy("Example is OK!"), tags: new[] { "example" });

Just to trigger people to think about health check endpoints as they can be handy in pro-actively monitoring the health of your functions.

@tomkerkhove
Copy link
Contributor

tomkerkhove commented Aug 2, 2021

Thanks for testing - Let's kill our fork then @stijnmoreels.

Sorry for the trouble.

Let's open an issue for the health check which people can opt-in for then (#398)

@stijnmoreels
Copy link
Member

Close in favor of #398 . Feel free, @pim-simons , to open another issue when there's still a problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature All issues related to new features runtime:azure-functions All issues related to templates forAzure Functions
Projects
None yet
Development

No branches or pull requests

3 participants