Telemetry
FabrCore includes comprehensive OpenTelemetry instrumentation across server and client packages for full observability of your AI agent systems.
OpenTelemetry Setup
builder.Services.AddOpenTelemetry()
.WithTracing(tracing => tracing
.AddSource("FabrCore.Sdk.*")
.AddSource("FabrCore.Host.*")
.AddSource("FabrCore.Client.*"))
.WithMetrics(metrics => metrics
.AddMeter("FabrCore.Sdk.*")
.AddMeter("FabrCore.Host.*")
.AddMeter("FabrCore.Client.*"));
Metrics
Server Metrics
WebSocket (FabrCore.Host.WebSocket)
| Metric | Type | Description |
fabrcore.websocket.connections.accepted | Counter | WebSocket connections accepted |
fabrcore.websocket.connections.rejected | Counter | WebSocket connections rejected |
fabrcore.websocket.sessions.created | Counter | WebSocket sessions created |
fabrcore.websocket.messages.received | Counter | Messages received via WebSocket |
fabrcore.websocket.messages.sent | Counter | Messages sent via WebSocket |
Agent Grain (FabrCore.Host.AgentGrain)
| Metric | Type | Description |
fabrcore.agent.configured | Counter | Agents configured |
fabrcore.agent.messages.processed | Counter | Messages processed |
fabrcore.agent.message.duration | Histogram | Message processing duration |
fabrcore.agent.errors | Counter | Errors by type |
SDK (FabrCore.Sdk.FabrCoreAgentProxy)
| Metric | Type | Description |
fabrcore.sdk.agent_proxy.initialized | Counter | Agents initialized |
fabrcore.sdk.agent_proxy.message.duration | Histogram | Message processing time |
fabrcore.sdk.agent_proxy.errors | Counter | Error count by type |
Client Metrics
Connection (FabrCore.Client.Connection)
| Metric | Type | Description |
fabrcore.client.connection.retries | Counter | Connection retry attempts |
fabrcore.client.connection.success | Counter | Successful connections |
fabrcore.client.connection.failures | Counter | Failed connections |
API Client (FabrCore.Client.FabrHostApiClient)
| Metric | Type | Description |
fabrcore.api_client.requests | Counter | API requests made |
fabrcore.api_client.errors | Counter | API errors |
fabrcore.api_client.request.duration | Histogram | API request duration |
Client Agent Proxy (FabrCore.Client.FabrCoreClientAgentProxy)
| Metric | Type | Description |
fabrcore.client.agent_proxy.initialized | Counter | Agent proxy initializations |
fabrcore.client.agent_proxy.messages.processed | Counter | Messages processed |
fabrcore.client.agent_proxy.message.duration | Histogram | Message processing time |
fabrcore.client.agent_proxy.errors | Counter | Agent proxy errors |
Distributed Tracing
Activity Sources
| Source | Operations |
FabrCore.Sdk.FabrCoreAgentProxy | Initialize, OnMessage, OnEvent, GetHealth, FlushState |
FabrCore.Sdk.FabrCoreChatClientService | GetChatClient, FetchModelConfig, FetchApiKey |
FabrCore.Client.ClientContext | Context operations |
FabrCore.Client.ClientContextFactory | Factory operations |
FabrCore.Client.DirectMessageSender | Direct messaging operations |
FabrCore.Client.FabrCoreClientAgentProxy | Agent proxy operations |
FabrCore.Client.Extensions | Client configuration and setup |
FabrCore.Client.Connection | Orleans connection lifecycle |
FabrCore.Client.FabrHostApiClient | HTTP API client operations |
Structured Logging
Use the built-in logger in your agents for structured logging that integrates with OpenTelemetry:
public override async Task<AgentMessage> OnMessage(AgentMessage message)
{
logger.LogInformation(
"Processing message from {FromHandle}",
message.FromHandle);
try
{
}
catch (Exception ex)
{
logger.LogError(ex,
"Error processing message {MessageId}",
message.Id);
throw;
}
}
Trace Correlation
FabrCore propagates TraceId across agent boundaries via the AgentMessage.TraceId property. This enables end-to-end distributed tracing across multi-agent workflows.
Use Microsoft.Extensions.AI's UseLogging() middleware to capture tool invocations, arguments, and results through the standard ILogger pipeline:
var chatClient = new ChatClientBuilder(innerClient)
.UseLogging(loggerFactory)
.Build();
This logs tool names, arguments, results, and duration through your existing logging infrastructure — no custom log aggregation agents needed. Combine with your observability stack (Application Insights, Seq, ELK, Grafana) for production monitoring.
Health Endpoints
FabrCore exposes diagnostics endpoints for monitoring. Combine these with ASP.NET Core health checks for Kubernetes probes and alerting:
| Endpoint | Returns |
GET /fabrcoreapi/diagnostics/agents | All registered agents with status |
GET /fabrcoreapi/diagnostics/agents/statistics | Total, active, deactivated counts |
GET /fabrcoreapi/discovery | Available agents, plugins, and tools |
GET /fabrapi/Agent/health/{handle} | Per-agent health (Basic, Detailed, Full) |
ASP.NET Core Health Check Integration
builder.Services.AddHealthChecks()
.AddCheck<FabrCoreAgentHealthCheck>("fabrcore-agents");
var app = builder.Build();
app.MapHealthChecks("/health");
This integrates with Kubernetes liveness/readiness probes, Azure App Service health checks, and standard monitoring infrastructure.