What Observability Covers
Observability in Fentaris is split across four surfaces:- structured logs from the proxy logger
- health checks for the proxy and upstream MCP servers
- profiler events for runtime, MCP, policy, transport, timeout, and error activity
- CLI diagnostics for validating local projects and runtime setup
Start With The High-Level Proxy
Configure observability where you declare the proxy. This keeps routing, policy, credentials, and telemetry in one place.autoLog: true enables automatic logs for proxied tool calls. Fentaris records stable metadata when it is available, including the operation, subject, upstream server, tool, proxied tool name, downstream transport, session id, credential source metadata, and policy outcome.
Request Context
Every middleware, route, and lifecycle event receives a context object with a request-scoped logger atctx.log. Use that logger to add stable tags and emit structured events.
traceId, subject, tenantId, server, and tool. Metadata is better for details that only belong to one event, such as durationMs, allowed, reason, or uri.
Manual Logs
Use explicit log entries when a business event matters more than the generic proxy lifecycle. Keep event names stable because they become query keys in log stores and dashboards.github.create_issue.completed with structured metadata instead of including the issue title or user input in the message.
Lifecycle Events
Lifecycle events are useful when you want to observe operations after Fentaris knows the result. They work well for latency logs, audit trails, and metrics aggregation.Health Checks
Use health checks to verify whether the proxy can reach the components it depends on. Server-scoped handles expose health methods through the high-level API.Profiler Events
The runtime profiler emits structured events for proxy lifecycle, MCP calls, policy decisions, transport errors, health checks, timeouts, extension errors, and profiler sink errors. Use it when you need focused runtime telemetry that is separate from application logs.Profiler Output
During development,pretty() writes human-readable profiler output. In production, attach a sink or handler that forwards events to your telemetry system.
A profiler handler should be small and reliable. If it sends data to a remote service, prefer buffering or a sink that isolates failures so observability code does not become part of the request path.
Logger Relationship
The logger is the request-level logging surface. It is available asctx.log, can be configured on fentaris({ logger }), and is the right place for audit-friendly application events.
Use the logger page when you need details about log levels, tags, metadata, redaction, custom drivers, and driver entry shape: Logger guide.
The profiler and logger can be used together. A common production setup is:
autoLog: truefor baseline request logsctx.log.setTag(...)in middleware for trace and tenant metadata- lifecycle hooks for audit events and latency
profiler()for focused runtime events, policy decisions, timeout tracking, and sink integration
CLI Diagnostics
Use CLI diagnostics before runtime debugging. They validate project configuration, local dependencies, and runtime setup.fentaris check --offline when you want project validation without network-dependent checks. Use fentaris doctor --runtime when the issue may be caused by the local environment, runtime dependencies, or startup configuration.
Production Checklist
For production proxies, keep the observability setup bounded and queryable:- enable
autoLog - set
traceId,subject, and tenant tags in middleware - log policy denies with stable reasons
- capture tool latency from lifecycle events or profiler events
- track transport errors and timeouts separately from application denials
- keep metric labels bounded
- forward structured logs to a system with retention and search
- avoid raw payloads and secrets in logs, profiler metadata, and metric labels