0
votes

I have a .Net core application that is deployed on service fabric Linux cluster. Application insights are configured in the app.

Startup.cs

public void ConfigureServices(IServiceCollection services)
        {            
            ApplicationInsights.AspNetCore.Extensions.ApplicationInsightsServiceOptions aiOptions
                = new ApplicationInsights.AspNetCore.Extensions.ApplicationInsightsServiceOptions
                {
                    EnableAdaptiveSampling = false,

                    EnableQuickPulseMetricStream = false,

                    InstrumentationKey = "xxx"
                };

services.AddApplicationInsightsTelemetry(aiOptions);

I have a controller class that has some action methods and logs the information.

[HttpPost]
public ActionResult actionMethod(...)
       {
            TraceLine("------------------------------------");
            //some code
       }

private static void TraceLine(string msg)
        {
            msg = $">> {DateTime.UtcNow.ToString("o")}: {msg}";
            Log.Information(msg);
        }

I am using Serilog, configured in appsettings.json & Program.cs

When I hit action method directly from local (without hosting it on even local sf cluster), via Postman, I see app insights getting generated and pushed to azure.

azure app insights snapshot

But when I hit the action method that is deployed on Azure service fabric I don't see any insight getting generated.

What am I missing here?

Any help is much appreciated!

2

2 Answers

0
votes

Well, we need to check a few things here:

1) The app insights URL and the instrumentation key in the deployment parameter files for cluster hosted on cloud (Cloud.xml)

2) After checking the Cloud.xml, the best way is to access the log files and check what is the actual problem.

There's a description here which explains how to discover where the log files are stored.

You can use RDP to access the machine, which is explained here.

0
votes

I was able to solve the issue by using Microsoft.ApplicationInsights.ServiceFabric.Native SDK in my application to log app insights.

Refer .NetCore section in ApplicationInsights-ServiceFabric on how to configure insights for service fabric application.