microsoft / ApplicationInsights-ServiceFabric

ApplicationInsights SDK for ServiceFabric projects
MIT License
63 stars 26 forks source link

How to get Azure service fabric performance metrics #114

Open TestUser0811 opened 3 years ago

TestUser0811 commented 3 years ago

Currently configured telemetry to Service Fabric service Service

     return new WebHostBuilder().UseHttpSys()
                        .ConfigureServices(
                            services => services
                                .AddSingleton<StatelessServiceContext>(serviceContext)
                                .AddSingleton<ServiceFabricAppContext>(new ServiceFabricAppContext(){
                                        NodeName = serviceContext.NodeContext.NodeName,
                                        ServiceHostIP=serviceContext.NodeContext.IPAddressOrFQDN,
                                        ServiceHostPort=FabricRuntime.GetActivationContext().GetEndpoints()[0].Port
                                } )
                                    .AddSingleton<ITelemetryInitializer>((serviceProvider) => 
    FabricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(serviceContext))) // Azure Service Fabric Telemetry 
   Initializer
                        .UseContentRoot(Directory.GetCurrentDirectory())
                           .UseApplicationInsights()
                        .UseStartup<Startup>()
                        .UseEnvironment(environment)
                        .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.None)
                        .UseUrls(url)
                        .Build();

Below are additional packages added,

  <PackageReference Include="Microsoft.ApplicationInsights.ServiceFabric.Native" Version="2.1.1" /> 
   <PackageReference Include="Microsoft.ServiceFabric.Diagnostics.Internal" Version="4.1.417" />

Right now under AzureApplicationInsights => logs, only "requests" table having data where as other required tables especially "performanceCounters" is empty.

What needs to be done/configured, so that already wired Azure Application insights instance can record performance Counters details like CPU, memory etc of existing service fabric nodes, which are hosting .Net Core 2.1 Web Api application?

Sampling not enabled from Azure portal.

image