Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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 @@ -5,6 +5,9 @@
* Updated OpenTelemetry core component version(s) to `1.15.2`.
([#4080](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/4080))

* Add instrumentation schema URL to traces.
([#4078](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/4078))

## 1.15.0-beta.1

Released 2026-Jan-21
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Data;
using System.Diagnostics;
using System.Reflection;
using OpenTelemetry.Internal;
using OpenTelemetry.Trace;

Expand All @@ -18,12 +17,9 @@ internal sealed class EntityFrameworkDiagnosticListener : ListenerHandler
internal const string EntityFrameworkCoreCommandExecuted = "Microsoft.EntityFrameworkCore.Database.Command.CommandExecuted";
internal const string EntityFrameworkCoreCommandError = "Microsoft.EntityFrameworkCore.Database.Command.CommandError";

internal static readonly Assembly Assembly = typeof(EntityFrameworkDiagnosticListener).Assembly;
#pragma warning disable IDE0370 // Suppression is unnecessary
internal static readonly string ActivitySourceName = Assembly.GetName().Name!;
#pragma warning restore IDE0370 // Suppression is unnecessary
internal static readonly string ActivityName = ActivitySourceName + ".Execute";
internal static readonly ActivitySource EntityFrameworkActivitySource = new(ActivitySourceName, Assembly.GetPackageVersion());
internal static readonly Version SemanticConventionsVersion = new(1, 36, 0);
internal static readonly ActivitySource EntityFrameworkActivitySource = ActivitySourceFactory.Create<EntityFrameworkDiagnosticListener>(SemanticConventionsVersion);
internal static readonly string ActivityName = EntityFrameworkActivitySource.Name + ".Execute";

private readonly PropertyFetcher<object> commandFetcher = new("Command");
private readonly PropertyFetcher<object> connectionFetcher = new("Connection");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
</ItemGroup>

<ItemGroup>
<Compile Include="$(RepoRoot)\src\Shared\ActivitySourceFactory.cs" Link="Includes\ActivitySourceFactory.cs" />
<Compile Include="$(RepoRoot)\src\Shared\AssemblyVersionExtensions.cs" Link="Includes\AssemblyVersionExtensions.cs" />
<Compile Include="$(RepoRoot)\src\Shared\DatabaseSemanticConventionHelper.cs" Link="Includes\DatabaseSemanticConventionHelper.cs" />
<Compile Include="$(RepoRoot)\src\Shared\DiagnosticSourceListener.cs" Link="Includes\DiagnosticSourceListener.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static TracerProviderBuilder AddEntityFrameworkCoreInstrumentation(
return new EntityFrameworkInstrumentation(options);
});

builder.AddSource(EntityFrameworkDiagnosticListener.ActivitySourceName);
builder.AddSource(EntityFrameworkDiagnosticListener.EntityFrameworkActivitySource.Name);

return builder;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,11 @@ private static void VerifyActivityData(Activity activity, bool isError = false,
Assert.Equal(ActivityKind.Client, activity.Kind);
Assert.Equal("sqlite", activity.Tags.FirstOrDefault(t => t.Key == SemanticConventions.AttributeDbSystem).Value);

Assert.Equal("OpenTelemetry.Instrumentation.EntityFrameworkCore", activity.Source.Name);
Assert.NotNull(activity.Source.Version);
Assert.NotEmpty(activity.Source.Version);
Assert.StartsWith("https://opentelemetry.io/schemas/", activity.Source.TelemetrySchemaUrl);

// TBD: SqlLite not setting the DataSource so it doesn't get set.
Assert.DoesNotContain(activity.Tags, t => t.Key == "peer.service");
Assert.DoesNotContain(activity.Tags, t => t.Key == "server.address");
Expand Down
Loading