Capture consistent logs, metrics, and trace metadata for Fentaris proxy operations.Start with
autoLog, add stable tags in middleware, then forward structured entries to your telemetry pipeline when stdout is not enough.
Quick Start
Enable automatic proxy logging on the high-level proxy declaration.jsonConsoleLogger() as the proxy logger.
Add Contextual Metadata
Use middleware to attach correlation tags that should appear on every log entry for a request.traceId, tenantId, subject, and server. Avoid raw prompts, raw tool arguments, API keys, bearer tokens, and decrypted credentials.
Trace Tool Calls
Use server-scoped routes when you need custom logs for one upstream MCP server.Trace Resources And Prompts
Resource, prompt, and completion operations emit lifecycle events as well as tool calls.app.local(name) emit the same event families. The local namespace is reported as ctx.server?.name.
Use A Custom Driver
Pass a logger tofentaris(...) when stdout is not the right destination.
Recommended Signals
Track these signals for production operations:- Tool call counts by server, tool, subject, and policy outcome.
- Denied calls and denial reasons.
- Latency by server, tool, operation, and upstream transport.
- Session start, session close, and transport errors.
- Resource, prompt, and completion operations by target.
Metrics Aggregation
If you prefer metrics over logs, wrap the logger driver to emit counters and histograms while still writing structured logs.Metrics should use bounded labels. Do not use raw resource URIs, prompt text, or user input as high-cardinality metric labels.