MonadicSharp.Telemetry
1.0.0
dotnet add package MonadicSharp.Telemetry --version 1.0.0
NuGet\Install-Package MonadicSharp.Telemetry -Version 1.0.0
<PackageReference Include="MonadicSharp.Telemetry" Version="1.0.0" />
<PackageVersion Include="MonadicSharp.Telemetry" Version="1.0.0" />
<PackageReference Include="MonadicSharp.Telemetry" />
paket add MonadicSharp.Telemetry --version 1.0.0
#r "nuget: MonadicSharp.Telemetry, 1.0.0"
#:package MonadicSharp.Telemetry@1.0.0
#addin nuget:?package=MonadicSharp.Telemetry&version=1.0.0
#tool nuget:?package=MonadicSharp.Telemetry&version=1.0.0
MonadicSharp.Telemetry
OpenTelemetry tracing and metrics for AI agent pipelines — zero overhead when disabled.
Overview
MonadicSharp.Telemetry integrates agent pipelines with the OpenTelemetry ecosystem:
- Distributed tracing — one
Activityspan per agent, one root span per pipeline - Metrics — execution count, latency histograms, failure rates via
System.Diagnostics.Metrics TelemetryAgentWrapper— transparent decorator that instruments anyIAgent<TIn, TOut>TelemetryAgentOrchestrator— instrumented orchestrator with per-dispatch spansTelemetryPipelineExtensions—WithTelemetry()fluent extension for pipelines- Zero overhead when no listener is subscribed (standard .NET
ActivitySourcemodel)
Installation
dotnet add package MonadicSharp.Telemetry
Setup
DI Registration
services.AddMonadicSharpTelemetry("MyApp");
Hook into your OpenTelemetry pipeline
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing
.AddSource(TelemetryConstants.ActivitySourceName) // "MonadicSharp.Agents"
.AddJaegerExporter()
.AddConsoleExporter())
.WithMetrics(metrics => metrics
.AddMeter(TelemetryConstants.MeterName) // "MonadicSharp.Agents"
.AddPrometheusExporter());
Tracing
Instrument a single agent
IAgent<string, string> tracedAgent = new TelemetryAgentWrapper<string, string>(
inner: summaryAgent,
activitySource: AgentActivitySource.Source);
Instrument a pipeline
var result = await AgentPipeline
.Start("DocumentProcessing", extractorAgent)
.Then(classifierAgent)
.WithTelemetry() // adds pipeline root span
.RunAsync(input, context);
Spans emitted
| Span name | Tags |
|---|---|
agent.execute |
agent.name, agent.status, session.id, error.type |
pipeline.run |
pipeline.name, pipeline.status, pipeline.steps.count, session.id |
Metrics
// Injected via DI
public class MyService(AgentMeter meter)
{
public async Task RunAsync(...)
{
meter.RecordExecution("SummaryAgent", success: true, durationMs: 120);
meter.RecordPipelineRun("DocumentProcessing", stepCount: 3, success: true);
}
}
Instruments registered
| Instrument | Type | Description |
|---|---|---|
agent.executions |
Counter | Total agent invocations |
agent.failures |
Counter | Total agent failures |
agent.duration_ms |
Histogram | Per-agent execution latency |
pipeline.runs |
Counter | Total pipeline executions |
pipeline.failures |
Counter | Total pipeline failures |
pipeline.duration_ms |
Histogram | End-to-end pipeline latency |
Telemetry Constants
TelemetryConstants.ActivitySourceName // "MonadicSharp.Agents"
TelemetryConstants.MeterName // "MonadicSharp.Agents"
TelemetryConstants.AttrAgentName // "agent.name"
TelemetryConstants.AttrPipelineName // "pipeline.name"
TelemetryConstants.AttrSessionId // "session.id"
TelemetryAgentOrchestrator
Drop-in replacement for AgentOrchestrator with automatic span wrapping:
var orchestrator = new TelemetryAgentOrchestrator(AgentActivitySource.Source);
orchestrator.Register("summary", summaryAgent);
// Each RunAsync call emits an "agent.execute" span
var result = await orchestrator.RunAsync("summary", input, context);
License
MIT — part of MonadicSharp.Framework.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.0)
- MonadicSharp (>= 1.4.0)
- MonadicSharp.Agents (>= 1.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MonadicSharp.Telemetry:
| Package | Downloads |
|---|---|
|
MonadicSharp.Framework
Meta-package for the MonadicSharp Framework — install this single package to get Agents, Caching, Http, Persistence, Security, and Telemetry in one shot. For à-la-carte usage, reference individual MonadicSharp.* packages instead. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 36 | 3/3/2026 |
v1.0.0: Initial release — AgentMeter (latency histograms, execution counters), AgentActivitySource (distributed tracing), TelemetryAgentWrapper decorator, TelemetryAgentOrchestrator.