Code Monkey home page Code Monkey logo

applicationinsights-aspnetcore's Introduction

Microsoft Application Insights for ASP.NET Core applications

This repository has a code for Application Insights monitoring of ASP.NET Core applications. Read about contribution policies on Application Insights Home repository

Recent updates

Microsoft.ApplicationInsights.AspNet was renamed to Microsoft.ApplicationInsights.AspNetCore. We have updated the SDK to use the stable 1.0.0 release of the .NET Core CLI runtime environment. Please note that this version is not compatible with RC1 bits of DNX environment. Furthermore, metrics stream is enabled by default in .NET Framework of ASP.NET Core.

Getting Started

Application Insights monitoring is a service that allows you to collect monitoring and diagnostics information about your application. The getting started guide shows how you can onboard your ASP.NET Core web application to use the Application Insights SDK.

Application Insights collects a lot of information out-of-the-box such as requests, exceptions, and usage. It also allows you to configure additional data collection. The configure guide demonstrates the most common tasks you may want to do.

Repository structure

root\
    ApplicationInsights.AspNetCore.sln - Main Solution

    src\
        ApplicationInsights.AspNetCore - Application Insights package

    test\
        ApplicationInsights.AspNetCore.Tests - Unit tests
        FunctionalTestUtils - test utilities for functional tests
        MVCFramework45.FunctionalTests - functional tests for MVC application
        WebApiShimFw46.FunctionalTests - functional tests for Web API application
        PerfTest - performance test

Developing

Note: The current version (Microsoft.ApplicationInsights.AspNetCore: 1.0.0) is no longer compatible with DNX runtime and ASP.NET 5 RC1 bits. Please visit Migration to ASP.NET Core to upgrade the application to ASP.NET Core 1.0.0.

Pre-requisites

git clone https://github.com/Microsoft/ApplicationInsights-aspnetcore.git

Building

From Visual Studio 2015

devenv ApplicationInsights.AspNetCore.sln

From Visual Studio 2015 Developer Command Prompt: Navigate to the source project folder and use the following commands to build the project:

dotnet restore &REM Restores the dependency packages
dotnet build &REM Builds the project
  • If you get NPM package restore errors, make sure Node and NPM are added to PATH.
  • If you get Bower package restore errors, make sure Git is added to PATH.
  • If you get dotnet package restore errors, make sure .NET Core CLI is installed and the nuget feeds are up to date.
  • In case of .NET Core applications, if you run into restore errors with respect to application insights dependency, please add "dnxcore50" and "portable-net45+win8" to the imports list (if it does not exist), under frameworks section of project.json, as described below. Please visit Migrating from DNX for more details.
{
    "frameworks": {
        "netcoreapp1.0": { 
            "imports": ["dnxcore50", "portable-net45+win8"]
        }
    }
}

Branches

Running and writing tests

There are two sets of tests unit tests and functional tests. Please use unit tests for all features testing. The purpose of functional tests is just end-to-end validation of functionality on sample applications.

Functional tests Functional tests are regular web applications with unit tests integrated into them. Application can be compiled as a regular web application as well as set of tests. Typical functional tests will do the following:

  1. Host the current project in In-Proc server.
  2. Initialize application insights telemetry channel.
  3. Initiate request to self hosted web application using HttpClient.
  4. Check data received in telemetry channel.

The following are modifications made to a regular web application to make it work this way:

Add dependencies to project.json:

"FunctionalTestUtils": "1.0.0-*",
"dotnet.test.xunit": "1.0.0-*",
"xunit": "2.1.0"

and test command:

"test": "xunit"

Add this initialization logic to Startup.cs:

services.AddFunctionalTestTelemetryChannel();

Running Tests You can run unit tests using Visual Studio.

You can run unit tests using .NET CLI from command line. The prerequisite to this is that you should make sure you have the latest version of .NET CLI. You can check the available runtime using the following command:

dotnet --version

If you are seeing that dotnet is not available (or defined), install .NET CLI: .NET Core + CLI tools (SDK).

After that you can open a developer command prompt, navigate to each test folder and run:

dotnet restore &REM Restores the dependency packages
dotnet build &REM Builds the test project
dotnet test &REM Runs the tests within the test project

You can also run all tests using the following Powershell from root directory.

powershell .\RunTestsCore.ps1

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-aspnetcore's People

Contributors

abaranch avatar alexbulankou avatar billpratt avatar capfei avatar cijothomas avatar dfederm avatar dnduffy avatar gzepeda avatar henkmollema avatar iusafaro avatar karolz-ms avatar kartang avatar nickcraver avatar olegsych avatar pakrym avatar pharring avatar pkarda avatar rehansaeed avatar sergei-nikitin avatar upendras avatar xiaomi7732 avatar yantang-msft avatar

Watchers

 avatar  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.