telemetry-dotnet-entityframework

Capture Entity Framework Core query spans with raw SQL via OpenTelemetry.

12|2|Updated May 4, 2020
One-click install
npx skills add https://github.com/hoangnh2412/jarvis --skill telemetry-dotnet-entityframework
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: telemetry-dotnet-entityframework
Source: https://github.com/hoangnh2412/jarvis/tree/main/.opencode/skills/telemetry-dotnet/providers/entityframework
Command: npx skills add https://github.com/hoangnh2412/jarvis --skill telemetry-dotnet-entityframework

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

When developing .NET applications with Entity Framework Core, the lack of built-in distributed tracing for database queries makes it difficult to diagnose slow data access operations, debug unexpected query behavior, and monitor database performance across microservices.

Core Features & Use Cases

  • OpenTelemetry EF Core Instrumentation: Automatically captures spans for all EF Core database queries, including raw SQL text and stored procedure executions.
  • Seamless Pipeline Integration: Works with existing OpenTelemetry tracing configurations without requiring separate OTEL environment variable sections, reusing the shared Tracing pipeline setup.
  • Use Case: A backend developer troubleshooting a slow API endpoint can use this skill to instantly view EF Core query execution times, statements, and database call details in their distributed trace to identify performance bottlenecks.

Quick Start

Use the telemetry-dotnet-entityframework skill to add EF Core query tracing to your .NET application's OpenTelemetry configuration.

Frequently Asked Questions about telemetry-dotnet-entityframework

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enable distributed tracing for Entity Framework Core queries in ASP.NET Core?

EF Core query tracing is enabled by integrating OpenTelemetry.Instrumentation.EntityFrameworkCore into your ASP.NET Core application. This automatically captures distributed trace spans for all database queries, including raw SQL text and stored procedure executions, using your existing tracing pipeline.

Can I capture raw SQL statements and stored procedures in my EF Core OpenTelemetry traces?

Yes, you can capture raw SQL statements and stored procedures in EF Core OpenTelemetry traces. The instrumentation automatically records the specific SQL text and execution details for each EF Core database query within the distributed trace spans.

Does EF Core query tracing require a separate OpenTelemetry configuration pipeline?

No, EF Core query tracing does not require a separate OpenTelemetry configuration pipeline. The instrumentation integrates seamlessly with your existing OpenTelemetry tracing setup, reusing the shared pipeline without needing additional OTEL environment variable sections.

What is the best way to debug slow EF Core database queries across microservices?

The best way to debug slow EF Core database queries across microservices is using distributed tracing. By capturing EF Core query execution times and SQL statements via OpenTelemetry, you can pinpoint performance bottlenecks in cross-service data access operations.

When do I need OpenTelemetry instrumentation for EF Core?

You need OpenTelemetry instrumentation for EF Core when monitoring database performance in distributed .NET applications. It is essential for diagnosing slow data access operations, debugging unexpected query behavior, and analyzing cross-service traces for EF Core-powered services.

Are there limitations to tracing EF Core queries with OpenTelemetry in .NET?

Tracing EF Core queries with OpenTelemetry focuses on capturing query execution spans and SQL text. It requires a backend service to visualize the traces, and while it highlights slow query performance, it does not automatically optimize poorly written LINQ queries.