Elven.Observability.Instrumentation.EntityFrameworkCore 0.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package Elven.Observability.Instrumentation.EntityFrameworkCore --version 0.1.2
                    
NuGet\Install-Package Elven.Observability.Instrumentation.EntityFrameworkCore -Version 0.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Elven.Observability.Instrumentation.EntityFrameworkCore" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Elven.Observability.Instrumentation.EntityFrameworkCore" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="Elven.Observability.Instrumentation.EntityFrameworkCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Elven.Observability.Instrumentation.EntityFrameworkCore --version 0.1.2
                    
#r "nuget: Elven.Observability.Instrumentation.EntityFrameworkCore, 0.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Elven.Observability.Instrumentation.EntityFrameworkCore@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Elven.Observability.Instrumentation.EntityFrameworkCore&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=Elven.Observability.Instrumentation.EntityFrameworkCore&version=0.1.2
                    
Install as a Cake Tool

Elven Observability .NET

Production-grade OpenTelemetry bootstrap for modern .NET services on the Elven Observability LGTM stack: Loki, Grafana, Tempo, and Mimir.

This distribution wraps the official OpenTelemetry .NET SDK and OpenTelemetry .NET AutoInstrumentation. It does not replace OpenTelemetry. Elven mode always configures traces, metrics, and logs.

Architecture

Applications send OTLP to a Collector deployed in the customer environment. The customer-side Collector then forwards telemetry to the Elven Observability backends.

.NET app
  -> OTLP gRPC or HTTP/protobuf
  -> customer-side OpenTelemetry Collector
  -> Elven Observability backend
  -> Tempo, Mimir, Loki, Grafana

The package default endpoint is http://localhost:4317, which is the common local/sidecar Collector endpoint. In production, set OTEL_EXPORTER_OTLP_ENDPOINT or ELVEN_OTLP_ENDPOINT to the customer Collector address.

Keep Elven backend credentials in the Collector, not in the application. In the recommended Collector path, the app only needs to know where the customer-side Collector is. The Collector is responsible for adding Authorization: Bearer ... and x-scope-orgid when forwarding to Elven Observability.

Start with the lowest-friction rollout path, then move down only when the service needs code-level customization.

Priority Path Use case
1 Docker zero-code Containerized services where no source change is desired.
2 Process zero-code VMs, systemd, or direct dotnet MyApp.dll deployments.
3 Programmatic hosting ASP.NET Core, Worker Services, and generic hosts that need code-level options.
4 No-host API Console apps, CLIs, and short-lived jobs.

Docker Zero-Code

FROM mcr.microsoft.com/dotnet/aspnet:10.0

COPY --from=elvenobservability/dotnet-instrumentation:latest /otel /otel

ENV CORECLR_ENABLE_PROFILING=1 \
    CORECLR_PROFILER={918728DD-259F-4A6A-AC2B-B85E1B658318} \
    CORECLR_PROFILER_PATH=/otel/current/OpenTelemetry.AutoInstrumentation.Native.so \
    DOTNET_ADDITIONAL_DEPS=/otel/AdditionalDeps \
    DOTNET_SHARED_STORE=/otel/store \
    DOTNET_STARTUP_HOOKS=/otel/net/OpenTelemetry.AutoInstrumentation.StartupHook.dll \
    OTEL_DOTNET_AUTO_HOME=/otel \
    OTEL_DOTNET_AUTO_PLUGINS="Elven.Observability.AutoInstrumentation.ElvenPlugin, Elven.Observability.AutoInstrumentation" \
    OTEL_TRACES_EXPORTER=otlp \
    OTEL_METRICS_EXPORTER=otlp \
    OTEL_LOGS_EXPORTER=otlp \
    OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
    OTEL_DOTNET_AUTO_SQLCLIENT_SET_DBSTATEMENT_FOR_TEXT=true \
    OTEL_DOTNET_AUTO_ENTITYFRAMEWORKCORE_SET_DBSTATEMENT_FOR_TEXT=true \
    OTEL_DOTNET_AUTO_ORACLEMDA_SET_DBSTATEMENT_FOR_TEXT=true

