i have an ServiceFabric StatefulService with Remoting inside a ServiceFabric Solution which also contains a Stateless WebApi and want to use Application Insights for monitoring this service. The WebApi uses already AI and it works fine.
I tried this in a dummy project an everything works fine with configuring AI in the constructor of the service:
public ReliableService(StatefulServiceContext context) : base(context)
{
var instrumentationKey = "myIKey";
TelemetryConfiguration.Active.TelemetryInitializers.Add(
FabricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(this.Context)
);
_telemetryClient = new Microsoft.ApplicationInsights.TelemetryClient { InstrumentationKey = instrumentationKey };
TelemetryConfiguration.Active.InstrumentationKey = instrumentationKey;
TelemetryConfiguration.Active.TelemetryInitializers.Add(new OperationCorrelationTelemetryInitializer());
TelemetryConfiguration.Active.TelemetryInitializers.Add(new HttpDependenciesParsingTelemetryInitializer());
new DependencyTrackingTelemetryModule().Initialize(TelemetryConfiguration.Active);
new ServiceRemotingRequestTrackingTelemetryModule().Initialize(TelemetryConfiguration.Active);
new ServiceRemotingDependencyTrackingTelemetryModule().Initialize(TelemetryConfiguration.Active);
}
But when I copy the same code to the existing project only the WebApi sends telemetry data to AI, nothing from the statefull service.
Any idea what i'm doing wrong? The documentations are not really helpful for me, there is not full example of using AI in a statefull service with remoting.
Thank you for your answers!