1
0
Форкнуть 0
ASP.NET Core web applications monitoring
Перейти к файлу
Cijo Thomas 808cde5302 Merge pull request #490 from Microsoft/cithomas/azureemulatorfixandversionbumps
Fix issue 488.
2017-07-10 16:12:09 -07:00
keys Enable strong name signing 2015-11-04 21:58:45 -08:00
src/Microsoft.ApplicationInsights.AspNetCore Fix issue 488. 2017-07-10 09:47:27 -07:00
test Functional test temp fix - use machine name instead of localhost, so that correlation headers are injected 2017-07-10 13:42:33 -07:00
.gitattributes Update to RC2 along with the renaming of dependencies, Renaming To AspNetCore and Change the runtime to CLI 2016-03-17 13:21:03 -07:00
.gitignore Fixes issue 410 - Remove the use of Platform Abstractions 2017-05-03 13:14:31 -07:00
ApplicationInsights.AspNetCore.sln Wrote CHANGELOG.md file from release history. 2016-09-16 14:51:08 -07:00
CHANGELOG.md Minor addition to changelog 2017-07-10 15:13:06 -07:00
CleanPackages.ps1 Updating scripts and retaining old scripts 2016-05-06 11:30:54 -07:00
CleanPackagesCore.ps1 Updating scripts and retaining old scripts 2016-05-06 11:30:54 -07:00
Common.targets removed additional white spaces 2015-07-06 09:15:38 -07:00
LICENSE Initial commit 2015-03-17 12:39:40 -07:00
Microsoft-Security-Recommended.ruleset Added code analysis. 2016-08-15 10:14:40 -07:00
NuGet.config Populate NodeName + logic for Azure Web Apps 2016-11-04 09:51:08 -07:00
NuGet.exe Update nuget.exe to 4.1 to meet compliance 2017-05-01 14:25:12 -07:00
Readme.md Update Readme.md 2016-07-03 21:24:41 +02:00
RunTestsCore.ps1 Return to root solution dir after tests are executed (#406) 2017-04-26 00:52:31 -07:00
SetEnv.targets Marked the analyzers for build only and not NuGet packaging. Rev'ed versioning. 2016-09-28 16:10:26 -07:00
Signing.props Updated version of referenced signing plugin. (#369) 2017-03-27 13:14:36 -07:00
ThirdPartyNotices.txt Removing unused external test dependencies and adding third party notice 2016-09-01 16:59:07 -07:00
build.cmd Fixing tests availability in RC1, adding tests to make sure modules are working and refining some sections of the code 2016-01-28 16:26:24 -08:00
build.ps1 Making properties automatic and changing the build definition to release 2016-05-09 12:30:44 -07:00
dirs.proj Removed clearing entire nuget cache from dirs.proj as this is clearing entire machine cache in build servers and slowing down total time. 2017-05-03 14:29:01 -07:00
global.json Merge 2.1.0-beta1 changes to develop. (#374) 2017-03-30 13:59:24 -07:00

Readme.md

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 opencode@microsoft.com with any additional questions or comments.