WORKDIR /app
COPY . /app
ENTRYPOINT ["dotnet", "/app/MyApp.dll"]

Runtime configuration:

docker run --rm \
  -e OTEL_SERVICE_NAME=billing-api \
  -e OTEL_SERVICE_VERSION=1.0.0 \
  -e ELVEN_SERVICE_NAMESPACE=payments \
  -e ELVEN_ENVIRONMENT=production \
  -e OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector.observability.svc.cluster.local:4317 \
  -e OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
  -e OTEL_TRACES_EXPORTER=otlp \
  -e OTEL_METRICS_EXPORTER=otlp \
  -e OTEL_LOGS_EXPORTER=otlp \
  my-app:latest

Database statements are collected by default when the underlying .NET instrumentation supports them. Elven redacts db.statement, db.query.text, and database query parameter attributes to [REDACTED] before export, while keeping safe attributes such as db.query.summary, db.operation.name, db.system.name, duration, status, and errors.

Process Zero-Code

./scripts/install.sh
. "$HOME/.otel-dotnet-auto/instrument.sh"

export OTEL_DOTNET_AUTO_PLUGINS="Elven.Observability.AutoInstrumentation.ElvenPlugin, Elven.Observability.AutoInstrumentation"
export OTEL_SERVICE_NAME=billing-api
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_TRACES_EXPORTER=otlp
export OTEL_METRICS_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp

dotnet Billing.Api.dll

Programmatic Setup

Install:

dotnet add package Elven.Observability

ASP.NET Core:

var builder = WebApplication.CreateBuilder(args);

builder.AddElvenObservability(options =>
{
    options.ServiceName = "billing-api";
    options.ServiceNamespace = "payments";
    options.Endpoint = new Uri("http://localhost:4317");
    options.SamplingRatio = 1.0;
});

var app = builder.Build();
app.UseElvenObservability();
app.MapElvenObservabilityHealthCheck();
app.Run();

Generic Host / Worker:

var builder = Host.CreateApplicationBuilder(args);
builder.AddElvenObservability();
await builder.Build().RunAsync();

Console / No Host:

await using var observability = ElvenObservability.Initialize(options =>
{
    options.ServiceName = "batch-job";
});

using var activity = ElvenTelemetry.ActivitySource.StartActivity("job.run");
ElvenTelemetry.Meter.CreateCounter<long>("jobs.started").Add(1);
observability.LoggerFactory.CreateLogger("Batch.Job").LogInformation("Job started.");
await observability.ForceFlushAsync();

Environment Variables

Elven supports standard OpenTelemetry variables plus Elven extensions.

Recommended app-to-Collector variables:

  • ELVEN_ENVIRONMENT: mapped to deployment.environment.name
  • ELVEN_REGION: mapped to elven.region
  • ELVEN_DEBUG: enables verbose internal diagnostics

Direct-to-Elven variables, only when the application exports straight to an Elven OTLP gateway instead of a customer-side Collector:

  • ELVEN_TENANT_ID: mapped to x-scope-orgid
  • ELVEN_API_KEY: mapped to Authorization: Bearer ...

When using the customer-side Collector, configure tenant and API key in the Collector exporter instead. If the application still needs tenant metadata as a resource attribute, prefer OTEL_RESOURCE_ATTRIBUTES=elven.tenant.id=... so the app does not emit backend authentication headers.

Core OpenTelemetry variables:

  • OTEL_SERVICE_NAME
  • OTEL_SERVICE_VERSION
  • OTEL_RESOURCE_ATTRIBUTES
  • OTEL_EXPORTER_OTLP_ENDPOINT
  • OTEL_EXPORTER_OTLP_PROTOCOL=grpc|http/protobuf
  • OTEL_EXPORTER_OTLP_HEADERS
  • OTEL_TRACES_SAMPLER
  • OTEL_TRACES_SAMPLER_ARG
  • OTEL_TRACES_EXPORTER=otlp
  • OTEL_METRICS_EXPORTER=otlp
  • OTEL_LOGS_EXPORTER=otlp

