Giter Club home page Giter Club logo

microsoft / applicationinsights-dotnet-server Goto Github PK

View Code? Open in Web Editor NEW
131.0 82.0 67.0 75.54 MB

Microsoft Application Insights for .NET Web Applications

Home Page: https://azure.microsoft.com/services/application-insights/

C# 87.85% PowerShell 0.87% Batchfile 0.20% ASP 1.36% CSS 0.70% HTML 0.80% JavaScript 8.17% TSQL 0.04% Dockerfile 0.01%
application-insights sdk azure telemetry distributed-tracing monitoring observability asp asp-net performance-counters

applicationinsights-dotnet-server's Introduction

This repo is in the process of being migrated

Please pardon our progress... We are currently in the process of consolidating our github repos. See microsoft/ApplicationInsights-dotnet#1214

Build Status codecov.io

NuGet packages

Visual Studio Application Insights SDK for .NET Web Applications

The code in this repository is the .NET web application SDK for Application Insights. Application Insights is a service that lets you monitor your live application's performance and usage. This SDK sends telemetry to the service. It collects data such as web request timings and success rates, dependency calls, exceptions, and server performance counters. You can also use the SDK to send your own telemetry and add modules to collect logs. You can use this SDK in any .NET web application, hosted either on your own servers or on Microsoft Azure.

Get the SDK

The SDK is installed on each project by the Application Insights tools in Visual Studio (2013 and later).

To add Application Insights to your project in Visual Studio:

  • If you're creating a new project, check Add Application Insights in the New Project dialog.
  • If it's an existing project, right-click your project in Solution Explorer and select Add Application Insights or Update Application Insights.
  • If these options aren't available for your project type, use Extension Manager in Visual Studio to install or update the NuGet package. Create a new Application Insights resource in the Azure portal, obtain its instrumentation key, and insert that in ApplicationInsights.config.

Run your project, and then open your Application Insights resource in the Azure Preview Portal and look for events.

To upgrade to the latest SDK

  • After you upgrade, you'll need to merge back any customizations you made to ApplicationInsights.config. If you're unsure whether you customized it, create a new project, add Application Insights to it, and compare your .config file with the one in the new project. Make a note of any differences.
  • In Solution Explorer, right-click your project and choose Manage NuGet packages.
  • Set the filter to show Updates.
  • Select Microsoft.ApplicationInsights.Web and choose Update. (This will also upgrade all the dependent packages.)
  • Compare ApplicationInsights.config with the old copy. Most of the changes you'll see are because we removed some modules and made others parameterizable. Reinstate any customizations you made to the old file.
  • Rebuild your solution.

To build

Follow contributor's guide

Branches

  • master contains the latest published release located on NuGet.
  • develop contains the code for the next release.

Shared Projects

