Qyl.OpenTelemetry.SemanticConventions.SourceGeneration 3.0.1

dotnet add package Qyl.OpenTelemetry.SemanticConventions.SourceGeneration --version 3.0.1
                    
NuGet\Install-Package Qyl.OpenTelemetry.SemanticConventions.SourceGeneration -Version 3.0.1
                    
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.0.1">
  <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.0.1" />
                    
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.0.1
                    
#r "nuget: Qyl.OpenTelemetry.SemanticConventions.SourceGeneration, 3.0.1"
                    
#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.0.1
                    
#: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.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Qyl.OpenTelemetry.SemanticConventions.SourceGeneration&version=3.0.1
                    
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 in semconv v1.41.0 do not carry an 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 open-telemetry/semantic-conventions v1.41.0 (commit e018fe6f91862f5ed63c082f87697cddac596784), embedded via Weaver v0.23.0. The embedded registry is regenerated by scripts/generate.sh. The projection preserves the resolved group surface across attribute groups, spans, entities, metrics, and events, then exposes metric/event convenience arrays for the signal-specific emitters.

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.0.1 43 6/4/2026
3.0.0 91 5/25/2026
2.0.1 100 5/25/2026
2.0.0 113 5/23/2026