OTEL_TRACES_EXPORTER=none, OTEL_METRICS_EXPORTER=none, OTEL_LOGS_EXPORTER=none, and OTEL_TRACES_SAMPLER=always_off are rejected in Elven mode. Logs, metrics, and traces are always on.

Coverage

  • Traces: ASP.NET Core, HttpClient, gRPC client, SQL Client, EF Core, MongoDB source registration, RabbitMQ/Kafka/MassTransit source registration, AWS/Azure source registration, manual ActivitySource.
  • Metrics: runtime, process, ASP.NET Core/Kestrel, HttpClient, DNS/TLS/connection meters, Elven internal metrics, trace-based exemplars.
  • Logs: ILogger OTLP exporter, formatted message, scopes, state values, automatic trace/span correlation.
  • Resources: service namespace/version/instance, deployment.environment.name, host, container, Kubernetes, process/runtime, tenant, region.
  • Error mapping: cancellation, timeout, validation, auth, user input, HTTP 4xx/5xx, gRPC status codes, DNS, connection refused, network, DB/provider, startup misconfiguration, unhandled exceptions.

Development

dotnet restore
dotnet build Elven.Observability.sln -c Release
dotnet test tests/Elven.Observability.UnitTests/Elven.Observability.UnitTests.csproj -c Release
dotnet pack Elven.Observability.sln -c Release -o artifacts/packages

Native AOT:

dotnet publish samples/NativeAot.WebApi/NativeAot.WebApi.csproj -c Release -r linux-x64

Strict trimming:

dotnet publish samples/NativeAot.WebApi/NativeAot.WebApi.csproj -c Release -r linux-x64 -p:PublishAot=false -p:PublishTrimmed=true -p:SelfContained=true

The facade package is optimized for convenience and broad instrumentation coverage. For strict Native AOT or trim-clean services, compose the lean core/exporter packages as shown in the Native AOT sample and avoid optional instrumentation modules that are not trim-clean in the upstream OpenTelemetry ecosystem.

Build the auto-instrumentation layer:

docker buildx build \
  -f docker/auto-instrumentation/Dockerfile \
  --platform linux/amd64,linux/arm64 \
  -t elvenobservability/dotnet-instrumentation:latest .

Build the OpenTelemetry Operator init-container image:

docker buildx build \
  -f Dockerfile.operator \
  --platform linux/amd64,linux/arm64 \
  -t elvenobservability/dotnet-instrumentation-operator:latest .

Operator setup lives in k8s/otel-operator-instrumentation.yaml. The image follows the OTel Operator .NET contract by exposing /autoinstrumentation with linux-x64 and linux-musl-x64 payloads plus the Elven plugin in /autoinstrumentation/plugins.

Run the local LGTM stack and send the samples to it:

docker compose -f docker-compose.lgtm.yml up -d
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_SERVICE_NAME=elven-local-sample
dotnet run --project samples/AspNetCore.WebApi/AspNetCore.WebApi.csproj

Open Grafana at http://localhost:3000; the bundled LGTM image receives traces, metrics, and logs over OTLP on 4317 and 4318.

References

  • OpenTelemetry .NET SDK 1.15.3
  • OpenTelemetry .NET AutoInstrumentation 1.15.0
  • OpenTelemetry semantic conventions 1.41.0
  • .NET 8, .NET 9, and .NET 10
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Elven.Observability.Instrumentation.EntityFrameworkCore:

Package Downloads
Elven.Observability

Meta-package facade for Elven Observability .NET with always-on OpenTelemetry traces, metrics, logs, OTLP exporters, ASP.NET Core, generic host, and no-host initialization.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.13 82 8/17/2026
0.1.12 331 7/8/2026
0.1.11 104 7/7/2026
0.1.10 95 7/7/2026
0.1.9 94 7/6/2026
0.1.8 94 7/6/2026
0.1.7 93 7/6/2026
0.1.6 95 7/3/2026
0.1.5 88 7/2/2026
0.1.4 97 7/2/2026
0.1.3 85 7/2/2026
0.1.2 1,370 5/12/2026
0.1.1 108 5/11/2026
0.1.0 363 5/3/2026

Patch release enabling database statement capture by default with Elven redaction before export for code-based and zero-code instrumentation.