Our projects target multiple frameworks (ex: Net45 & NetCore). We have framework specific projects and a shared project for common files between them. (ex: Perf.Net45, Perf.NetCore, Perf.Shared). If a file is used by both frameworks, we prefer to store that file in a Shared project and use preprocessor directives to separate framework specific code (ex: #if NETCORE, #if !NETCORE). We also use a conditional ItemGroup to assign files to a framework (ex: ItemGroup Condition=" '$(TargetFramework)' != 'netcoreapp1.0' ").

We've found that this makes our projects easier to maintain because it keeps Framework assignments in a single project. As an added bonus our Framework specific projects can include a single Shared project instead of individual files, which keeps our project files neat and clean.

Contributing

We strongly welcome and encourage contributions to this project. Please read the contributor's guide. If making a large change we request that you open an issue first. If we agree that an issue is a bug, we'll add the "bug" label, and issues that we plan to fix are labeled with an iteration number. We follow the Git Flow approach to branching.

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-dotnet-server's People

Contributors

abaranch avatar anpete avatar brahmnes avatar cijothomas avatar d3r3kk avatar dmitry-matveev avatar dnduffy avatar expecho avatar iusafaro avatar kant avatar kartang avatar kstevenham avatar martincostello avatar michaelwstark avatar mikhail-msft avatar msftgits avatar netgh0st avatar nhart12 avatar nizarq avatar ohadschn avatar pharring avatar regexrowboat avatar sergeykanzhelev avatar shibayan avatar timothymothra avatar tokaplan avatar tommilos avatar vitalyf007 avatar xiaomi7732 avatar zakimaksyutov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

applicationinsights-dotnet-server's Issues

Default ApplicationInsights.config filters out most telemetry when using OWIN

When using OWIN with the default ApplicationInsights.config all telemetry sent from inside the OWIN pipeline seems to be filtered out (and never makes it up to AI). I am guessing it is because of the below default configuration when adding application insights to a project:

<TelemetryProcessors>
  ...
  <Add Type="Microsoft.ApplicationInsights.Web.HandlerTelemetryProcessor, Microsoft.AI.Web">
    <Handlers>
      ...
      <Add Value="System.Web.Handlers.TransferRequestHandler"/>
      ...
    </Handlers>
  </Add>
</TelemetryProcessors>

For example, the out-of-the-box request tracking (RequestTelemetry) gets filtered out, and any custom telemetry sent, too.

Azure Storage SDK "chunking" affects AI context tracking

If you e.g. upload a non-trivial blob in Azure (I think > 4mb), the Azure SDK chunks up the data into multiple requests of 4mb each.

In AI, the first "chunk" correctly shows as a dependency within the context of the request, but the remainder have no operation id (or parent operation id) so they appear as orphaned entries within AI. They should all have the correct operation id.

Copy of https://github.com/Microsoft/ApplicationInsights-Home/issues/38 from @isaacabraham

Implement QuickPulse feature that enables real-time monitoring of critical application data.

QuickPulse (aka ICU) feature enables real-time monitoring of critical application data. SDK will ping the QuickPulse service until it responds with a request to collect, at which point real-time data starts being collected and sent out to the service every second. As soon as the data is not being viewed any more, the service will signal SDK to stop collection and return to being idle.

Update/Re-install does not bring applicationinsights.config

Repros:

Scenario1: Create a new application, add 2.0.0 application insights, delete "AI.config" file, go to nuget manager and select "Update" that updates the ai version to 2.1.0, and the config file that is created is completely empty.
Scenario2: Create a new application, add 2.0.0 appilcatoin insights, uninstall the sdk and as a result the config file gets deleted, now install 2.1.0 and the same issue can be seen.

Azure Blob requests showing as failure in AI

I'm not entirely sure what I think that the solution should be for this one.

There are API calls in the .NET Azure SDK that (I believe) convert e.g. HTTP 404s to true / false e.g. blob.Exists(). The problem is that our code calls these API calls in many places and we're ending up with lots of false failures showing in AI simply because the dependency tracking module sees this as a 404 ergo it must be a failure.

We could add a filter for this but I think that you're going to find many other people in this (or similar) situation.

CommandName for tracking custom dependencies is not shown in the Metrics Explorer

When I use TelemetryClient.TrackDependency Method (String, String, DateTimeOffset, TimeSpan, Boolean) the CommandName parameter value is not shown in the Metrics Explorer in the Azure Portal.

A suggested workaround is to specify the DependencyTelemetry.DependencyTypeName property to be "SQL". This will get the CommandName value to be shown in the Dependency Property blade in the Azure Portal however it clutters the analytics if the type is not SQL.

Repro Steps:

  1. telemetryClient.Track("MyCustomDependency", "MyCommandName", startTime, duration, success);

Expected Result:

  • In the Dependency Property blade in the Azure Portal the Command value should be "MyCommandName"

Actual Result:

  • Command value is "MyCustomDependency".
    image
    image

More info here:
https://social.msdn.microsoft.com/Forums/en-US/ApplicationInsights/thread/f8e069c1-d72e-4c89-ba28-9cebf8571aff/

Failed dependency may be marked as successful

@abaranch found this code that extracts exception, but never uses it in the callback two lines below:

https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/1f9afda651266bbebd09cb900d4393b7aa704817/Src/DependencyCollector/Shared/Implementation/ProfilerSqlProcessing.cs#L186

         public object OnEndForSqlAsync(object context, object returnValue, object thisObj, object asyncResult) 
         { 
             // See implementation of EndExecuteXXX - before calling EndExecuteXXX it will check exception  
             // set by BeginXXX and throw it if it had failed 
             Exception exc = null; 
             if (asyncResult is Task) 
             { 
                 exc = ((Task)asyncResult).Exception; 
             } 


             this.OnEnd(context, null, thisObj, true); 
             return returnValue; 
         } 

Microsoft.AI.Agent.Intercept 2.0.1.0 not compatible dependency collector

if I update Microsoft.AI.Agent.Intercept 2.0.1.0
I always can not be collect dependency data
I debug in a ITelemetryInitializer I receive a exception

[msg=RemoteDependencyModule failed];[msg=System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AI.Agent.Intercept, Version=1.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

Race condition in test ThrowsInvalidOperationExceptionWhenTransmissionIsAlreadySending

The test ThrowsInvalidOperationExceptionWhenTransmissionIsAlreadySending has a race condition where the first call to SendAsync can return and run the finally Interlocked.Exchange to reset isSending before the second call to SendAsync gets CPU time to try the Interlocked.CompareExchange and throw the InvalidOperationException which is causing the test to fail sporadically.
I think this can be fixed by adding a little wrapper logic in the test to force the first thread to give up CPU time until the second has run into the error condition and thrown the expected exception.

Exceptions thrown when debugging

We are having issues with the Microsoft.ApplicationInsights.PerfCounterCollector package causing exceptions on our dev boxes. The first one is:

System.InvalidOperationException occurred
Message: Exception thrown: 'System.InvalidOperationException' in System.dll
Additional information: Category does not exist.

Then if we click continue in the debugger we get:

System.InvalidOperationException occurred
Message: Exception thrown: 'System.InvalidOperationException' in System.dll
Additional information: Category does not exist. 

Both of these exceptions are very annoying as they are the type of exception we don't want to have to disable for obvious reasons.

I have reproduced the problem very easily:

System Info:

OS Name Microsoft Windows 10 Pro
Version 10.0.10586 Build 10586
Visual Studio:
Microsoft Visual Studio Professional 2015
Version 14.0.25425.01 Update 3
Microsoft .NET Framework
Version 4.6.01038
Installed Version: Professional

Repro Steps:

  1. Create a Web MVC (including Web Api) project
  2. Via nuget install "Microsoft.ApplicationInsights.Web v2.1.0"
  3. Start debugging (F5)
  4. Wait for a minute or two.
  5. Results -> The two exceptions mentioned earlier

Multiple threads enumerating through a collection is intrinsically not a thread-safe procedure

In our project on .NET 4.5 (ASP.NET Web-application for hosting WCF-service) used references to these NuGet-packages:

  • Microsoft.ApplicationInsights 1.2.3
  • Microsoft.ApplicationInsights.Agent.Intercept 1.2.1
  • Microsoft.ApplicationInsights.DependencyCollector 1.2.3
  • Microsoft.ApplicationInsights.JavaScript 0.15.0-build58334
  • Microsoft.ApplicationInsights.PerfCounterCollector 1.2.3
  • Microsoft.ApplicationInsights.Web 1.2.3
  • Microsoft.ApplicationInsights.WindowsServer 1.2.3
  • Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel 1.2.3

We have rarely occurring issue, which lead to 100% CPU load.
When it happened again, we have made the process dump and used DebugDiag to find/diagnose the problem.

Here the result of the "Analysis report":

The following threads in w3wp.DMP are enumerating a System.Collections.Generic.Dictionary object:
Multiple threads enumerating through a collection is intrinsically not a thread-safe procedure. If the dictionary object accessed by these threads is declared as static then the threads can go in an infinite loop while trying to enumerate the dictionary if one of the threads writes to the dictionary while the other threads are reading\enumerating through the same dictionary. You may also experience High CPU during this stage. For more details refer to High CPU in .NET app using a static Generic.Dictionary
screenshot1

All threads have a same call stack:
System.Collections.Generic.Dictionary2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].FindEntry(System.__Canon)+1a6 System.Collections.Generic.Dictionary2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].TryGetValue(System.__Canon, System.__Canon ByRef)+14
Microsoft.ApplicationInsights.Extensibility.Implementation.LocationContext.get_Ip()+4f
Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer.UpdateRequestTelemetry(System.Web.HttpContext, Microsoft.ApplicationInsights.Extensibility.Implementation.LocationContext)+199
Microsoft.ApplicationInsights.Web.ClientIpHeaderTelemetryInitializer.OnInitializeTelemetry(System.Web.HttpContext, Microsoft.ApplicationInsights.DataContracts.RequestTelemetry, Microsoft.ApplicationInsights.Channel.ITelemetry)+86
Microsoft.ApplicationInsights.Web.Implementation.WebTelemetryInitializerBase.Initialize(Microsoft.ApplicationInsights.Channel.ITelemetry)+86
Microsoft.ApplicationInsights.TelemetryClient.Initialize(Microsoft.ApplicationInsights.Channel.ITelemetry)+26e
Microsoft.ApplicationInsights.TelemetryClient.Track(Microsoft.ApplicationInsights.Channel.ITelemetry)+28
FIE.Common.Web.Code.ApplicationInsights.ApplicationInsightsLogExceptionAttribute.System.ServiceModel.Dispatcher.IErrorHandler.HandleError(System.Exception)+9b
System.ServiceModel.Dispatcher.ErrorBehavior.HandleErrorCommon(System.Exception, System.ServiceModel.Dispatcher.ErrorHandlerFaultInfo ByRef)+a7
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessageCleanup(System.ServiceModel.Dispatcher.MessageRpc ByRef)+307
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage9(System.ServiceModel.Dispatcher.MessageRpc ByRef)+e2
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage8(System.ServiceModel.Dispatcher.MessageRpc ByRef)+ff
System.ServiceModel.Dispatcher.MessageRpc.ProcessError(System.Exception)+2c8
System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean)+169
[[HelperMethodFrame]]
System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(System.ServiceModel.Dispatcher.MessageRpc ByRef)+4e3
[[HelperMethodFrame]]
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(System.ServiceModel.Dispatcher.MessageRpc ByRef)+764
[[HelperMethodFrame]]
screenshot2

