-
Notifications
You must be signed in to change notification settings - Fork 123
Support worker roles through HostBuilder #708
Comments
We need that feature as some of our Service Fabric services are simple console apps, |
@EvilAvenger, thanks for the feedback, I appreciate it. BTW you can configure dependency collection (including ServiceBus) manually, see https://docs.microsoft.com/en-us/azure/application-insights/application-insights-console. Hope it helps. |
@lmolkova Thanks for looking into it. As a matter of fact, I am asked to provide an example of AI.K8s for HostBuilder. Could you please take a look at this PR: 141. Personally, I think the work to support HostBuilder is minimal, well, without the splitting of the packages, of course. Is there any good reason not to do it? |
Sure, I'll have a look. There is no reason not to do it except there are no resources planned on it and no active feature to require this work. I assume we'll be happy to accept the contribution 🥇 |
@lmolkova I read the code briefly. It seems a simple but clean way to reach this is:
That way, we don't need a new package; different extension method will provide the end user an easy way to enable application insights. You can claim this package works for .NET Core than only ASP.NET Core. What do you think? I am intend to spend some spare time to make a PR for this but I want to check with you first since you are the repo owner. My fallback plan is to create those extension methods in my other packages, but it won't be as good as making them stay here. |
@lmolkova Maybe we point people to the new logging package? |
@davidfowl good point! Microsoft.Extension.Logging.ApplicaitonInsights is now shipped separately from Microsoft.ApplicationInsights.AspNetCore and can be used on generic hosts. It helps with logging, and we still should deliver support for other scenarios on the generic host: dependency collection, perf counters, sampling, correlation. |
This is being addressed with a new nuget package Microsoft.ApplicationInsights.WorkerService the 1st beta of which is ~1 week away. There will be docs when it releases. |
Starting with NET Core 2.1, the concept of HostBuilder/Host was introduced:
https://www.stevejgordon.co.uk/using-generic-host-in-dotnet-core-console-based-microservices
It decouples host creation and management (DI, configuration) from the Asp.NET Core and HTTP stack and enables worker role scenarios.
Application Insights AspNet Core SDK should be split into 2 packages:
first one that works for any app and configures everything not specific to HTTP server: majority of telemetry initializers, dependency collection, performance counter collection, heartbeats, quick pulse, sampling. .Net Full Fx apps perhaps may also benefit from it.
second one that depends on AspNetCore and enables http: request collection, JS injection, etc...
Perfect example where this is needed Azure WebJobs/Functions: they don't necessarily have http stack and have to configure the SDK from scratch.
The text was updated successfully, but these errors were encountered: