elastic-otel-dotnet
CLAUDE.md32 starsChanged 8 months agoApache-2.0View on GitHub
Elastic Distribution of OpenTelemetry .NET (EDOT .NET) — an Elastic-sponsored distribution extending the OpenTelemetry SDK for .NET. Provides Elastic-specific processors, opinionated defaults, OTLP exporter, automatic instrumentation assembly scanning, and OpAmp (Open Agent Management Protocol) support for central configuration. The build system uses F# with Bullseye. Entry points are build.sh (Unix) and build.bat (Windows). Underlying dotnet commands for quick iteration: Required SDK: .NET 10.0.100 (see global.json) Source projects (src/): Key architectural pattern: Core, OpAmp, and OpAmp.Abstractions are source-linked into the main…
The file
We split this CLAUDE.md into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Run dotnet format before using the build (build.sh) commands.
- Distinctive: line 13
Run all tests after code changes to validate work.
- Distinctive: line 97
Test framework: xunit. On Linux, tests only run against net10.0 TFM.
- Very specific: line 102
C#: Always use var. Expression-bodied members preferred.
- Distinctive: line 107
All assemblies are strong-name signed
≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
Elastic Distribution of OpenTelemetry .NET (EDOT .NET) — an Elastic-sponsored distribution extending the OpenTelemetry SDK for .NET. Provides Elastic-specific processors, opinionated defaults, OTLP exporter, automatic instrumentation assembly scanning, and OpAmp (Open Agent Management Protocol) support for central configuration.
Always
- Run
dotnet formatbefore using the build (build.sh) commands. - Favour using the
build.shscript for building and testing during development. - Run all tests after code changes to validate work.
Build Commands
The build system uses F# with Bullseye. Entry points are build.sh (Unix) and build.bat (Windows).
# Full build (clean + format check + compile)
./build.sh build
# Compile only (no clean/format)
./build.sh compile
# Run all tests
./build.sh test
# Run specific test suites
./build.sh test --test-suite=unit
./build.sh test --test-suite=integration
./build.sh test --test-suite=build_verification
# Shorthand aliases for test suites
./build.sh unit-test
./build.sh integrate
./build.sh build-verify
# Full release build (build + redistribute zips + package)
./build.sh release
# Skip dirty working copy / format checks
./build.sh release -c
# Format code
./build.sh format
# Run a single target without dependencies
./build.sh <target> -sUnderlying dotnet commands for quick iteration:
dotnet build -c release
dotnet test -c release
dotnet test -c release --filter "FullyQualifiedName~SomeTestClass"
dotnet formatRequired SDK: .NET 10.0.100 (see global.json)
Architecture
Solution Structure (Elastic.OpenTelemetry.slnx)
Source projects (src/):
- Elastic.OpenTelemetry — Main NuGet package. Extensions for
HostApplicationBuilder,TracerProviderBuilder,MeterProviderBuilder,LoggerProviderBuilder. Targets netstandard2.0/2.1, net462, net8.0, net9.0. - Elastic.OpenTelemetry.Core — Core implementation (configuration, diagnostics/logging, builder state). Not a separate NuGet package — source-linked into the main package. Marked
IsSourceOnlyProject=true; skips compilation during solution builds because its.csfiles are compile-included into consuming projects. - Elastic.OpenTelemetry.OpAmp — OpAmp client implementation with ALC isolation on net8.0+. Source-linked for NuGet builds, separate DLL for zip distribution builds. Not source-only — produces assemblies for the redistributable (zip) packaging flow.
- Elastic.OpenTelemetry.OpAmp.Abstractions — Interfaces for OpAmp version isolation. Source-linked for NuGet builds. Not source-only — produces assemblies for the redistributable (zip) packaging flow.
- Elastic.OpenTelemetry.AutoInstrumentation — Profiler-based auto-instrumentation plugin. Targets net462, net8.0. Packaged as both NuGet and redistributable zip.
Key architectural pattern: Core, OpAmp, and OpAmp.Abstractions are source-linked into the main Elastic.OpenTelemetry package (not separate NuGet packages). They exist as separate projects for code organization but compile into one assembly for NuGet distribution. However, only Core is a source-only project — OpAmp and OpAmp.Abstractions also produce standalone assemblies for the zip distribution build (BuildingForZipDistribution=true) where they are loaded via AssemblyLoadContext isolation.
OpAmp Isolation Strategy
Two packaging strategies with different OpAmp compilation:
- NuGet package builds: OpAmp source compiled directly into AutoInstrumentation.dll
- Zip distribution builds (
redistributetarget): Separate OpAmp DLLs withAssemblyLoadContextisolation on net8.0+ to prevent version conflicts. Controlled byBuildingForZipDistributionMSBuild property andUSE_ISOLATED_OPAMP_CLIENTcompiler directive.
Build System Details
build/scripts/Targets.fs— Build targets and orchestrationbuild/scripts/Packaging.fs— Complex packaging logic for zip distributions (downloads OpenTelemetry official release, mutates zips to include EDOT plugins)build/scripts/BuildInformation.fs— Version informationbuild/scripts/CommandLine.fs— CLI argument definitions
Test Structure
tests/Elastic.OpenTelemetry.Tests/— Unit tests (net10.0)tests/Elastic.OpenTelemetry.BuildVerification.Tests/— Package verification tests (net10.0)tests/AutoInstrumentation.IntegrationTests/— Integration tests (net10.0)test-applications/— Test web apps (WebApi for .NET Framework, WebApiDotNet8, WebApiDotNet9)
Test framework: xunit. On Linux, tests only run against net10.0 TFM.
Code Style
- Indentation: Tabs for C#/VB; spaces for F#, JSON, YAML, csproj, md (2-space)
- C#: Always use
var. Expression-bodied members preferred. Allman brace style. Braces optional for single-line blocks. - Naming: Private fields
_camelCase, constantsPascalCase, locals/paramscamelCase - All warnings are errors (
TreatWarningsAsErrors) - ConfigureAwait: Enforced by analyzer — all
awaitcalls needConfigureAwait(false) - AOT/Trim analyzers: IL3050 and IL2026 are errors (except in AOT example project)
- All assemblies are strong-name signed
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