Change verbosity of message about counters not being collected under iisexpress

Currently this message is verbose: Performance counters are unavailable when the application is running under IIS Express. Use EnableIISExpressPerformanceCounters element with a value of 'true' within the Performance Collector Module element to override this behavior.
So this message will never be sent to the portal.
Proposal is to change it to error (so it is sent to the portal) with diagnostics keyword (for it is not sampled out)

Add synthetic traffic detection for Keynote

We currently support such user agent strings:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; KTXN) which is used for the real browser Transaction Perspective monitors.

Also we need to consider the below keynote traffic as well.
•"KHTE" (for Application Perspective monitors),
•"Keynote" for Test Perspective load testing agents.

RDDs are sent multiple times

Add telemetry initializer that prints to console:

    class ConsolePrintTelemetryInitializer : ITelemetryInitializer
    {
        public void Initialize(ITelemetry telemetry)
        {
            var bytes = JsonSerializer.Serialize(new ITelemetry[] { telemetry }, false);
            using (var stream = new MemoryStream(bytes))
            {
                using (var streamReader = new StreamReader(stream))
                {
                    Console.WriteLine(streamReader.ReadToEnd());
                }
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            GetVersionFromRegistry();
            TelemetryConfiguration.Active.TelemetryInitializers.Add(new ConsolePrintTelemetryInitializer());
            new DependencyTrackingTelemetryModule().Initialize(TelemetryConfiguration.Active);
            Test().Wait();
            Console.ReadLine();
        }

        static async Task Test()
        {
            var result = await new HttpClient().GetAsync("https://www.bing.com/search?q=httpclient");
            var response = await WebRequest.Create("https://www.bing.com/search?q=webrequest").GetResponseAsync();                 
        }
}

You will see that for every RDD call you get 2 calls to telemetry initializer. On .NET 4.5.2 it is even worse - you get 3 calls to telemetry initializer for httpclient RDD and 4 calls to telemetry initializer for webrequest RDD.

Unnessesary binding redirect for event source

Web SDK uses EventSource version 1.1.28
Dependency collector depends on Microsoft.ApplicationInsights.Agent.Intercept which uses EventSource version 1.1.24
We should update Intercept so there are no unnecessary binding redirects.

Set result code to a value indicating client error for HTTP dependencies

When an HTTP dependency is logged from the Web SDK, result code field is empty if a client error occurred, because .NET doesn't have a response to get status code from. We should somehow indicate that a client error occurred instead of just display "no name" in the UI for these dependencies.

Tracking async HTTP dependencies in ASP.NET

All of our async HTTP requests are reporting as taking microseconds to execute when they are actually taking 1-30 seconds.

var address = new Uri("http://foo.bar");
var content = new StringContent("{'foo': 'bar'");
content.Headers.ContentType = new MediaTypeWithQualityHeaderValue("application/json");
var response = await new HttpClient().PostAsync(address, content);

Non-async HTTP requests have accurate timings. This is on a server running IIS with the status monitor configured.

Copy of https://github.com/Microsoft/ApplicationInsights-Home/issues/27 from @gregjhogan. See more comments there

On .NET 4.5.2 successful HTTP dependencies are logged as failing

Try this example:

 static void Main(string[] args)
        {
            new DependencyTrackingTelemetryModule().Initialize(TelemetryConfiguration.Active);
            Test().Wait();
        }

        static async Task Test()
        {
            var result = await new HttpClient().GetAsync("https://www.bing.com/search?q=httpclient");
            var response = await WebRequest.Create("https://www.bing.com/search?q=webrequest").GetResponseAsync();                 
        }

These are dependencies that are getting logged on .NET 4.5.2. Note that we get nothing logged on 4.5 and 4.5.1 (probably expected) and on 4.6 everything is logged as expected

{"name":"Microsoft.ApplicationInsights.RemoteDependency","time":"2016-04-07T19:0
3:47.1438164Z","tags":{"ai.internal.sdkVersion":"rddf: 2.0.0.25000"},"data":{"ba
seType":"RemoteDependencyData","baseData":{"ver":2,"name":"https://www.bing.com/
search?q=httpclient","id":"R1YUAcsnqk8=","value":167.5677,"dependencyKind":1,"su
ccess":false}}}

{"name":"Microsoft.ApplicationInsights.RemoteDependency","time":"2016-04-07T19:0
3:47.7255489Z","tags":{"ai.internal.sdkVersion":"rddf: 2.0.0.25000"},"data":{"ba
seType":"RemoteDependencyData","baseData":{"ver":2,"name":"https://www.bing.com/
search?q=webrequest","id":"uGxqsnv1HTU=","value":487.8151,"dependencyKind":1,"su
ccess":false}}}

Application Insights Availability requests working badly with sampling

For Application Insights Availability we set User.Id as test location:

https://github.com/Microsoft/ApplicationInsights-server-dotnet/blob/bdcec347a1b9476db070dae71062ce0d524536f8/Src/Web/Web.Shared.Net/WebTestTelemetryInitializer.cs#L62

https://github.com/Microsoft/ApplicationInsights-server-dotnet/blob/bdcec347a1b9476db070dae71062ce0d524536f8/Src/Web/Web.Nuget/Resources/ApplicationInsights.config.install.xdt#L6

So we will have ALL telemetry IN or OUT from a single location.

Proposal:

  1. Do not use User/Session to correlate web tests - use RootID/ParentID, etc.
  2. Use test run-run-id as a RootID for sampling so we will have better sampling distribution for web test results

CC: @abaranch @vgorbenko

Embed Live Metrics Stream charts in other pages

It would be useful to be able to embed some or all of the Live Metrics Stream charts into another page, like a dashboard, so you don't have to dig into the Azure portal each time to pull up the Live Metrics Stream information. New Relic has this feature.

Web NuGet is removing a custom TelemetryProcessor if any are present.

Due to the second argument of XPath's contains expression not being quoted in Web NuGet transformation, it appears that XDT randomly removes the first TelemetryProcessor it encounters and the xdt:Locator filter is not being applied.

https://github.com/Microsoft/ApplicationInsights-server-dotnet/blob/aac44ef4cf526143d71683464e1c5a956cdeb5df/Src/Web/Web.Nuget/Resources/ApplicationInsights.config.install.xdt lines 50-52 currently in develop.

IndexOutOfRangeException from Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule

We are getting IndexOutOfRange exception from Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule. This happened after the our service ran for over 8 hours.

Call Stack:
[IndexOutOfRangeException: Index was outside the bounds of the array.]
System.Collections.Generic.List`1.Add(T item) +34
Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.PortalDiagnosticsQueueSender.Send(TraceEvent eventData) +11
Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsListener.WriteEvent(TraceEvent eventData) +90
Microsoft.ApplicationInsights.Extensibility.Implementation.Tracing.DiagnosticsListener.OnEventWritten(EventWrittenEventArgs eventSourceEvent) +134
Microsoft.Diagnostics.Tracing.EventSource.DispatchToAllListeners(Int32 eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs) +91

[EventSourceException: An error occurred when writing to a listener. ]
Microsoft.Diagnostics.Tracing.EventSource.DispatchToAllListeners(Int32 eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs) +201
Microsoft.Diagnostics.Tracing.EventSource.WriteToAllListeners(Int32 eventId, Guid* childActivityID, Object[] args) +206
Microsoft.Diagnostics.Tracing.EventSource.WriteToAllListeners(Int32 eventId, Guid* childActivityID, Int32 eventDataCount, EventData* data) +277
Microsoft.Diagnostics.Tracing.EventSource.WriteEventWithRelatedActivityIdCore(Int32 eventId, Guid* relatedActivityId, Int32 eventDataCount, EventData* data) +1245
Microsoft.Diagnostics.Tracing.EventSource.WriteEvent(Int32 eventId, String arg1, String arg2) +192
Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule..ctor() +211

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +113
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +232
System.Activator.CreateInstance(Type type, Boolean nonPublic) +83
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1122
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +128
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +18
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +60
System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +189
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +792
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +336
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +327

Our service details:
ASP.NET WebAPI and MVC application
.NET Framework: 4.5.1
Running as Web App in Azure
Application Insights version: 1.2.3

Sql Dependency error message

The Sql Dependency details are currently limited to a couple fields:

  • success
  • result code

Although the result code can help with troubleshooting issues, the full error message returned by the SQL server would be more useful, eg.

result code: 2601
vs.
error message: Cannot insert duplicate key row in object 'dbo.Products' with unique index 'UX_ProductSKU'. The duplicate key value is (Selenium SKU Min). The statement has been terminated.

Can the error message be added to the SQL dependency detail?

Getting the Operation Id from within a Web API call

When my Web API hits an exception and is about to return an HTTP 500, I'd like the response content to include the Session ID and Operation ID so users can report more actionable bugs. I read that AppInsights was setting that info in the OWIN environment, but I can't find it. Would you recommendations about how to retrieve those IDs?

NullReferenceException in RequestTrackingTelemetryModule.NeedProcessRequest

Issue reported by error telemetry:
weekly unique ikey count: 43
SDKs: 2.0.0.30671 | 2.1.0.1924 | dotnet: 2.1.0.14852 | w_2.0.0.30671

Error message:
AI (Internal): [msg=HanderFailure];[exception=System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule.NeedProcessRequest(HttpContext httpContext)
at Microsoft.ApplicationInsights.Web.RequestTrackingTelemetryModule.OnEndRequest(EventWrittenEventArgs args)
at Microsoft.ApplicationInsights.Web.Implementation.WebEventsSubscriber.OnEventWritten(EventWrittenEventArgs eventData)];

Support chunked request and response http dependency tracking

If response or request is chunked duration reflects time only from beginning of the request till first chunk received/posted.
Related issue: #58

Repro:
Create web app that is doing:

protected void Page_Load(object sender, EventArgs e)
        {
            HttpContext.Current.Response.BufferOutput = false;
            HttpContext.Current.Response.Write("Chunck 1");
            HttpContext.Current.Response.Flush();

            Thread.Sleep(10000);

            HttpContext.Current.Response.Write("Chunck 2");
}

Create an app that does a request to that app like this:

var address = new Uri("http://localhost/Component2/Default);
var response = await new HttpClient().GetAsync(address);

Tracked dependency duration will be much less than 10 seconds.

It is not related to having StatusMonitor but rather to instrumenting GetResponse that fires when headers are sent. We need to instrument some other functions that read response and sum together all the durations.

Missing SQL dependency information

Not sure what the logic is, or if async has anything to do with it, but (recently, I think) SQL dependencies have gone missing. They are indeed recorded as shown in the screenshot, but not linked to the request.

The ones marked with red arrows are missing.
image
I can't seem to find anything that correlates this data in the UI. Let me know if I can check somewhere else.

Edit: It seems in the 3 items marked, there is a bunch of missing info, eg Operation Id, USer Id, Session Id, etc.

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.