Get current server statistics.
Record a connection state change.
Record an error.
Record a request (tool invocation).
Record an active session change.
Transport type ('http' or 'sse')
Change in session count (+1 for new, -1 for closed)
Reset all statistics. Useful for testing.
Wait for OTEL instrument initialization to complete.
Not required for normal operation — in-memory counters work immediately. Useful when the caller needs to ensure OTEL metrics are captured from the very first request (e.g. in integration tests).
Server Metrics Manager
Collects and exports metrics about server state and performance. Uses OpenTelemetry metrics API when available, falls back to in-memory tracking.