Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

OpenTelemetry Integration

ReasonKit MCP (Pro) includes native support for OpenTelemetry (OTel), allowing you to observe reasoning performance and trace logical steps across your entire distributed system.


1. Configuration

To enable OTel, update your rk.toml or set environment variables.

Environment Variables

REASONKIT_OTEL_ENABLED=true
REASONKIT_OTEL_EXPORTER=otlp
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"

2. Traced Operations

ReasonKit emits spans for the following core operations:

Span NameLevelDescription
reasoning_sessionRootThe entire duration of a rk think call.
thinktool_stepInternalA single phase within a ThinkTool (e.g., gigathink.brainstorm).
llm_inferenceExternalThe duration and token usage of an external LLM API call.
vector_searchDatabaseLatency and recall metrics for RAG retrieval.

3. Metrics (Prometheus/OTel)

The following metrics are exported automatically:

  • reasonkit_logic_confidence: Histogram of confidence scores per module.
  • reasonkit_tokens_total: Counter of input/output tokens.
  • reasonkit_step_duration_ms: Histogram of step latencies.
  • reasonkit_error_count: Counter of RK-xxxx error codes.

4. Visualization Examples

Jaeger / Honeycomb

ReasonKit passes the traceparent header to underlying LLM providers (if supported), allowing for true end-to-end observability from the user request down to the individual token generation.

Datadog Integration

ReasonKit tags all traces with:

  • rk.profile: (e.g., deep)
  • rk.model: (e.g., gpt-4o)
  • rk.tenant_id: (Enterprise only)

5. Sample Trace Attributes

Every span includes rich metadata:

{
  "attributes": {
    "rk.module": "laserlogic",
    "rk.phase": "verify_claims",
    "rk.confidence": 0.94,
    "rk.token_count": 1240
  }
}