Spectron's observability story is built on SurrealDB's native capabilities. Because all state lives in SurrealDB, you can use live queries to stream real-time updates, build dashboards with direct database queries, and connect any BI tool that can speak to SurrealDB.
Live queries
SurrealDB's LIVE SELECT statement streams changes from any table in real time. This is useful for building real-time dashboards, monitoring ingestion queues, and watching memory state evolve.
Monitor document ingestion
Every status transition – queued → extracting → chunking → embedding → keywording → ready – triggers a live update. A failed document triggers an update with status = "failed" and the error field populated.
Monitor extraction activity
Monitor trace activity
Use this to watch which queries are hitting the cache versus falling through to retrieval, and to identify unexpectedly slow operations.
Operational dashboards
You can build dashboards by querying SurrealDB directly from any tool that supports SurrealDB as a data source, or by running scheduled queries via the Spectron REST API.
Key metrics to track
Ingestion pipeline health:
Memory growth rate:
Query resolution tier distribution:
A healthy deployment typically shows:
30–60%
direct(exact attribute match, very fast)10–20%
cache(semantic response cache hit)20–50%
hybrid(retrieval + synthesis)
Error rate:
Cache effectiveness
Low cache hit rates (<10%) in a production workload may indicate the cache TTL is too short or the similarity threshold too high.
SurrealDB Surrealist integration
Surrealist can connect to the SurrealDB instance backing your Spectron deployment. Once connected, you can:
Browse the Context's tables directly
Run ad-hoc SurrealQL queries
Inspect entity graphs visually
Monitor table record counts
Connect to the same SurrealDB instance and namespace/database as your Context:
Prometheus metrics
Spectron exposes Prometheus metrics at /metrics:
| Metric | Type | Description |
|---|---|---|
spectron_requests_total | Counter | Total HTTP requests, labelled by endpoint and status |
spectron_request_duration_seconds | Histogram | Request latency distribution |
spectron_llm_tokens_total | Counter | Total LLM tokens, labelled by context and stage |
spectron_extraction_turns_total | Counter | Total turns processed, labelled by context |
spectron_documents_queued | Gauge | Documents currently in the ingestion queue |
spectron_cache_hits_total | Counter | Semantic response cache hits |
spectron_cache_misses_total | Counter | Semantic response cache misses |
Use these metrics with Prometheus + Grafana for production dashboarding without direct SurrealDB access.
Alerting recommendations
Set up alerts for:
High ingestion error rate –
spectron_documents_queuedgrowing without a corresponding increase instatus = "ready"documentsToken budget approaching limit – alert at 80% of the monthly
token_limitLow cache hit rate – below 5% in production indicates a caching configuration issue
Slow operations – P99 latency above 5s for hybrid retrieval
Authentication errors – elevated
401/403response rates may indicate key rotation issues or misconfigured clients