Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide documentation on integrating AI with service fabric #80

Closed
balukantu opened this issue Aug 22, 2018 · 10 comments
Closed

Provide documentation on integrating AI with service fabric #80

balukantu opened this issue Aug 22, 2018 · 10 comments

Comments

@balukantu
Copy link

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.

@brahmnes
Copy link
Contributor

Hi @balukantu,
Have you looked at the readme on https://github.com/Microsoft/ApplicationInsights-ServiceFabric#net-core?
Do you have more specific questions? Which part are you stuck on?

@yantang-msft
Copy link
Contributor

@balukantu It depends on your project, whether it's a console app, or ASP .Net, or ASP .Net Core?
The Microsoft.ApplicationInsights.ServiceFabric.Native is an additive package and needs extra configuration, which is documented at here

@balukantu
Copy link
Author

@yantang-msft , I have service fabric application with one stateful service and one stateless service.

@yantang-msft and @brahmnes ,

I already have gone through the documentation which they have provided. I have done below steps and stuck in the middle.

Can you check and update me If I miss anything.

Installed Microsoft.ApplicationInsights.ServiceFabric.Native
ApplicationInsights.XML file is added with the necessary configuration.
In My Service, I have added below code.
Stateless Service

protected override IEnumerable CreateServiceInstanceListeners()
{
FabricTelemetryInitializerExtension.SetServiceCallContext(this.Context);

return new ServiceInstanceListener[]
{
    new ServiceInstanceListener(serviceContext => new OwinCommunicationListener(Startup.ConfigureApp, serviceContext, ServiceEventSource.Current, "ServiceEndpoint"))
};

}
Stateful Service

protected override Task RunAsync(CancellationToken cancellationToken)
{
FabricTelemetryInitializerExtension.SetServiceCallContext(this.Context);

return base.RunAsync(cancellationToken);

}

  1. Startup cntroller, I have added snippet

TelemetryClient telemetryClient = new TelemetryClient(new Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration("a263b486-09f1-43f5-ac9d-8fb7cb81377e"));

        telemetryClient.TrackEvent("Application Insights");
  1. Howevere, I am unable to see logs in application insights.

I have a couple of questions.

How to configure Instrumentation key from ApplicationInsights.XML ( as per documentation)
How to log messages with different security levels. And, If you find any solution which is using application insights using above Nuget. Please do share the location or Uri.

@yantang-msft
Copy link
Contributor

@balukantu Here is the full reference of the ApplicationInsights.config file. So basically, you don't need step #4.
You want to use TraceTrace instead of TraceEvent so as to specify the severity level.
And here is one example SF app that may help you get started with the configuration.

@brahmnes
Copy link
Contributor

Hi @balukantu,

Can you tell us if you are using ASP.NET core or ASP.NET?
Initialization of ApplicationInsights can be different depending on the project type.

@balukantu
Copy link
Author

@brahmnes I am developing native fabric application (.Net Framework)

@brahmnes
Copy link
Contributor

Hi @balukantu,

Even a fabric application can use ASP.NET or ASP.NET core.
Here is a question: Does your project have web.config in it? If you look at the packages.config file, does it have references to Microsoft.AspNet.* packages?

The fact that you are using OwinCommunicationListener suggests to me that you may be using Microsoft.AspNet.WebApi.Owin, but I am not sure.

@balukantu
Copy link
Author

balukantu commented Aug 29, 2018

@brahmnes , Yes, I have below references and I am using OwinCommunicationListener.
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.6" targetFramework="net461" /> <package id="Microsoft.AspNet.WebApi.Core" version="5.2.6" targetFramework="net461" /> <package id="Microsoft.AspNet.WebApi.Owin" version="5.2.6" targetFramework="net462" /> <package id="Microsoft.AspNet.WebApi.OwinSelfHost" version="5.2.6" targetFramework="net462" />

@brahmnes
Copy link
Contributor

@balukantu,
I suspect you just haven't enabled Application Insights for your OWIN app.
See this link:
https://stackoverflow.com/questions/29471811/how-do-i-enable-application-insights-server-telemetry-on-webapi-project-that-use

@brahmnes
Copy link
Contributor

Closing this issue since it's been inactive and presumably the issue was resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants