Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fad779b
use explicit event names
Aug 2, 2022
3b1b352
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Aug 2, 2022
0456e25
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Aug 2, 2022
29073af
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Aug 3, 2022
9584ba4
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Aug 4, 2022
ee0b869
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
Aug 22, 2022
96ef75a
Merge branch 'vibankwa/use-explicit-name-matching-for-diagnosticSourc…
Aug 22, 2022
e792394
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
Sep 14, 2022
f932df5
rmv skip from tests
Sep 14, 2022
e314518
updated benchmark numbers
Sep 15, 2022
f96f7ba
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Sep 15, 2022
406930c
ci run
Sep 15, 2022
b33c3ad
Merge branch 'vibankwa/use-explicit-name-matching-for-diagnosticSourc…
Sep 15, 2022
5e7db35
ci run
Sep 15, 2022
ad7929f
build fix
Sep 15, 2022
163a4e3
try build fix
Sep 15, 2022
969625e
run ci
Sep 15, 2022
ed0a8df
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Sep 15, 2022
0791329
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Sep 20, 2022
8720d1f
Merge branch 'main' into vibankwa/use-explicit-name-matching-for-diag…
vishweshbankwar Sep 21, 2022
8104fc3
add changelog
Sep 21, 2022
80d5b02
Merge branch 'vibankwa/use-explicit-name-matching-for-diagnosticSourc…
Sep 21, 2022
faa69db
update changelog
Sep 21, 2022
81134e3
nit
Sep 21, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// limitations under the License.
// </copyright>
using System;
using System.Collections.Generic;
using OpenTelemetry.Instrumentation.AspNetCore.Implementation;

namespace OpenTelemetry.Instrumentation.AspNetCore
Expand All @@ -23,11 +24,23 @@ namespace OpenTelemetry.Instrumentation.AspNetCore
/// </summary>
internal class AspNetCoreInstrumentation : IDisposable
{
private static readonly HashSet<string> DiagnosticSourceEvents = new()
{
"Microsoft.AspNetCore.Hosting.HttpRequestIn.Start",
"Microsoft.AspNetCore.Hosting.HttpRequestIn.Stop",
"Microsoft.AspNetCore.Mvc.BeforeAction",
"Microsoft.AspNetCore.Diagnostics.UnhandledException",
"Microsoft.AspNetCore.Hosting.UnhandledException",
};

private readonly Func<string, object, object, bool> isEnabled = (eventName, obj1, obj2)
=> DiagnosticSourceEvents.Contains(eventName);

private readonly DiagnosticSourceSubscriber diagnosticSourceSubscriber;

public AspNetCoreInstrumentation(HttpInListener httpInListener)
{
this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(httpInListener, null);
this.diagnosticSourceSubscriber = new DiagnosticSourceSubscriber(httpInListener, this.isEnabled);
this.diagnosticSourceSubscriber.Subscribe();
}

Expand Down
10 changes: 7 additions & 3 deletions src/OpenTelemetry.Instrumentation.AspNetCore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

## Unreleased

* Fix issue where when an application has an ExceptionFilter, the exception data
wouldn't be collected.
([#3475](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3475))
* Performance improvement (Reduced memory allocation) - Updated DiagnosticSource
event subscription to specific set of events.
([#3519](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3519))

* Added overloads which accept a name to the `TracerProviderBuilder`
`AddAspNetCoreInstrumentation` extension to allow for more fine-grained
options management
([#3661](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3661))

* Fix issue where when an application has an ExceptionFilter, the exception data
wouldn't be collected.
([#3475](https://github.com/open-telemetry/opentelemetry-dotnet/pull/3475))

## 1.0.0-rc9.6

Released 2022-Aug-18
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@
/*
// * Summary *
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22000
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.22621
Intel Core i7-8850H CPU 2.60GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET SDK=7.0.100-preview.6.22275.1
[Host] : .NET 6.0.8 (6.0.822.36306), X64 RyuJIT
[Host] : .NET 6.0.9 (6.0.922.41905), X64 RyuJIT
Job=InProcess Toolchain=InProcessEmitToolchain
| Method | Mean | Error | StdDev | Gen 0 | Allocated |
|-------------------------------------------- |---------:|--------:|--------:|-------:|----------:|
| UninstrumentedAspNetCoreApp | 155.6 us | 2.63 us | 2.33 us | 0.9766 | 5 KB |
| InstrumentedAspNetCoreAppWithDefaultOptions | 176.8 us | 3.24 us | 2.70 us | 1.2207 | 7 KB |
| UninstrumentedAspNetCoreApp | 164.7 us | 1.66 us | 1.39 us | 0.9766 | 5 KB |
| InstrumentedAspNetCoreAppWithDefaultOptions | 178.7 us | 2.65 us | 2.35 us | 0.9766 | 5 KB |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 ❤️

*/

namespace Benchmarks.Instrumentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ public async Task ShouldExportActivityWithOneOrMoreExceptionFilters(int mode)
AssertException(exportedItems);
}

[Fact(Skip = "Pending Changes https://github.com/open-telemetry/opentelemetry-dotnet/issues/3495")]
[Fact]
public async Task DiagnosticSourceCustomCallbacksAreReceivedOnlyForSubscribedEvents()
{
int numberOfCustomCallbacks = 0;
Expand Down Expand Up @@ -772,7 +772,7 @@ void ConfigureTestServices(IServiceCollection services)
Assert.Equal(1, numberOfExceptionCallbacks);
}

[Fact(Skip = "Pending Changes https://github.com/open-telemetry/opentelemetry-dotnet/issues/3495")]
[Fact]
public async Task DiagnosticSourceExceptionCallBackIsNotReceivedForExceptionsHandledInMiddleware()
{
int numberOfExceptionCallbacks = 0;
Expand Down Expand Up @@ -823,6 +823,8 @@ static void ThrowException(IApplicationBuilder app)
}

Assert.Equal(0, numberOfExceptionCallbacks);

await app.DisposeAsync();
}

public void Dispose()
Expand Down