Azure- Application Insights

     

Scenario: Monitor your applications logs, analytics and alerts.

Solution:

Azure Application Insights provides analytical data about your application. You create a new resource to monitor a new application. Then use instrumentation key to configure the Application Insights SDK, which links your telemetry to the resource.
  1. Navigate -> Azure portal
  2. Search -> Application Insights
    1. Name
    2. Resource Group
    3. Region
    4. Mode [Classic or Workspace-based]
    5. Review + Create
  3. Search for the newly created application Insights and copy the instrumentation key [Connection Strings]
  4. In Project -> appsettings.json add below "ApplicationInsights": {  "ConnectionString": "InstrumentationKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"  }
  5. Enable Application Insights [server-side telemetry]
    1. Project > Add Application Insights Telemetry
    2. Select subscription -> Resource > Register.
    3. Nuget package -> Microsoft.ApplicationInsights.AspNetCore, should have been added
  6. Enable for web applications [client-side telemetry]
    1. _ViewImports.cshtml -> @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet
    2. _Layout.cshtml -> @Html.Raw(JavaScriptSnippet.FullScript)</head>
  7. On application run telemetry would start flowing
    1. Live Metrics- Machine metrics.
    2. ILogger logs - Application logs

No comments:

Post a Comment

Move Github Sub Repository back to main repo

 -- delete .gitmodules git rm --cached MyProject/Core git commit -m 'Remove myproject_core submodule' rm -rf MyProject/Core git remo...