Base solution for your next web application
Open Closed

Application insights #4435


User avatar
0
thor created

Hi,

I am running Angular with Asp.Net Core (two services - not merged) and would like to enable application insights (AI) for the Asp.Net Core Host service running in Azure. I have been able to connect the AI Log4Net appender and it is sending trace logs to AI. However, it is not collecting anything else.

Is it possible to run AI this way?

Thor


10 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @thor,

    We are not familiar with Application Insights in Azure. What kind of information would you like to collect ?

  • User Avatar
    0
    OriAssurant created

    Error logging to post to AI would be really useful.

    <a class="postlink" href="https://docs.microsoft.com/en-us/azure/application-insights/app-insights-api-custom-events-metrics">https://docs.microsoft.com/en-us/azure/ ... ts-metrics</a>

  • User Avatar
    0
    walkerscott created

    we have a solution to this. We save our App Insights Instrumentation Key to AbpSettings and this then gets loaded at startup. We also do something similar for Google Analytics.

    We'd be willing to contribute this to AspNetZero repo via PR if the team is interested?

  • User Avatar
    0
    alper created
    Support Team

    hi,

    send your PR.

  • User Avatar
    0
    blewis created

    Built in AI support would be awesome. Just voting for this integration!

  • User Avatar
    0
    Mitch created

    A vote from me too. It's been a real pain to try to get it to integrate.

  • User Avatar
    0
    bbakermmc created

    It looks pretty easy to me. <a class="postlink" href="https://docs.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-core">https://docs.microsoft.com/en-us/azure/ ... p-net-core</a>

    Then you install the nuget package for logging <a class="postlink" href="https://github.com/Microsoft/ApplicationInsights-dotnet-logging">https://github.com/Microsoft/Applicatio ... et-logging</a>

  • User Avatar
    0
    BobIngham created

    I know this issue is closed but I also believe there is some trick to getting Application Insights to work in the Zero framework. @walkerscott is it possible for you to share your thoughts/code on this?

  • User Avatar
    0
    Gaurav.Mahajan created

    Hi

    Just checking to see if this evercame through: https://support.aspnetzero.com/QA/Questions/4435#answer-fabc2f47-8b35-44f1-ad6a-6c6bc35e12ff

    Thank you!

  • User Avatar
    0
    BobIngham created

    I'm on a very old version of Zero but I'll try help. Add nuget packages to Web.Host: Implement AI in Azure and get the instrumentation key and add to appsettings.production.json:

        "ApplicationInsights": {
            "InstrumentationKey": "f6898a23-ea45-40e9-a781-6084fce5621f"
        },
    

    Implement in StartUp.cs (Web.Host):

    //BI 20191115 0.14.1
    // The following line enables Application Insights telemetry collection.
    services.AddApplicationInsightsTelemetry();
    #if DEBUG
        TelemetryConfiguration.Active.DisableTelemetry = true;
        TelemetryDebugWriter.IsTracingDisabled = true;
    #endif
    

    I had to jump through hoops to get the SnapshotCollector to work but that's because my version of Zero is 6.8.0 on aspnet framework 4.6 running dotnetcore 2.2. Given my old version hopefully this should give you enough pointers to get started, I doubt it will work out of the box because it's simpler with more modern configurations.