opentelemetry-dotnet-contrib
AGENTS.md679 starsChanged 49 days agoApache-2.0View on GitHub
A monorepo of independently versioned community-maintained OpenTelemetry components for .NET: instrumentations, exporters, resource detectors, extensions, samplers, and more. Each component under src/ is its own NuGet package with its own version, changelog, and owners. Every src/ component must have: - CHANGELOG.md - updated on every release - README.md - installation and usage guide - .publicApi/PublicAPI.Shipped.txt and PublicAPI.Unshipped.txt - tracked by Microsoft.CodeAnalysis.PublicApiAnalyzers New public API surface must be declared in PublicAPI.Unshipped.txt. Adding a public member without updating this file causes a…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository3 other files it gives its agents.
- code-reviewSkill
- performance-benchmarkSkill
- semantic-conventions-upgradeSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
17 rules. About 0 are common, 2 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 63
Every src/ component must have:
- Very specific: line 97
Never manually set <Version> in a csproj.
- Very specific: line 101
All NuGet versions are centralized in Directory.Packages.props.
- Very specific: line 130
Create src/OpenTelemetry.{Type}.{Name}/ with .publicApi/, CHANGELOG.md, README.md, and a .csproj importing …
- Very specific: line 132
Create test/OpenTelemetry.{Type}.{Name}.Tests/ importing Common.nonprod.props.
- Very specific: line 133
Add both projects to opentelemetry-dotnet-contrib.slnx (hand-maintained).
- Very specific: line 134
Add the component path to .github/component_owners.yml.
- Very specific: line 135
Add path filters for the new component to .github/workflows/ci.yml.
- Very specific: line 139
Every behavioural change needs a CHANGELOG entry in the affected component's CHANGELOG.md under ## Unreleased.
- Distinctive: line 148
Do not add a new version header - that is added automatically during release.
- Distinctive: line 150
No CHANGELOG entry is needed for pure infrastructure changes (CI workflows, Renovate config, editor config).
- Very specific: line 152
When a PR touches multiple components, add an entry to each component's CHANGELOG.md.
- Very specific: line 160
Use OpenTelemetry.Api or OpenTelemetry.Api.ProviderBuilderExtensions when adding or editing existing code.
- Very specific: line 162
Do not add new references to OpenTelemetry (the SDK) wherever possible.
- Very specific: line 168
Use string.Equals(a, b, StringComparison) (static), not the instance method a.Equals(b, StringComparison).
- Very specific: line 175
Use <para/> as the paragraph break inside /// XML doc comments - not a blank line.
- Very specific: line 182
Use [Obsolete("...")] on a test method that exercises an obsolete API rather than suppressing the compiler warning with #pragma.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.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
OpenTelemetry .NET Contrib - Agent Instructions
What This Repo Is
A monorepo of independently versioned community-maintained OpenTelemetry
components for .NET: instrumentations, exporters, resource detectors, extensions,
samplers, and more. Each component under src/ is its own NuGet package with its
own version, changelog, and owners.
Build & Test Commands
# Build everything
dotnet build
# Run all tests (skip rebuild)
dotnet test --no-build
# Run tests for a single component
dotnet test test/OpenTelemetry.Instrumentation.AspNetCore.Tests/ --no-build
# Run a filtered subset of tests
dotnet test test/OpenTelemetry.Exporter.Geneva.Tests/ --no-build --filter "CategoryName=Geneva:user_events"
# Pack NuGet packages
dotnet pack --no-buildLinting:
markdownlint .
yamllint --no-warnings .
dotnet format --verify-no-changesRepository Layout
src/
OpenTelemetry.{Type}.{Name}/ # One directory per NuGet package
.publicApi/ # PublicAPI.Shipped.txt, PublicAPI.Unshipped.txt
CHANGELOG.md
README.md
*.csproj
test/
OpenTelemetry.{Type}.{Name}.Tests/
OpenTelemetry.{Type}.{Name}.Benchmarks/ # optional
Shared/ # Shared test helpers (linked via <Compile Include=...>)
src/Shared/ # Shared production helpers (linked via <Compile Include=...>)
build/
Common.props # Global build properties
Common.prod.props # Production package properties (MinVer, metadata)
Common.nonprod.props # Test/bench project properties
Projects/Component.proj # Template used by CI per component
Directory.Packages.props # Central Package Management - all versions hereComponent Conventions
Structure
Every src/ component must have:
CHANGELOG.md- updated on every releaseREADME.md- installation and usage guide.publicApi/PublicAPI.Shipped.txtandPublicAPI.Unshipped.txt- tracked byMicrosoft.CodeAnalysis.PublicApiAnalyzers
New public API surface must be declared in PublicAPI.Unshipped.txt. Adding a
public member without updating this file causes a build error.
Project File Patterns
<!-- Required in every src .csproj -->
<MinVerTagPrefix>Instrumentation.AspNetCore-</MinVerTagPrefix>
<PackageValidationBaselineVersion>1.15.1</PackageValidationBaselineVersion>
<!-- Shared source files are linked, not copied -->
<Compile Include="$(RepoRoot)\src\Shared\Guard.cs" Link="Shared\Guard.cs" />- Target frameworks for libraries:
$(TargetFrameworksForLibraries)- All supported .NET LTS versions plusnet462for Windows only. - Minimum .NET Framework:
net462 - LangVersion:
latest| Nullable:enable| ImplicitUsings:enable - StyleCop.Analyzers is a global package reference applied to all projects
TreatWarningsAsErrors=truein Release builds; code style is enforced at build time (EnforceCodeStyleInBuild=true)
Versioning
Versioning is fully automated via MinVer using Git tags. Tag format:
{Type}.{Name}-{SemVer} (e.g., Instrumentation.AspNetCore-1.15.1).
Never manually set <Version> in a csproj.
Package Management
All NuGet versions are centralized in Directory.Packages.props. Do not add
Version="..." attributes to <PackageReference> in individual project files;
add or update the version only in Directory.Packages.props.
Key version variables defined there:
$(OpenTelemetryCoreLatestVersion)- stable OTel SDK/API version$(OpenTelemetryCoreUnstableLatestVersion)- pre-release OTel SDK/API version
Shared Source
Code shared across components lives in src/Shared/ (production) or test/Shared/
(test). It is included in individual projects via <Compile Include="..." Link="..."/>,
not as a project reference. Do not add a project reference to a Shared project;
link individual files instead.
CI Behavior
The CI workflow (ci.yml) uses path-based change detection: only the component(s)
touched by a PR get built and tested. The reusable workflow Component.BuildTest.yml
runs a matrix across:
- OS: Windows, Ubuntu
- TFM: Each supported .NET version (e.g.
net10.0) andnet472(Windows only)
Component owners are defined in .github/component_owners.yml (not CODEOWNERS).
Adding a New Component
- Create
src/OpenTelemetry.{Type}.{Name}/with.publicApi/,CHANGELOG.md,README.md, and a.csprojimporting$(RepoRoot)/build/Common.prod.props. - Create
test/OpenTelemetry.{Type}.{Name}.Tests/importingCommon.nonprod.props. - Add both projects to
opentelemetry-dotnet-contrib.slnx(hand-maintained). - Add the component path to
.github/component_owners.yml. - Add path filters for the new component to
.github/workflows/ci.yml.
CHANGELOG Entries
Every behavioural change needs a CHANGELOG entry in the affected component's
CHANGELOG.md under ## Unreleased. Format:
* Description of the change (sentence case, ends with a period).
([#NNNN](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/NNNN))- New entries go at the end of
## Unreleased, not the top. - Do not add a new version header - that is added automatically during release.
- No CHANGELOG entry is needed for pure infrastructure changes (CI workflows, Renovate config, editor config).
- When a PR touches multiple components, add an entry to each component's
CHANGELOG.md.
NuGet References in Source Projects
Instrumentation src/ projects must reference only the minimal OpenTelemetry
packages needed:
- Use
OpenTelemetry.ApiorOpenTelemetry.Api.ProviderBuilderExtensionswhen adding or editing existing code. - Do not add new references to
OpenTelemetry(the SDK) wherever possible.
Code Conventions
Banned APIs (enforced by build/BannedSymbols.txt)
- Use
string.Equals(a, b, StringComparison)(static), not the instance methoda.Equals(b, StringComparison). - All
TryParseoverloads on numeric/date types must passCultureInfo.InvariantCulture.
XML Documentation
- Use
<para/>as the paragraph break inside///XML doc comments - not a blank line. - For property setters, the
paramNamein anyArgumentExceptionshould benameof(value), not the property name.
Tests
- Use
[Obsolete("...")]on a test method that exercises an obsolete API rather than suppressing the compiler warning with#pragma.
Code Review Instructions
See REVIEW.md for guidance used by automated code review
agents when reviewing pull requests in this repository.
Pull requests
- Pull request descriptions must follow the pull request template.
Pull request descriptions authored by an agent must disclose which agent was used to create the pull request. Add a note at the bottom of the description, for example:
> [!NOTE] > This PR description was generated with GitHub Copilot.- The same applies to PR reviews, PR comments and issue comments posted by an agent under a user's own account, rather than a dedicated bot account or app.
- Replies to pull requests, comments, and issues must be made by the end-user themselves, not autonomously by an agent.
Skills
Agent skills for common tasks in this repository are in .github/skills:
code-review- review a pull request or code change against this repository's conventions.performance-benchmark- write and run BenchmarkDotNet benchmarks to validate the performance impact of a change.semantic-conventions-upgrade- upgrade the semantic conventions version a component targets, or bump
the generated
OpenTelemetry.SemanticConventionspackage.
- upgrade the semantic conventions version a component targets, or bump
the generated
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.

