AxonPush.Otel
0.0.8
dotnet add package AxonPush.Otel --version 0.0.8
NuGet\Install-Package AxonPush.Otel -Version 0.0.8
<PackageReference Include="AxonPush.Otel" Version="0.0.8" />
<PackageVersion Include="AxonPush.Otel" Version="0.0.8" />
<PackageReference Include="AxonPush.Otel" />
paket add AxonPush.Otel --version 0.0.8
#r "nuget: AxonPush.Otel, 0.0.8"
#:package AxonPush.Otel@0.0.8
#addin nuget:?package=AxonPush.Otel&version=0.0.8
#tool nuget:?package=AxonPush.Otel&version=0.0.8
axonpush for .NET
axonpush ships three NuGet packages for .NET:
| Package | What it does |
|---|---|
AxonPush |
HTTP client for the AxonPush events API. |
AxonPush.Otel |
OpenTelemetry span exporter that maps Activity events to AxonPush. Reusable for any .NET OpenTelemetry workload. |
AxonPush.SemanticKernel |
One-call telemetry layer for Microsoft Semantic Kernel. Flips the GenAI diagnostic switch and wires the exporter for you. |
Targets net8.0 and above.
Workflow deployments
Install the core client with dotnet add package AxonPush --version 0.0.8.
Use a workspace-scoped API key and select the environment explicitly.
using AxonPush;
using var client = new AxonPushClient(new AxonPushOptions {
ApiKey = Environment.GetEnvironmentVariable("AXONPUSH_API_KEY")
});
var deployments = await client.Workflows.DeploymentsAsync("my-workspace", environment: "dev");
client.Workflows also exposes deployment preview and apply, simulation, facts,
cases and action operations. Simulation calls the hosted verifier. For offline
contract generation and fixture testing, use the TypeScript or Python SDK.
Business operations
The SDK provides typed workspace authoring, immutable revisions, pinned templates, metadata-only observation ingestion/receipts and exact activity queries. See the shared operations contract for schemas, access, privacy, lifecycle alerts and pilot verification. Capture content remains opt-in; source lifecycle adapters must apply their own allowlist before buffering.
Install
For a Semantic Kernel project:
dotnet add package AxonPush.SemanticKernel
For a generic OpenTelemetry project:
dotnet add package AxonPush.Otel
For raw publish access:
dotnet add package AxonPush
Quickstart: Semantic Kernel
using Microsoft.SemanticKernel;
using AxonPush.SemanticKernel;
var builder = Kernel.CreateBuilder();
builder.AddAzureOpenAIChatCompletion("gpt-4o-mini", endpoint, apiKey);
builder.AddAxonPushTelemetry(
client => { client.ApiKey = "ak_..."; client.TenantId = "..."; },
exporter => { exporter.ChannelId = "..."; exporter.Environment = "production"; });
var kernel = builder.Build();
That single AddAxonPushTelemetry call:
- Flips Semantic Kernel's GenAI diagnostic switch so the kernel emits OpenTelemetry spans for chat completions, function calls, and prompt rendering.
- Subscribes a
TracerProviderto everyMicrosoft.SemanticKernel.*activity source. - Attaches the axonpush span exporter, batched in the background.
Call AddAxonPushTelemetry(..., enableSensitiveData: true) to also forward prompts and completions as span events. The default is off so PII does not leave the process without an explicit opt-in.
Authentication
ApiKey accepts two ingest credentials. The client routes them to the right header by prefix:
| Credential | Header | Prefix | Use |
|---|---|---|---|
| API key | X-API-Key |
ak_ |
Server-side ingestion and management. Full resource access, scoped per key. |
| Public ingest token | X-Public-Token |
pt_ |
Browser and untrusted clients. Publish-only, safe to ship in a frontend. |
Standalone OpenTelemetry use
using OpenTelemetry;
using OpenTelemetry.Trace;
using AxonPush.Otel;
using var tracerProvider = Sdk.CreateTracerProviderBuilder()
.AddSource("MyApp")
.AddAxonPushExporter(
client => { client.ApiKey = "ak_..."; client.TenantId = "..."; },
exporter => { exporter.ChannelId = "..."; })
.Build();
The exporter is a plain BaseExporter<Activity>. AddAxonPushExporter wraps it in a BatchActivityExportProcessor with sensible defaults.
OpenTelemetry-native telemetry
AxonPush.Otel.Telemetry ships GenAI spans as real OTLP over HTTP to {BaseUrl}/v1/traces, routed by the X-Axonpush-Channel header and authed by X-API-Key. Spans follow the OpenTelemetry GenAI semantic conventions (gen_ai.*), so they are portable to any OTLP backend, not just AxonPush. This is the recommended way to send traces. It uses the standard OpenTelemetry.Exporter.OpenTelemetryProtocol exporter, batched and non-blocking.
Config resolves from the options callback, then the matching AXONPUSH_BASE_URL / AXONPUSH_API_KEY / AXONPUSH_CHANNEL_ID environment variable (or IConfiguration when you pass one).
When the app already owns a TracerProvider, reuse it with AddAxonPushTelemetry on the builder so the app keeps its own instrumentation and only gains the AxonPush exporter:
using OpenTelemetry;
using OpenTelemetry.Trace;
using AxonPush.Otel.Telemetry;
using var provider = Sdk.CreateTracerProviderBuilder()
.AddSource("axonpush")
.AddAxonPushTelemetry(out var handle, o =>
{
o.ServiceName = "my-agent";
o.Environment = "prod";
o.ServiceVersion = "1.4.0";
o.ContentCapture = ContentCaptureMode.MetadataOnly; // or Redacted / Full
})
.Build();
When the app does not already own a provider, ConfigureTelemetry builds a self-owned one and returns a TelemetryHandle for flushing and disposal:
using var handle = AxonPushTelemetry.ConfigureTelemetry(o =>
{
o.ServiceName = "my-agent";
o.Environment = "prod";
});
Wrap a model call in a GenAI span with the GenAi helpers. StartSpan opens a CLIENT activity on your ActivitySource (default source name "axonpush"):
using System.Diagnostics;
using AxonPush.Otel.Telemetry;
var source = new ActivitySource("axonpush");
using (var span = GenAi.StartSpan(source, operation: "chat", requestModel: "gpt-4o", system: "openai"))
{
// ... call the model ...
GenAi.RecordResponse(span,
responseModel: "gpt-4o",
inputTokens: 12,
outputTokens: 48,
cacheWriteTokens: 0);
GenAi.RecordContent(span, prompt: "…", completion: "…", handle: handle);
}
Prompt and completion land as span events (gen_ai.content.prompt / gen_ai.content.completion), gated by ContentCaptureMode: MetadataOnly drops content, Redacted keeps previews, Full keeps it. Secret-shaped keys are always stripped regardless of mode.
On serverless hosts (AWS Lambda and friends) the batch processor's exit flush is unreliable because the container is frozen between invocations. Call handle.Flush(timeoutMs) at the end of each invocation; handle.Dispose() flushes and tears down the provider when the handle owns it (it is a no-op when the app owns the provider via AddAxonPushTelemetry).
Which should I use
The OTel-native path above is the recommended way to send traces. The legacy per-framework event-model exporter (AxonPushSpanExporter / AddAxonPushExporter, which maps Activity events to /event payloads) still works and is kept for compatibility, but it is being superseded by OTel-native. Frame it as the compatibility path: keep it if you already depend on channel fan-out on the events plane, otherwise reach for AxonPush.Otel.Telemetry. Traces from both land in the same trace views (GET /traces); the server reconciles them through the OTLP normalizer, so you can migrate call sites incrementally without a gap in your traces.
Environment variables
AxonPushOptions.FromEnvironment (called internally) reads:
| Variable | Default | Notes |
|---|---|---|
AXONPUSH_API_KEY |
required | API key. |
AXONPUSH_TENANT_ID |
required | Tenant identifier. |
AXONPUSH_BASE_URL |
https://api.axonpush.xyz |
Override for self-hosted deployments. |
AXONPUSH_ENVIRONMENT |
(none) | Sent as the X-Axonpush-Environment header; must be within the API key's environment binding. |
AXONPUSH_TIMEOUT |
30 |
Total invocation timeout in seconds, including retries and response reading. |
AXONPUSH_MAX_RETRIES |
3 |
Additional attempts for eligible reads and writes with stable deduplication identities. Other mutations run once. |
AXONPUSH_FAIL_OPEN |
true |
When true, publish failures are logged and swallowed. |
Polly handles eligible retries within the invocation deadline. Caller cancellation is preserved. See transport behavior for retry safety and lifecycle details.
What spans you get from Semantic Kernel
With the GenAI switch enabled, Semantic Kernel emits spans on these activity sources:
Microsoft.SemanticKernelfor kernel function invocations.Microsoft.SemanticKernel.Connectors.OpenAIandMicrosoft.SemanticKernel.Connectors.AzureOpenAIfor chat completion calls.- Connector-specific sources for embeddings, image generation, and other AI services as they ship.
Spans carry the OpenTelemetry GenAI semantic-convention attributes: gen_ai.system, gen_ai.request.model, gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gen_ai.response.finish_reasons, and others. AxonPush applies its capture policy and presents these spans as evidence alongside Python LangChain or TypeScript LangGraph activity.
Sample app
See samples/SemanticKernelChat for an end-to-end console REPL with Azure OpenAI as the default backend and an inline GetTime kernel function for function-call spans.
The REST span exporter applies metadata-only redaction to existing span attributes by default, including namespaced message/prompt/tool-content keys. Set AxonPushSpanExporterOptions.ContentCapture explicitly only when a source policy permits broader capture. Resource model/token/tool metadata remains available.
Fail-open behaviour
By default the client treats AxonPush as a soft dependency. If a publish fails after retries, the exception is logged at warning level and the call returns a failed PublishResult without throwing. Set AxonPushOptions.FailOpen = false (or env AXONPUSH_FAIL_OPEN=false) to surface errors to the caller.
The OpenTelemetry exporter follows the same setting. When fail-open is on, Export returns ExportResult.Success even when individual spans could not be delivered, so the OpenTelemetry SDK never propagates the failure into user code.
Cross-source correlation
Span payloads emitted by AxonPush.Otel use the same JSON shape as the Python (axonpush) and TypeScript (@axonpush/sdk) exporters. A Semantic Kernel chat completion span shows up in the AxonPush UI with the same schema as a LangChain run from Python or a Vercel AI middleware trace from Node. Trace and span identifiers are preserved, so spans emitted by multiple SDKs against the same workflow correlate naturally.
License
MIT. See LICENSE.
Customer identity and request context
Identify profiles separately from request attribution. Use TypeScript withContext, Python with_context, or .NET BeginContext after authentication to link customer subjects to observations, diagnostic events and workflow cases. Capture context before queued jobs and restore it in the worker. Generated workflow publishing helpers accept the same scope; the deterministic verifier is unchanged.
See the customer attribution guide for sync/async examples, explicit business reference mappings, OpenTelemetry integration, background work and local validation.
| 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
- AxonPush (>= 0.0.8)
- Microsoft.Extensions.Configuration.Abstractions (>= 9.0.0)
- Microsoft.Extensions.Configuration.EnvironmentVariables (>= 9.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.2)
- Microsoft.Extensions.Options (>= 9.0.0)
- OpenTelemetry (>= 1.15.3)
- OpenTelemetry.Api (>= 1.15.3)
- OpenTelemetry.Exporter.OpenTelemetryProtocol (>= 1.15.3)
- Polly.Core (>= 8.9.0)
- System.Net.Http.Json (>= 9.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AxonPush.Otel:
| Package | Downloads |
|---|---|
|
AxonPush.SemanticKernel
AxonPush telemetry integration for Microsoft Semantic Kernel. |
GitHub repositories
This package is not used by any popular GitHub repositories.