Code Monkey home page Code Monkey logo

app-insights-correlation's Introduction

app-insights-correlation

This repo is meant to demonstrate the automatic correlation of logs between two separate ASP.NET Core Web APIs which log to separate Application Insights instances.

It contains two very simple ASP.NET Core Web APIs, Api1 & Api2. The endpoint 'GET /api/values' on Api1 calls the same endpoint on Api2. Both APIs perform some custom logging.

The operation_Id in Application Insights is automatically preserved across the two Application Insights instances and so it's possible to execute a query that returns all relevant telemetry and logging for an operation:

union 
    requests, dependencies, traces, 
    app('AppInsightsApi2').requests, app('AppInsightsApi2').dependencies, app('AppInsightsApi2').traces 
| where operation_Id == '9804df6dcb4d3240a0ff8321face0533' 
| order by timestamp asc

The above query assumes it is executed in the Application Insights instance for Api1. It then references the Application Insights instance for Api2 using its resource name. This relies the resource name being unique among the resources you have access to. If this is not the case, more verbose methods of identifying the resource are available as can be seen here.

app-insights-correlation's People

Contributors

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