microsoft / applicationinsights-servicefabric Goto Github PK
View Code? Open in Web Editor NEWApplicationInsights SDK for ServiceFabric projects
License: MIT License
ApplicationInsights SDK for ServiceFabric projects
License: MIT License
It would be very handy to have automatic events tracked for the various life cycle events actors and services go through: registration, startup, shutdown, communication listener open/close, abort, etc.
For more information: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-reliable-services-lifecycle.
When using the CorrelatingServiceProxyFactory quite often an FabricElementAlreadyExistsException is thrown.
This has happened during a period of idleness, but can be more easily reproduce by disabling a node and calling the service when it is disabled.
I am not sure exactly which line is throwing the exception but this is an example of us calling one of the services.
var partitionKey = new ServicePartitionKey(partitionId);
var proxyFactory = new CorrelatingServiceProxyFactory(m_context, callbackClient => new FabricTransportServiceRemotingClientFactory(callbackClient: callbackClient));
var userManager = proxyFactory.CreateServiceProxy(new Uri("fabric:/EILicenceServer/EIUserManager"), partitionKey);
Exception thrown is:
System.Fabric.FabricElementAlreadyExistsException: Header with name 'ParentId' already exists
at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient1.<InvokeWithRetryAsync>d__23
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Remoting.Client.ServiceRemotingPartitionClient.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at EIAuthentication.Controllers.AuthenticationController.<ProcessConcurrencyDuringTokenRenewal>d__29.MoveNext()>",Edm.String,00000000-0000-0000-0000-000000000000,Edm.String,00000000-0000-0000-0000-000000000000,Edm.String,"serviceName=""fabric:/EILicenceServer/EIAuthentication"" serviceTypeName=""EIAuthenticationType"" replicaOrInstanceId=""131537878261862086"" partitionId=""9b523030-c84b-44c7-ab04-8d615a09a0f7"" applicationName=""fabric:/EILicenceServer"" applicationTypeName=""EILicenceServerType"" nodeName=""_nt1vm_1"" message=""AuthenticationController - ProcessConcurrencyDuringTokenRenewal: user:<sip:[email protected]> exception:<System.Fabric.FabricElementAlreadyExistsException: Header with name 'ParentId' already exists at Microsoft.ServiceFabric.Services.Communication.Client.ServicePartitionClient
1.d__231.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Remoting.Client.ServiceRemotingPartitionClient.<InvokeAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<InvokeAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.ServiceFabric.Services.Remoting.Builder.ProxyBase.<ContinueWithResult>d__3
1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at EIAuthentication.Controllers.AuthenticationController.d__29.MoveNext()>""",Edm.String,636449114244152530,Edm.Int64,0000008800388303185,Edm.String,2017-10-29T22:00:00.000Z,Edm.DateTime
It seems CorrelatingServiceProxyFactory and CorrelationgActorProxyFactory support only Service Remoting V1. What are the plans to support Service Remoting v2 in addition to Remoting v1 ?
We instrumented an Actor Proxy with CorrelatingActorProxyFactory. Whenever the Proxy Client does a retry (e.g. because the endpoint retrieved from the naming service is no longer valid), the following exception is traced to Application Insights, even though the remoting call was successful:
Error in Connection during ServiceCommunicationException from HRESULT: 0x80071C4C
We feel that moving processes around and doing retries is standard SF business and retries shouldn´t show up as exception traces in AI. Thoughts ?
Thanks!
System.Fabric.FabricCannotConnectException:
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.ServiceFabric.FabricTransport.Client.FabricTransportClient+d__9.MoveNext (Microsoft.ServiceFabric.FabricTransport, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.ServiceFabric.Services.Remoting.V1.FabricTransport.Client.FabricTransportServiceRemotingClient+<>c.<Microsoft.ServiceFabric.Services.Remoting.V1.Client.IServiceRemotingClient.RequestResponseAsync>b__29_0 (Microsoft.ServiceFabric.Services.Remoting, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Threading.Tasks.Task.Execute (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089) at Microsoft.ApplicationInsights.ServiceFabric.Remoting.Activities.CorrelatingServiceRemotingClient+<SendAndTrackRequestAsync>d__20.MoveNext (Microsoft.AI.ServiceFabric.Native, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) Inner exception System.Runtime.InteropServices.COMException handled at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw: at Microsoft.ServiceFabric.FabricTransport.NativeServiceCommunication+IFabricServiceCommunicationClient2.EndRequest (Microsoft.ServiceFabric.FabricTransport, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at Microsoft.ServiceFabric.FabricTransport.Client.FabricTransportClient.EndRequest (Microsoft.ServiceFabric.FabricTransport, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35) at System.Fabric.Interop.AsyncCallOutAdapter2
1.Finish (Microsoft.ServiceFabric.Internal, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
I discovered that even though the native nuget package depends on the base (and describes this dependency in nuspec and it can be seen in manage nuget packages), installing the native package for asp.net core app did not install the dependency base nuget.
This might be similar to: NuGet/Home#5130. Not sure if we can do anything about it on our end.
What is the plan for releasing a nuget package supporting the new .Net 2.0 Core templates in ServiceFabric Tools 2.0 preview?
Could you please show examples for Stateless WebApi and Remoting?
So with this AI Sdk, I don't have to setup ServiceEventSource anymore, and just create TelemetryClient singleton instead, correct?
I suggest to add a TelemetryInitializer that sets the ITelemetry.Context.Component.Version based on the CodePackageVersion.
Very simple version:
public class ServiceFabricComponentVersionTelemetryInitializer : ITelemetryInitializer
{
public void Initialize(ITelemetry telemetry)
{
var activationContext = FabricRuntime.GetActivationContext();
telemetry.Context.Component.Version = activationContext.CodePackageVersion;
}
}
Hi,
I am trying to use integration between application insights and an API project (ASP.NET Core) inside service fabric (as a stateless reliable service). I followed the instructions at this link https://github.com/Microsoft/ApplicationInsights-ServiceFabric and made changes to my config file but the telemetry still not working!
Here is what I configured:
Can you help me to figure out what is going on?
Thank you!
For telemetry generated / updated by AI.SF nuget, we need to have a way to mark it so that usage numbers can be ascertained.
Hi,
I am trying to use integration between application insights and an API project (ASP.NET Core) inside service fabric (as a stateless reliable service). I followed the instructions at this link https://github.com/Microsoft/ApplicationInsights-ServiceFabric and made changes to my config file but the telemetry still not working!
Here is what I configured:
Can you help me to figure out what is going on?
Thank you!
We have a Service Fabric Stateless Service running .NET Core (not ASP.NET). It's sole purpose is to process data in the background when a Service Bus message is received. We are using the latest SDK of the Service Bus and Application Insights and following the Message Handler Pattern. This works like a charm with Insights as it automagically creates a request when a message is received and correlates all Exceptions, Traces, and Dependency calls with the same request. Kudos to the team for that.
Now we want to be able to change the Success
and ResponseCode
of the underlying RequestTelemetry
object if an Exception is thrown or with our business rules. How do we do that?
I am utilizing the Microsoft.ApplicationInsights.ServiceFabric.Native (2.1.1-beta1) package in my Service Fabric application mostly to great success. I have one particular service, however, that does not seem to be populating the SF context properties correctly.
The situation is essentially when Service A is making a remoting (V2) call to Service B which is a StatefulService.
On the Service A side, a dependency telemetry is tracked as expected with all of the service fabric context properties populated correctly.
On the Service B side a request is indeed tracked and is correlated to the same operation as the dependency in Service A, however, all of the additional context properties for Service B are not being populated. In fact, the only one populated is ServiceFabric.NodeName. Additionally, the cloud role name does not display the name of the service, but instead that of the code package. The cloud role instance also displays the hostname of the node rather than the service instance.
In terms of config and initialization, I am setting the call context as instructed:
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
FabricTelemetryInitializerExtension.SetServiceCallContext(Context);
return this.CreateServiceRemotingReplicaListeners();
}
The service is using V2 remoting:
[assembly: FabricTransportServiceRemotingProvider(RemotingListener = RemotingListener.V2Listener, RemotingClient = RemotingClient.V2Client)]
And my application insights config looks as such:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryInitializers>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.HttpDependenciesParsingTelemetryInitializer, Microsoft.AI.DependencyCollector"/>
<Add Type="Microsoft.ApplicationInsights.ServiceFabric.FabricTelemetryInitializer, Microsoft.AI.ServiceFabric"/>
<Add Type="Microsoft.ApplicationInsights.ServiceFabric.CodePackageVersionTelemetryInitializer, Microsoft.AI.ServiceFabric.Native"/>
</TelemetryInitializers>
<TelemetryModules>
<Add Type="Microsoft.ApplicationInsights.DependencyCollector.DependencyTrackingTelemetryModule, Microsoft.AI.DependencyCollector">
<ExcludeComponentCorrelationHttpHeadersOnDomains>
<!--
Requests to the following hostnames will not be modified by adding correlation headers.
This is only applicable if Profiler is installed via either StatusMonitor or Azure Extension.
Add entries here to exclude additional hostnames.
NOTE: this configuration will be lost upon NuGet upgrade.
-->
<Add>core.windows.net</Add>
<Add>core.chinacloudapi.cn</Add>
<Add>core.cloudapi.de</Add>
<Add>core.usgovcloudapi.net</Add>
</ExcludeComponentCorrelationHttpHeadersOnDomains>
</Add>
<Add Type="Microsoft.ApplicationInsights.ServiceFabric.Module.ServiceRemotingRequestTrackingTelemetryModule, Microsoft.AI.ServiceFabric.Native"/>
<Add Type="Microsoft.ApplicationInsights.ServiceFabric.Module.ServiceRemotingDependencyTrackingTelemetryModule, Microsoft.AI.ServiceFabric.Native"/>
</TelemetryModules>
</ApplicationInsights>
Any thoughts as to why the context fields are not being populated as expected? Am I doing anything wrong?
I managed to create a working Live Metrics Steam environment in Application Insights that reflects the state of the cluster and the deployed applications, see https://github.com/DeHeerSoftware/Azure-Service-Fabric-Logging-And-Monitoring.
Is this on the roadmap for this repo as well? Is there a roadmap of upcoming features?
I am using the Native package to enrich my application insights telemetry, but I have noticed that not all telemetry is enriched with details from the ServiceContext, set by the call FabricTelemetryInitializerExtension.SetServiceCallContext(ServiceContext)
at startup in the SF Service class.
Many of our SF microservices use Owin based Web Api Contollers, RabbitMq message handlers and HangFire JobServers, all spawning their own threads, which leads me to think that I need to call the .SetServiceCallContext in more places than just the SF service class itself, to ensure that the CallContext for all threads have set the SF ServiceContext details to be picked up by Application Insights.
So should I call FabricTelemetryInitializerExtension.SetServiceCallContext(ServiceContext)
multiple times?
I tested this PR #51, and the correlation is not fully working when sending to multiple ikeys.
I'm using this project for testing: https://github.com/yantang-msft/service-fabric-dotnet-getting-started/tree/TestRemoting.
More specifically
Assuming we have two services A and B, both with OwinCommunicationListener and FabricTransportServiceRemotingListener with CorrelatingRemotingMessageHandler in place, when calling service A using REST which in turn calls service B using internal fabric communication then correlation data is propagated correctly but service fabric data (I mean ServiceName, ApplicationName. I know that RoleInstance and RoleName is taken from environment) is missing in telemetry requests created in CorrelatingRemotingMessageHandler in service B, even though FabricTelemetryInitializer is configured correctly and FabricTelemetryInitializerExtension is called in CreateServiceInstanceListeners method in both services. It does work in service A. Is it on purpose or is it an issue?
Hi,
When can we expect to have a new nuget release?
The correlation support for remoting will be really nice.
12c217c
Thanks,
Thieme
Although we can hand editing some of the package info in nuget.org, it will save time in the long run to make the info accurate in nuget spec files. Could you please update the info there?
Microsoft.ApplicationInsights.ServiceFabric.FabricTelemetryInitializer is available in the following assemblies.
Microsoft.AI.ServiceFabric.Native
Microsoft.AI.ServiceFabric
Since Microsoft.ApplicationInsights.ServiceFabric.Native has dependency to Microsoft.ApplicationInsights.ServiceFabric both the assemblies above are included when Microsoft.ApplicationInsights.ServiceFabric.Native is added to a project.
This results in the following error
The type 'FabricTelemetryInitializer' exists in both 'Microsoft.AI.ServiceFabric.Native, Version=2.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'Microsoft.AI.ServiceFabric, Version=2.1.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
I'm having trouble getting this to work well with actors and service bus. Is there any guidance as to how we should get this information added to our telemetry when logging events from within an actor instance or a message handler?
Hi
we have a setup with several services that all live in their separate processes (ExclusiveProcess) and they communicate using remoting V1. I have used the setup described but can't get the operationId passed to the service being called. I log the operationId from the caller and then from callee - it comes as some hashed value. Are we going to be happy with this, or exclusive processes are not supported?
I do:
traces | project timestamp, message, operation_Id | top 40 by timestamp desc
and see:
2018-05-16T10:17:08.860 Stateful1 is running: HelloWorld: Param=2018-05-16 12:17:08 - 122 P1TwdX7esgk=
2018-05-16T10:17:08.854 Stateless1 is running: 122 2018-05-16 12:17:08 - 122
2018-05-16T10:17:03.845 Stateful1 is running: HelloWorld: Param=2018-05-16 12:17:03 - 121 T3iCzQ4FoAs=
2018-05-16T10:17:03.840 Stateless1 is running: 121 2018-05-16 12:17:03 - 121
2018-05-16T10:16:58.825 Stateful1 is running: HelloWorld: Param=2018-05-16 12:16:58 - 120 sFtv6Fsv1No=
2018-05-16T10:16:58.821 Stateless1 is running: 120 2018-05-16 12:16:58 - 120
2018-05-16T10:16:53.812 Stateful1 is running: HelloWorld: Param=2018-05-16 12:16:53 - 119 uNxyYsZeLuU=
2018-05-16T10:16:53.808 Stateless1 is running: 119 2018-05-16 12:16:53 - 119
every 'hashy' value of operationId should be the one from the Stateless1 that makes the call.
Thanks
Maciej
To make AI app map fully work with ServiceRemoting, we need to pass the appId as well. This is low priority.
I am unable to figure out whether the applicationinsights.config should be placed in project root or in the PackageRoot\Config folder, as it should be when using Microsoft.Diagnostics.EventFlow.Outputs.ApplicationInsights
I need to load the content of applicationinsights.config on startup and set it as the default configuration for all TelemetryClient instances used in SF services.
I am trying to get the service remoting correlation to work using actors.
Following the instructions of the README.md it should be straight forward, but of course there are subtle differences when using Actors instead of stateless services.
On the client side I create a proxy as follows:
string actorUrl = "fabric:/MyApp/MyActor";
Guid id = Guid.NewGuid();
var proxyFactory = new CorrelatingActorProxyFactory(null, callbackClient => new
FabricTransportServiceRemotingClientFactory(callbackClient: callbackClient));
return proxyFactory.CreateActorProxy<TReadModelBuilder>(new Uri(actorUrl), new ActorId(id));
On the Actor side I have an "AiActorService" class that overrides CreateServiceReplicatListeners as follows:
protected override IEnumerable<ServiceReplicaListener> CreateServiceReplicaListeners()
{
var transportSettings = new FabricTransportRemotingListenerSettings
{
EndpointResourceName = "MyActorServiceEndpoint",
};
var result = new ServiceReplicaListener[1]
{
new ServiceReplicaListener(context => new FabricTransportActorServiceRemotingListener(context, new CorrelatingRemotingMessageHandler(context, this), transportSettings))
};
return result;
}
However when using the proxy, i get an exception saying "Interface id {id} is not implemented by object {proxy}"
Now looking at the replica listener the {id} does not correspond with the interface Id I find in the exception, so obviously something is wrong. But reverting back to the "default listener" (i.e. removing the AiActorService and just using the plain old ordinary actor service) everything works just fine.
Either there is something I am doing wrong because I don't understand what i am doing, or there is an issue with listener/proxy implementation.
Anyone who have got this working, or otherwise might be able to shed some light on this is appreciated.
I am unable to figure out how to integrate AI using Microsoft.ApplicationInsights.ServiceFabric.Native Nuget.
Can someone you provide how to configure AI with instrumentation key and log traces.
Moved from https://github.com/Microsoft/ApplicationInsights-Home/issues/166
Originally reported by @Eneuman
We have a project containing 12 Service Fabric applications and 40 services running on 5 servers.
Using the default setup for Application Insights results in 200 services sending the same performance telemetry, like server CPU and server avail mem, to AI witch uses up all of our AI storage.
All services are using .Net Core 2.
We need to reduce the amount of performance data that gets transmitted to AI, but all exceptions (with stacktraces) and requests must be send.
Can this be done and in that case; what is the recommended way of handeling this?
We would like to see the following performance data in AI:
- CPU load of each server
- CPU load of each service
- Avail mem of each server
- Used mem for each service
Hi,
Even reading the documentation i could not figure out where i have to configure the telemetry client to monitor my stateless project with remoting v2.
It don't have a WebHostBuilder to UseApplicationInsights() and services.AddApplicationInsightsTelemetry(chaveInstrumentacaoApplicationInsights);
please help me!
Thanks.
Currently for asp.net core, user need to inject the telemetry initializer manually (and request/dependency tracking module later once this is checked in #51).
We can leverage the hosting startup functionality to avoid such manual work. AI Kubernetes sdk already implemented that in this release https://github.com/Microsoft/ApplicationInsights-Kubernetes/releases/tag/1.0.0-beta5-2
Brilliant piece of code, thank you. I can't figure out though how to initialise message handler for Actors on server side. The client is passing the headers, however where do I place the code in Actor
implementation to pick them up similar to CreateServiceInstanceListeners()
in reliable services?
We have a stateless service that is running some background process when a service bus message is received. We are referencing Microsoft.ApplicationInsights.ServiceFabric.Native
2.1.1 nuget package.
In the constructor of the StatelessService
we are setting the insights key and initializing the telemetry as follows:
var telemetryConfig = TelemetryConfiguration.Active;
telemetryConfig.InstrumentationKey = key;
abricTelemetryInitializerExtension.CreateFabricTelemetryInitializer(context);
We want to track every new message as a request, so when we process the message we create a new RequestTelemetry
:
public RequestTelemetry StartRequest(string name)
{
var request = new RequestTelemetry { Name = name, Timestamp = DateTime.UtcNow };
return request;
}
We then Trace the request at the end:
public void TraceRequest(RequestTelemetry request, bool success, string responseCode = null)
{
request.Duration = DateTime.UtcNow - request.Timestamp;
request.Success = success;
request.ResponseCode = responseCode ?? (success ? "200" : "500");
_client.TrackRequest(request);
}
In between there are 3 dependecy calls: 1 to SQL Azure, another to Postgres, and the last one to Azure Search Services.
We do see the request on the VS Application Insights tab, but we do not see any dependencies related to the requests or by themselves.
Are we missing any configuration?
ServiceFabric AspNetCore middleware has an option ServiceFabricIntegrationOptions.UseUniqueServiceUrl. This option generates service-specific unique urls - which makes ServiceFabric telemetry difficult to correlate.
See microsoft/service-fabric-aspnetcore#18 .
IMO it would be really useful to have a telemetry initializer that strips autogenerated urls.
I can create a PR for this.
I try to install the Microsoft.ApplicationInsights.ServiceFabric.Native package to .NET 4.7.1 Stateless application without any success. I have following error
NU1608: Detected package version outside of dependency constraint: Microsoft.ServiceFabric.Services.Remoting 3.0.467 requires Microsoft.ServiceFabric.Services (= 3.0.467) but version Microsoft.ServiceFabric.Services 3.2.162 was resolved.
NU1608: Detected package version outside of dependency constraint: Microsoft.ServiceFabric.FabricTransport.Internal 3.0.467 requires Microsoft.ServiceFabric (= 6.1.467) but version Microsoft.ServiceFabric 6.3.162 was resolved.
NU1107: Version conflict detected for Microsoft.ServiceFabric.Diagnostics.Internal. Reference the package directly from the project to resolve this issue.
Test.Server.Host.ServiceFabric -> Microsoft.ServiceFabric.Services 3.2.162 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.2.162)
Test.Server.Host.ServiceFabric -> Microsoft.ApplicationInsights.ServiceFabric.Native 2.1.1 -> Microsoft.ServiceFabric.Services.Remoting 3.0.467 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.0.467).
Package restore failed. Rolling back package changes for 'Test.Server.Host.ServiceFabric'.
Dear team, I've repeated all steps from "Monitor and diagnose an ASP.NET Core application on Service Fabric" till the paragraph "View telemetry and the App map in Application Insights". As described in documentation at the step I should see events in Azure Application Insight. Unfortunately, I didn't see anything.
Debug output window shows following messages:
Application Insights Telemetry (unconfigured): {"name":"Microsoft.ApplicationInsights.Dev.Request","time":"2017-11-29T08:55:26.8391314Z","tags":{"ai.application.ver":"1.0.0.0","ai.cloud.role":"fabric:/Voting/VotingData","ai.cloud.roleInstance":"131564192630191563","ai.operation.id":"17993589-47f0a8360afffd48","ai.operation.name":"GET VoteData/Get","ai.location.ip":"::1","ai.internal.sdkVersion":"aspnet5f:2.2.0-beta1","ai.internal.nodeName":"XXXXXX.XXXXXX.local"},"data":{"baseType":"RequestData","baseData":{"ver":2,"id":"|17993589-47f0a8360afffd48.","name":"GET VoteData/Get","duration":"00:00:00.1632013","success":true,"responseCode":"200","url":"http://localhost:53576/c27e2db5-828a-4a69-b69d-7ba70c1eacce/131564192630191563/c11387c2-1aee-4ffa-b91b-f2e1c1029541/api/VoteData","properties":{"ServiceFabric.ServiceName":"fabric:/Voting/VotingData","ServiceFabric.ApplicationTypeName":"VotingType","ServiceFabric.ServiceTypeName":"VotingDataType","ServiceFabric.PartitionId":"c27e2db5-828a-4a69-b69d-7ba70c1eacce","httpMethod":"GET","ServiceFabric.ApplicationName":"fabric:/Voting","ServiceFabric.ReplicaId":"131564192630191563","AspNetCoreEnvironment":"Development","DeveloperMode":"true","ServiceFabric.NodeName":"_Node_0"}}}} Microsoft.AspNetCore.Mvc.Formatters.Json.Internal.JsonResultExecutor: Information: Executing JsonResult, writing value System.Collections.Generic.List
1[System.Collections.Generic.KeyValuePair2[System.String,System.Int32]]. Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker: Information: Executed action VotingWeb.Controllers.VotesController.Get (VotingWeb) in 262.2165ms Microsoft.AspNetCore.Hosting.Internal.WebHost: Information: Request finished in 288.6173ms 200 application/json; charset=utf-8 Exception thrown: 'System.IO.IOException' in mscorlib.dll 'VotingData.exe' (CLR v4.0.30319: VotingData.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_ru_b77a5c561934e089\System.resources.dll'. Module was built without symbols. Exception thrown: 'System.InvalidOperationException' in System.dll Exception thrown: 'System.InvalidOperationException' in System.dll Exception thrown: 'System.InvalidOperationException' in Microsoft.AI.PerfCounterCollector.dll Exception thrown: 'System.InvalidOperationException' in Microsoft.AI.PerfCounterCollector.dll Exception thrown: 'System.InvalidOperationException' in System.dll Exception thrown: 'System.NullReferenceException' in Microsoft.AI.PerfCounterCollector.dll Exception thrown: 'System.InvalidOperationException' in Microsoft.AI.PerfCounterCollector.dll Exception thrown: 'System.InvalidOperationException' in System.dll
What am I doing wrong?
Repository with sample you can see here.
P.S. I have to hide pc and domain name with XXXXXX.XXXXXX.local
Need document to get people start up on this repo.
Hi there, just want to know what the roadmap & timeline is for this package. What needs to be done before a non-preview nuget can be released?
We are in the process of upgrading some of our services and would like to use the new ServiceFabric ApplicationInsights integration. We are currently running .net framework 4.5.1. Is there any way we can get Microsoft.ApplicationInsights.EventSourceListener to run on .net 4.5.1?
If this is the wrong place to publish this please point me in the right direction.
Service Remoting emits performanc counters like below:
Category name | Counter name | Description |
---|---|---|
Service Fabric Service | # of outstanding requests | Number of requests being processed in the service |
Service Fabric Service | Average milliseconds per request | Time taken (in milliseconds) by the service to process a request |
Service Fabric Service | Average milliseconds for request deserialization | Time taken (in milliseconds) to deserialize service request message when it is received at the service |
Service Fabric Service | Average milliseconds for response serialization | Time taken (in milliseconds) to serialize the service response message at the service before the response is sent to the client |
The best way to collect these counters using WAD is using wildcards e.g.,
"counterSpecifier": "\\Service Fabric Service(*)\\Average milliseconds per request",
However, counters containing wildcards are not picked up by WAD2AI. As it is unrealistic to expect customers to know in advance all the services that might run on a service fabric node (as opposed to PaaS V1), it is unrealistic to ask them to mitigate the situation by explicitly spelling out all possible values at configuration time. WAD2AI should start supporting performance counters with wildcards.
RunAsync exceptions can have various consequences:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.servicefabric.services.runtime.statelessservice.runasync?view=azure-dotnet.
It stands to reason that such exceptions would be automatically logged by ApplicationInsights-ServiceFabric
using TelemetryClient.TrackException
(similar to how request exceptions are tracked by the ASP.NET Application Insights SDKs).
In OWIN based web application requests will not show up in the Application Insights Live Stream.
A solution to this problem is to use a QuickPulseTelemetryModule on the application like this post describes
Ideally this should be built-in, or at least have a reference implementation in this repository.
I'm getting an error using the Service Remoting telemetry.
It appears that the operation that is being stopped is invalid:
"message": "AI (Internal): Operation to stop does not match the current operation. Details: Telemetry Id '|1cafaa09-478a33c4492e47c3.a2a37cb4_' does not match current Activity '|1cafaa09-478a33c4492e47c3.a2a37cb4_1.'",
It looks like Application Insights is trying to stop a2a37cb4_
but it's currently running activity a2a37cb4_1
. Notice the 1
at the end.
Any ideas why this would be happening?
I'm using 2.1.1-beta1
Hi, there is a bug in resolving correct operation name both in client and listener. Operation name should be a calling method name but it's always 0 instead. The reason for that is invalid type name string in ctor in class ServiceRemotingMessageHeadersExtensions. Line 24.
Type actorMessageHeadersType = typeof(ActorMethodDispatcherBase).Assembly.GetType("Microsoft.ServiceFabric.Actors.Remoting.ActorMessageHeaders");
Turns out ActorMessageHeaders class is in different namespace Microsoft.ServiceFabric.Actors.Remoting.V1
Adding 'V1' does the trick.
Looking to add the Native package to our .Net Core Web API, dependency says >= SF 3.0.467 and our project is using 3.2.176. Got conflict error below, then did as suggested (install Microsoft.ServiceFabric.Diagnostics.Internal 3.2.176 directly) but now have warnings about versions, am I supposed to just ignore the errors?
Initial Error trying to Add..
Version conflict detected for Microsoft.ServiceFabric.Diagnostics.Internal. Install/reference Microsoft.ServiceFabric.Diagnostics.Internal 3.2.176 directly to project WebAPI to resolve this issue.
WebAPI -> Microsoft.ServiceFabric.Services 3.2.176 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.2.176)
WebAPI -> Microsoft.ApplicationInsights.ServiceFabric.Native 2.1.1 -> Microsoft.ServiceFabric.Services.Remoting 3.0.467 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.0.467).
Now get Warnings...
Detected package version outside of dependency constraint: Microsoft.ServiceFabric.Services.Remoting 3.0.467 requires Microsoft.ServiceFabric.Services (= 3.0.467) but version Microsoft.ServiceFabric.Services 3.2.176 was resolved.
I'm a big fan of using the Application map to identify the dependencies between my Service Fabric microservices, but one of the biggest quirks to it that I've identified is the disconnect between non-ASP.NET Core services and their various dependency calls between ASP.NET Core and non-ASP.NET Core services. Specifically, call from an ASP.NET Core service to another non-ASP.NET Core service will show up as a dependency between App.ServiceA and App.ServiceB, but a similar call between two non-ASP.NET Core services will show up as a call from App.ServiceB to fabric:/App/ServiceC, but App.Service will show up elsewhere on the graph (attached to App.ServiceA since there are other calls made directly to it from A).
To illustrate my point, I've attached a sanitized sample of my application map:
In this example, I have three services running:
I have two methods that will come into the API controller in ServiceA. One of them will make a call to App.ServiceB (via remoting) which will, in turn, make a call to ServiceC and return the results. The other method will directly call ServiceC and return those results.
Expected:
Just as App.ServiceA is directly connected to App.ServiceB and App.ServiceC in the above image, I'd expect to see App.ServiceB directly connected to App.ServiceC with a one-way arrow instead of this arbitrary dead-end dependency call to fabric:/App/ServiceC (as though App.ServiceC and fabric:App/ServiceC aren't the same thing, which they are).
Thanks!
When adding Microsoft.ApplicationInsights.ServiceFabric.Native 2.1.1 to a new Stateless Service I'm getting version conflicts which are listed below.
Note: I'm using the latest Service Fabric SDK 3.2.176
Error NU1107 Version conflict detected for Microsoft.ServiceFabric.Diagnostics.Internal. Install/reference Microsoft.ServiceFabric.Diagnostics.Internal 3.2.176 directly to project Web1 to resolve this issue.
Web1 -> Microsoft.ServiceFabric.AspNetCore.Kestrel 3.2.176 -> Microsoft.ServiceFabric.AspNetCore.Abstractions 3.2.176 -> Microsoft.ServiceFabric.Services 3.2.176 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.2.176)
Web1 -> Microsoft.ApplicationInsights.ServiceFabric.Native 2.1.1 -> Microsoft.ServiceFabric.Services.Remoting 3.0.467 -> Microsoft.ServiceFabric.Diagnostics.Internal (= 3.0.467). Web1 C:\[pathtto.csproj] 1
Also getting a smaller dependency constraint as follows:
Warning NU1608 Detected package version outside of dependency constraint: Microsoft.ServiceFabric.FabricTransport.Internal 3.0.467 requires Microsoft.ServiceFabric (= 6.1.467) but version Microsoft.ServiceFabric 6.3.176 was resolved. Web1 C:\[pathtto.csproj] 1
Looks like the IServiceRemotingMessageHandler has changed namespace in SF 2.8, which is a breaking change.
This break the feature for tracing remote calls using SF remoting (V1)
How to integrate AI to Guest Executable Service Fabric?
I'm not found any sample how to do that.
Thanks
Hey,
I'm getting an error when trying to use Microsoft.AI.ServiceFabric.Native in a .NET Framework
service. My .NET Core
services are working just fine.
Here is the error:
System.IO.FileLoadException
HResult=0x80131040
Message=Could not load file or assembly 'Microsoft.AI.ServiceFabric.Native, Version=2.1.0.0, Culture=neutral, PublicKeyToken=f23a46de0be5d6f3' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=Microsoft.Intentional.Services.Utilities.ServiceFabric
StackTrace:
at Microsoft.Intentional.Services.Utilities.ServiceFabric.Logging.ServiceRemotingDependencyExtensions.AddServiceRemotingTelemetry(IServiceCollection services)
at Microsoft.Intentional.Services.Shared.IntentionalWebHostBuilder.<>c__DisplayClass0_0`1.b__2(IServiceCollection services) in C:\Users\joschm\Intentional\services\src\IntentionalServices.Shared\IntentionalWebHostBuilder.cs:line 47
Here is the FusionLog:
=== Pre-bind state information ===
LOG: DisplayName = Microsoft.AI.ServiceFabric.Native, Version=2.1.0.0, Culture=neutral, PublicKeyToken=f23a46de0be5d6f3
(Fully-specified)
LOG: Appbase = file:///C:/SfDevCluster/Data/_App/_Node_0/IntentionalServicesType_App2/ContentValidationServicePkg.Code.1.0.0/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Intentional.Services.Utilities.ServiceFabric, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\SfDevCluster\Data_App_Node_0\IntentionalServicesType_App2\ContentValidationServicePkg.Code.1.0.0\ContentValidationService.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Microsoft.AI.ServiceFabric.Native, Version=2.1.0.0, Culture=neutral, PublicKeyToken=f23a46de0be5d6f3
LOG: Attempting download of new URL file:///C:/SfDevCluster/Data/_App/_Node_0/IntentionalServicesType_App2/ContentValidationServicePkg.Code.1.0.0/Microsoft.AI.ServiceFabric.Native.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
If I look in the pacakge folder, I see the following AI DLLs:
.NET Framework Service (which is not working):
ProductVersion | FileVersion | FileName |
---|---|---|
2.4.0.105563 | 2.4.0.105563 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentValidationServicePkg\Code\Microsoft.AI.Agent.Intercept.dll |
2.5.1.195 | 2.5.1.195 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentValidationServicePkg\Code\Microsoft.AI.DependencyCollector.dll |
2.5.1.195 | 2.5.1.195 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentValidationServicePkg\Code\Microsoft.AI.PerfCounterCollector.dll |
2.5.1.172 | 2.5.1.172 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentValidationServicePkg\Code\Microsoft.AI.ServerTelemetryChannel.dll |
2.1.0.140 | 2.1.0.140 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentValidationServicePkg\Code\Microsoft.AI.ServiceFabric.dll |
2.1.0.140 | 2.1.0.140 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentValidationServicePkg\Code\Microsoft.AI.ServiceFabric.Native.dll |
.NET Core Service (which is working):
ProductVersion | FileVersion | FileName |
---|---|---|
2.5.1 | 2.5.1.195 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentServiceFrontendPkg\Code\Microsoft.AI.DependencyCollector.dll |
2.5.1 | 2.5.1.195 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentServiceFrontendPkg\Code\Microsoft.AI.PerfCounterCollector.dll |
2.5.1.172 | 2.5.1.172 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentServiceFrontendPkg\Code\Microsoft.AI.ServerTelemetryChannel.dll |
1.0.0 | 2.1.0.140 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentServiceFrontendPkg\Code\Microsoft.AI.ServiceFabric.dll |
1.0.0 | 2.1.0.140 | C:\Users\joschm\Intentional\services\src\IntentionalServices\pkg\Debug\ContentServiceFrontendPkg\Code\Microsoft.AI.ServiceFabric.Native.dll |
So the big different I see here is the ProductVersion - is that wrong?
Version: 2.1.0-beta1
Stack Trace:
System.NullReferenceException:
at Microsoft.ApplicationInsights.ServiceFabric.Module.RequestTrackingUtils.GetBaggageFromActivity (Microsoft.AI.ServiceFabric.Native, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
at Microsoft.ApplicationInsights.ServiceFabric.Remoting.Activities.CorrelatingServiceRemotingClient+<SendAndTrackRequestAsync>d__19.MoveNext (Microsoft.AI.ServiceFabric.Native, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
Repeatability: Every time, consistently when using V1 remoting with instructions provided in readme.md with Full Framework Stateless service.
Application Insights already has pretty good support for http based service communication. That is, application insights modules can automatically intercept http based communication and generate request and dependency telemetry.
In Service Fabric, however, it is pretty common for services to communicate over Service Remoting. The proposal is to add automatic AI telemetry collection of service remoting stack as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.