Skip to content

Commit

Permalink
[Instrumentation.EntityFrameworkCore] Update EntityFrameworkCore Acti…
Browse files Browse the repository at this point in the history
…vitySource name (#486)
  • Loading branch information
utpilla authored Jul 6, 2022
1 parent ba24a94 commit d6d951c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
* Updated OTel SDK package version to 1.2.0
[#347](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/347)

* Update the `ActivitySource` name used to the assembly name:
`OpenTelemetry.Instrumentation.StackExchangeRedis`
[#486](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/486)

## 1.0.0-beta.3

* Going forward the NuGet package will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ internal sealed class EntityFrameworkDiagnosticListener : ListenerHandler
{
internal const string DiagnosticSourceName = "Microsoft.EntityFrameworkCore";

internal const string ActivitySourceName = "OpenTelemetry.EntityFrameworkCore";
internal const string ActivityName = ActivitySourceName + ".Execute";

internal const string EntityFrameworkCoreCommandCreated = "Microsoft.EntityFrameworkCore.Database.Command.CommandCreated";
internal const string EntityFrameworkCoreCommandExecuting = "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuting";
internal const string EntityFrameworkCoreCommandExecuted = "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted";
Expand All @@ -38,6 +35,9 @@ internal sealed class EntityFrameworkDiagnosticListener : ListenerHandler
internal const string AttributeDbName = "db.name";
internal const string AttributeDbStatement = "db.statement";

internal static readonly string ActivitySourceName = typeof(EntityFrameworkDiagnosticListener).Assembly.GetName().Name;
internal static readonly string ActivityName = ActivitySourceName + ".Execute";

private static readonly Version Version = typeof(EntityFrameworkDiagnosticListener).Assembly.GetName().Version;
#pragma warning disable SA1202 // Elements should be ordered by access <- In this case, Version MUST come before SqlClientActivitySource otherwise null ref exception is thrown.
internal static readonly ActivitySource SqlClientActivitySource = new ActivitySource(ActivitySourceName, Version.ToString());
Expand Down

0 comments on commit d6d951c

Please sign in to comment.