MonadicSharp.Telemetry 1.0.0

dotnet add package MonadicSharp.Telemetry --version 1.0.0
                    
NuGet\Install-Package MonadicSharp.Telemetry -Version 1.0.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="MonadicSharp.Telemetry" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MonadicSharp.Telemetry" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="MonadicSharp.Telemetry" />
                    
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 MonadicSharp.Telemetry --version 1.0.0
                    
#r "nuget: MonadicSharp.Telemetry, 1.0.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 MonadicSharp.Telemetry@1.0.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=MonadicSharp.Telemetry&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=MonadicSharp.Telemetry&version=1.0.0
                    
Install as a Cake Tool

MonadicSharp.Telemetry

OpenTelemetry tracing and metrics for AI agent pipelines — zero overhead when disabled.

NuGet .NET


Overview

MonadicSharp.Telemetry integrates agent pipelines with the OpenTelemetry ecosystem:

  • Distributed tracing — one Activity span per agent, one root span per pipeline
  • Metrics — execution count, latency histograms, failure rates via System.Diagnostics.Metrics
  • TelemetryAgentWrapper — transparent decorator that instruments any IAgent<TIn, TOut>
  • TelemetryAgentOrchestrator — instrumented orchestrator with per-dispatch spans
  • TelemetryPipelineExtensionsWithTelemetry() fluent extension for pipelines
  • Zero overhead when no listener is subscribed (standard .NET ActivitySource model)

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 38 3/3/2026

v1.0.0: Initial release — AgentMeter (latency histograms, execution counters), AgentActivitySource (distributed tracing), TelemetryAgentWrapper decorator, TelemetryAgentOrchestrator.