Qyl.OpenTelemetry.SemanticConventions.SourceGeneration 3.4.0

dotnet add package Qyl.OpenTelemetry.SemanticConventions.SourceGeneration --version 3.4.0
                    
NuGet\Install-Package Qyl.OpenTelemetry.SemanticConventions.SourceGeneration -Version 3.4.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.OpenTelemetry.SemanticConventions.SourceGeneration" Version="3.4.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.OpenTelemetry.SemanticConventions.SourceGeneration" Version="3.4.0" />
                    
Directory.Packages.props
<PackageReference Include="Qyl.OpenTelemetry.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.OpenTelemetry.SemanticConventions.SourceGeneration --version 3.4.0
                    
#r "nuget: Qyl.OpenTelemetry.SemanticConventions.SourceGeneration, 3.4.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.OpenTelemetry.SemanticConventions.SourceGeneration@3.4.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.OpenTelemetry.SemanticConventions.SourceGeneration&version=3.4.0
                    
Install as a Cake Addin
#tool nuget:?package=Qyl.OpenTelemetry.SemanticConventions.SourceGeneration&version=3.4.0
                    
Install as a Cake Tool

Qyl.OpenTelemetry.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.

Use

using Qyl.OpenTelemetry.SemanticConventions.SourceGeneration;

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

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

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

[SemanticConventionIncubatingEvents("session")]
internal static partial class SessionEvents;

[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 readonly record struct SessionStartPayload { ... }
//   public static Histogram<double> CreateHttpServerRequestDurationHistogram(this Meter meter)
//   public static Activity SetHttpRoute(this Activity activity, string value)

Generator surfaces

All five 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.
Events SemanticConventionEvents, SemanticConventionIncubatingEvents RegistryLoader.Instruments EventsEmitter Event names, descriptors, and payload record structs.

The marker attributes are themselves generated via RegisterPostInitializationOutput; no runtime dependency is added by consuming this package. The events generator also emits SemanticConventionEvents.IsExternalInit.g.cs so generated record structs work on older target frameworks.

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.

Event rows do not currently carry a stable ActivityEvent-vs-Logger/Event discriminator. The generator emits event names and payload structs; the caller chooses the emission API at use-site. If upstream adds a discriminator later, the event emitter has a single routing point for that field.

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@c321d7eb4443ae1d1d88c2e24eda849f62049008 c321d7eb4443ae1d1d88c2e24eda849f62049008 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 Weaver v0.24.2. 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 strips the scopes that moved out of core in the 1.42 migration boundary (gen-ai, mcp, openai, and aws-bedrock) so those rows come only from the GenAI source.

The generated member shape is snapshot-tested per stability tier. Full-surface consumer smoke builds cover net472, netstandard2.0, net6.0, net8.0, net9.0, and net10.0.

Licensed under MIT (qyl); generated content is derived from OpenTelemetry semantic conventions, Apache-2.0.

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
3.4.0 0 7/11/2026
3.3.0 45 7/8/2026
3.2.0 45 7/7/2026
3.1.0 126 6/26/2026
3.0.2 106 6/24/2026
3.0.1 111 6/4/2026
3.0.0 110 5/25/2026
2.0.1 113 5/25/2026
2.0.0 132 5/23/2026