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.
Surrealist (SurrealDB Cloud UI)
Surrealist is the SurrealDB Cloud dashboard. For Spectron on Cloud, use Surrealist to create contexts, manage Spectron billing, and mint API keys — see Surrealist dashboard quickstart. That is separate from this operator-focused observability page.
For self-hosted deployments, Surrealist can also connect to the raw SurrealDB instance behind Spectron (advanced debugging — not the Spectron product UI):
Use this only when you operate the database directly. Cloud customers typically use the context host and REST API instead.
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 |
spectron_storage_bytes_written_total | Counter | Bytes written to object storage |
spectron_storage_bytes_read_total | Counter | Bytes read from object storage |
spectron_documents_bytes_ingested_total | Counter | Raw document bytes accepted for ingest |
Byte-valued counters omit a doubled bytes suffix in Prometheus — the OTel exporter does not repeat a unit word already present in the metric name.
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