Sparkdo.Instrumentation.Compiler 2.0.0-preview.2

This is a prerelease version of Sparkdo.Instrumentation.Compiler.
dotnet add package Sparkdo.Instrumentation.Compiler --version 2.0.0-preview.2
                    
NuGet\Install-Package Sparkdo.Instrumentation.Compiler -Version 2.0.0-preview.2
                    
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="Sparkdo.Instrumentation.Compiler" Version="2.0.0-preview.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sparkdo.Instrumentation.Compiler" Version="2.0.0-preview.2" />
                    
Directory.Packages.props
<PackageReference Include="Sparkdo.Instrumentation.Compiler" />
                    
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 Sparkdo.Instrumentation.Compiler --version 2.0.0-preview.2
                    
#r "nuget: Sparkdo.Instrumentation.Compiler, 2.0.0-preview.2"
                    
#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 Sparkdo.Instrumentation.Compiler@2.0.0-preview.2
                    
#: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=Sparkdo.Instrumentation.Compiler&version=2.0.0-preview.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Sparkdo.Instrumentation.Compiler&version=2.0.0-preview.2&prerelease
                    
Install as a Cake Tool

Sparkdo.Instrumentation.Compiler

Sparkdo.Instrumentation.Compiler 是 instrumentation 的 Roslyn analyzer/source generator 包。

职责

  • 发现可静态证明的 SparkdoInstrumentationDescriptor 定义。
  • 为 operation 生成 telemetry 常量和调用 IRuntimeInstrumentationHook 的 bridge。
  • 在 Application role 下生成 SparkdoInstrumentationBootstrapContribution;Package role 不生成该贡献。
  • 对无法静态证明的 descriptor fail closed,并报告 generator diagnostic。

非职责

  • 不创建 runtime sink、ActivitySource、Meter 或 recorder。
  • 不执行 Manifest 合并、Hosting 启动或 OpenTelemetry 配置。
  • 不扫描 reference assembly,也不通过反射发现 runtime 类型。

关键入口

API / artifact 用途
SparkdoInstrumentationGenerator incremental source generator 入口。
InstrumentationDiscovery 解析 descriptor 语法与语义。
InstrumentationSourceEmitter 生成 operation telemetry bridge。
SparkdoInstrumentationBootstrapContribution.g.cs Application bootstrap 贡献。

依赖

项目面向 netstandard2.0,编译期私有依赖 Microsoft.CodeAnalysis.CSharp、Sparkdo.Instrumentation.Abstractions 和 Sparkdo.Runtime。NuGet 包只把编译器 DLL 放入 analyzers/dotnet/cs。

集成

应用通常引用 Sparkdo.Instrumentation,由运行时包携带本 analyzer。编译器测试应通过 Sparkdo.SourceGenerationTesting.SourceGenerationSpec 提供源码、reference、SparkdoManifestRole 和 generator,再验证 artifact、diagnostic、generated compilation 与 determinism。

验证

dotnet test src/instrumentation/test/Sparkdo.Instrumentation.Compiler.Tests/Sparkdo.Instrumentation.Compiler.Tests.csproj --no-restore -p:UseSharedCompilation=false -nr:false
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

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
2.0.0-preview.2 80 7/20/2026
2.0.0-preview.1 64 7/18/2026