Giter VIP home page Giter VIP logo

applicationinsights-kubernetes's Introduction

Microsoft Application Insights for Kubernetes

This repository has code for Application Insights for Kubernetes, which works on .NET Core applications within the containers, managed by Kubernetes, on Azure Container Service.

Note: Microsoft Application Insights for Kubernetes (this library) is an enhancement to the Microsoft Application Insights. You can choose to run Application Insights without this library in Kubernetes cluster too. However, when using Microsoft Application Insights for Kubernetes, you will see Kubernetes related properties like Pod-Name, Deployment ... on all your telemetry entries. Proper values will also be set to make use of the rich features like enabling the Application Map to show the multiple micro services on the same map.

Continuous Integration Status

Rolling Build Nightly Build
Rolling-Build Status Nightly-Build Status

Get Started

Prerequisite

Instrument an ASP.NET Core application

These are the basic steps to instrument an ASP.NET Core application to enable Application Insights for Kubernetes. You will need to run the application in containers managed by Kubernetes to see the change.

  1. Add reference to Application Insights SDK and Application Insights for Kubernetes:

    dotnet add package Microsoft.ApplicationInsights.AspNetCore
    dotnet add package Microsoft.ApplicationInsights.Kubernetes
  2. Enable Application Insights and Application Insights for Kubernetes Enricher in Startup.cs:

    public void ConfigureServices(IServiceCollection services)
    {
        ...
        services.AddApplicationInsightsTelemetry("----Your Application Insights Instrumentation Key ----");
        services.AddApplicationInsightsKubernetesEnricher();
        services.AddMvc();
        ...
    }
  3. Build the application in containers, then deploy the container with Kubernetes.

Notes: Those steps are not considered the best practice to set the instrumentation key for application insights. Refer to Enable Application Insights server-side telemetry for various options. Also, consider deploy Kubernetes Secrets to secure it.

Walk-through

Both ASP.NET Core and .NET Core applications are supported.

  • For ASP.NET Core Application: Refer to Getting Started for a simple walk-through.

  • For .NET Core Application: Refer to Getting Started for a simple walk-through.

  • Follow this example for Role-based access control (RBAC) enabled Kubernetes clusters.

Configuration Details

Customize configurations are supported starting with version 1.0.2 of the ApplicationInsights.Kubernetes package. There are several ways to customize the settings. For example:

  1. Using code:

    services.AddApplicationInsightsKubernetesEnricher(option=> {
        option.InitializationTimeout = TimeSpan.FromSeconds(15);
    });
  2. Using appsettings.json:

    {
        "Logging": {
            // ...
        },
        // Adding the following section to set the timeout to 15 seconds
        "AppInsightsForKubernetes": {
            "InitializationTimeout": "00:00:15"
        }
    }
  3. Using environment variables:

    AppInsightsForKubernetes__InitializationTimeout=3.1:12:15.34

    All the related configurations have to be put in a section named AppInsightsForKubernetes. The supported keys/values are listed below:

    Key Value/Types Default Value Description
    InitializationTimeout TimeSpan 00:02:00 Maximum time to wait for spinning up the container. Accepted format: [d.]hh:mm:ss[.fffffff].
    DisablePerformanceCounters Boolean false Sets to true to avoid adding performance counter telemetry initializer.

The configuration uses the ASP.NET Core conventions. Refer to Configuration in ASP.NET Core for more information.

Verify the cluster configuration (Linux Container only)

Use the troubleshooting image to verify the cluster is properly configured.

Learn more

Next step

Profile your application for performance improvement using Application Insights Profiler for Linux.

Contributing

Report issues

Please file bug, discussion or any other interesting topics in issues on GitHub.

Troubleshooting

Read the FAQ for common issues. When Microsoft.ApplicationInsights.Kubernetes doesn't work properly, you can turn on self-diagnostics to see the traces in Kubernetes' logs. Refer to How to enable self diagnostics for ApplicationInsights.Kubernetes for instructions.

Developing

Please refer the Develop Guide.


This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

applicationinsights-kubernetes's People

Contributors

altenstedt avatar bartosz6 avatar karolz-ms avatar microsoftopensource avatar msftgits avatar xiaomi7732 avatar zhencui avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.