简体   繁体   中英

Application Insights in Service Fabric?

I need to add performance logging in a Azure Service Fabric application I'm developing. I've tried to follow the following guide which seems quite straightforward and easy:

https://github.com/Microsoft/azure-content/blob/master/articles/service-fabric/service-fabric-diagnostics-application-insights-setup.md

Yet, I'm unable to find the package Microsoft.ServiceFabric.Telemetry.ApplicationInsights on NuGet. Since that article is from last year maybe things have changed quite a bit, but I'm not sure whether configuring Insights for aan Azure Service Fabric app is quite different from any ASP.Net app (I can imply from the article that maybe is a bit different).

Can someone point me in the right direction on how to do it properly?

Thank you.

The NuGet package is located here: https://www.nuget.org/packages/Microsoft.ServiceFabric.Telemetry.ApplicationInsights/

Make sure to configure your search to include "Prerelease" packages.

You're likely looking for the updated GitHub repository at https://github.com/Microsoft/ApplicationInsights-ServiceFabric . This lists two NuGet packages to use depending on your use case:

We did come up with our own integration including support for dependency tracking and Live Metrics Stream.

Basically what you need to do is manually adding the required dependency and performance collectors of Application Insights to your application like this:

        var configuration = new TelemetryConfiguration()
        {
            InstrumentationKey = aiKey
        };

        var module = new DependencyTrackingTelemetryModule();
        module.Initialize(configuration);

        QuickPulseTelemetryProcessor processor = null;

        configuration.TelemetryProcessorChainBuilder
            .Use(next =>
            {
                processor = new QuickPulseTelemetryProcessor(next);
                return processor;
            })
            .Build();

        var quickPulse = new QuickPulseTelemetryModule();
        quickPulse.Initialize(configuration);
        quickPulse.RegisterTelemetryProcessor(processor);

Then to log and correlate requests of your frontend services and your backend stateful/stateless services you will need to intercept calls to the SF services based on the directions of this post: How to add message header to the request when using default client of Azure service fabric?

Web Api requests can be logged to Application Insights using some custom Middleware, that is not too hard to write.

We have created a code repository that outlines a working example that can be found here at https://github.com/DeHeerSoftware/Azure-Service-Fabric-Logging-And-Monitoring

It is quite a lot of code to integrate everything so please take a look at the provided repository. It will give you a starting point.

实时指标流

依赖追踪

The package can still be installed using Package Manager Console:

Install-Package Microsoft.ServiceFabric.Telemetry.ApplicationInsights
 -Pre -Version 0.3.193-preview2 

However, see the important note "The owner has unlisted this package. This could mean that the package is deprecated or shouldn't be used anymore."

https://www.nuget.org/packages/Microsoft.ServiceFabric.Telemetry.ApplicationInsights/

It looks like it's still very early days on this integration. Additionally all it currently does is route ETW events through to App Insights.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM