Qyl.Telemetry.SemanticConventions.SourceGeneration 4.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Qyl.Telemetry.SemanticConventions.SourceGeneration --version 4.1.0
                    
NuGet\Install-Package Qyl.Telemetry.SemanticConventions.SourceGeneration -Version 4.1.0
                    
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="Qyl.Telemetry.SemanticConventions.SourceGeneration" Version="4.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Qyl.Telemetry.SemanticConventions.SourceGeneration" Version="4.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Qyl.Telemetry.SemanticConventions.SourceGeneration">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 Qyl.Telemetry.SemanticConventions.SourceGeneration --version 4.1.0
                    
#r "nuget: Qyl.Telemetry.SemanticConventions.SourceGeneration, 4.1.0"
                    
#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 Qyl.Telemetry.SemanticConventions.SourceGeneration@4.1.0
                    
#: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=Qyl.Telemetry.SemanticConventions.SourceGeneration&version=4.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Qyl.Telemetry.SemanticConventions.SourceGeneration&version=4.1.0
                    
Install as a Cake Tool

Qyl.Telemetry.SemanticConventions.SourceGeneration

Roslyn source generator for OpenTelemetry semantic-convention constants, descriptors, and thin helper APIs. It does not collect telemetry. Consumers own their Meter, ActivitySource, Logger, instrumentation scope, versioning, and enablement.

When to use this package

This is the application-side consumption mode: the generator emits only the declared groups into your own assembly — internal visibility, no runtime package dependency, tree-shaken by construction. Libraries that need one pinned registry version across a package family (for example Qyl.OpenTelemetry.AutoInstrumentation) reference the compiled Qyl.Telemetry.SemanticConventions packages instead and alias their constants; see the repository README's "Choosing between the compiled packages and the source generator" section.

Use

using Qyl.Telemetry.SemanticConventions.SourceGeneration;

[SemanticConventionAttributes("http")]
internal static partial class HttpAttributes;

[SemanticConventionIncubatingAttributes("http")]
internal static partial class HttpIncubatingAttributes;

[SemanticConventionMetrics("http.server")]
internal static partial class HttpServerMetrics;

[SemanticConventionMeters("http.server")]
internal static partial class HttpServerMeters;

[SemanticConventionActivities("http")]
internal static partial class HttpActivityExtensions;

// Generated:
//   public const string AttributeHttpRequestMethod = "http.request.method";
//   public static partial class HttpServerRequestDurationDescriptor { ... }
//   public static Histogram<double> CreateHttpServerRequestDurationHistogram(this Meter meter)
//   public static Activity SetHttpRoute(this Activity activity, string value)

Generator surfaces

All four source generators use the same Roslyn shape: publish stable and incubating marker attributes during post-initialization, discover annotated partial classes with ForAttributeWithMetadataName, extract the requested semantic-convention prefix into a marker model, then emit source from the matching registry projection.

Surface Marker attributes Registry projection Emitter Generated shape
Attributes SemanticConventionAttributes, SemanticConventionIncubatingAttributes RegistryLoader.Registry AttributesEmitter Attribute-key constants and typed enum-value helpers.
Activities SemanticConventionActivities, SemanticConventionIncubatingActivities ActivityRegistryLoader.Registry ActivityExtensionsEmitter Activity extension methods that set typed semantic tags.
Metrics SemanticConventionMetrics, SemanticConventionIncubatingMetrics RegistryLoader.Instruments MetricsEmitter Metric names, descriptors, units, instrument kinds, and attribute keys.
Meters SemanticConventionMeters, SemanticConventionIncubatingMeters RegistryLoader.Instruments MetersEmitter Meter extension methods that create semantic instruments.

The marker attributes are themselves generated via RegisterPostInitializationOutput; no runtime dependency is added by consuming this package.

Stable markers emit stable rows plus deprecated migration symbols. Incubating markers are supersets: stable + development/alpha/beta/release-candidate + deprecated. This mirrors Java/Python's incubating package behavior and avoids breaking consumers when conventions are promoted.

Choose one projection per prefix in normal consumer code. Incubating is a superset, so declaring both stable and incubating meter/activity helpers for the same prefix in the same namespace can make shared extension methods ambiguous. If a test fixture intentionally declares both, call the generated static helper class explicitly.

Versioning

Tracks two source registries:

Source Ref Commit Schema URL
Core semantic conventions open-telemetry/semantic-conventions@v1.43.0 89aae438b3b3b0a8dd33003c9d70592baf7dbd0d https://opentelemetry.io/schemas/1.43.0
GenAI semantic conventions open-telemetry/semantic-conventions-genai@33b7f9da9ade6162d4a5c16247d0bc6ad5f8b469 33b7f9da9ade6162d4a5c16247d0bc6ad5f8b469 https://opentelemetry.io/schemas/gen-ai-dev/1.42.0-dev

The GenAI registry is development-stage. It is pinned by commit SHA and must not be presented as a stable v1.42.0 release.

The embedded registry is regenerated by scripts/generate.sh with the Weaver version pinned in Version.props; generation fails on a different binary. The script runs Weaver twice, once for core and once for GenAI, then merges the qyl-owned projections while preserving per-row source metadata. The core run excludes gen-ai, mcp, openai, and aws-bedrock, so those rows come only from the GenAI source.

The merge also fingerprints every effective model file, preserves both manifests, and embeds every referenced GenAI JSON Schema. Two generated consumers share that same projection:

  • emit_registry_resources.py publishes the complete resolved registry and raw structured-payload schemas through the incubating package.
  • emit_analyzer_registry.py derives attribute types, enum spellings, GenAI/MCP span requirements, provider refinements, and metric names for the analyzer project.

Both scripts support --check; normal repository builds and CI fail when their committed outputs drift from resolved-registry.json.

The generated member shape is snapshot-tested per stability tier on the repository's net10.0 test host. The release gate also restores the packed source generator into a clean net10.0 consumer, compiles generated members, and executes the result.

Licensed under Apache-2.0. Generated content is derived from the Apache-2.0 OpenTelemetry semantic-conventions registries.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
8.1.0 97 9/4/2026
8.0.1 100 9/4/2026
8.0.0 137 9/3/2026
7.1.1 134 9/2/2026
7.1.0 99 9/2/2026
7.0.0 142 9/2/2026
6.0.0 160 8/28/2026
5.2.0 136 8/22/2026
5.1.0 108 8/22/2026
5.0.0 101 8/21/2026
4.5.0 102 8/21/2026
4.4.0 428 8/21/2026
4.3.0 161 8/20/2026
4.2.0 169 8/14/2026
4.1.0 116 8/1/2026
1.0.0 431 7/27/2026