Skip to main content

Database Schema

DevPulse uses two datastores: a shared PostgreSQL database (appdb) for the Spring services, and MongoDB for py-intelligence's RAG documents and persisted AI analyses.

PostgreSQL

Following microservice principles, the Spring services share a physical database instance for local ease of use, but manage their own independent tables — no foreign keys across services. Correlation is done via the logId (UUID) generated at ingestion.

Table: system_logs

Owning service: spring-logbook — stores immutable, historical records of all ingested system events, deployment logs, and errors.

ColumnTypeConstraintsDescription
log_idUUIDPKCorrelation ID generated by spring-ingestion.
service_nameVARCHAR(255)NOT NULLName of the microservice/system that emitted the log.
typeVARCHAR(255)NOT NULLLog category (e.g. DEPLOYMENT_LOG, TROUBLESHOOTING_NOTE).
severityVARCHAR(255)NOT NULLSeverity level (INFO, WARNING, ERROR, ...).
log_contentTEXTnullableThe message, stack trace, or payload.
timestampTIMESTAMPTZNOT NULLUTC timestamp when the event occurred.

Table: incident_status

Owning service: spring-alerts — tracks the lifecycle state of incidents flagged by the rules engine.

ColumnTypeConstraintsDescription
log_idUUIDPKSame correlation ID as the triggering log.
statusVARCHAR(50)NOT NULL, default ACTIVEACTIVE, RESOLVED, IN_PROGRESS, or IGNORED.

Decoupling over foreign keys is intentional: spring-alerts and spring-logbook process messages asynchronously via RabbitMQ and never depend on each other's transactions.

MongoDB

py-intelligence connects to a MongoDB Atlas cluster (MONGODB_URI) and uses two collections in the rag database. Being document-based, there's no fixed schema or foreign keys — the shapes below reflect what the application code actually reads/writes.

Collection: ingestions

RAG knowledge base. Each document is a runbook/fix note, embedded via SentenceTransformers for similarity search (similarity_search in embedding_utils.py).

FieldTypeNotes
_idObjectIdMongo default primary key.
titlestringRequired.
contentstringRequired.
tagsstring[]Defaults to [].
embeddingfloat[]Added asynchronously once generated; absent until then.
created_atdatetimeSet on insert if not provided.

Collection: completed_analyses

Persisted AI analysis results, so a re-opened log shows its previous analysis instead of an empty panel.

FieldTypeNotes
_idObjectIdMongo default primary key.
log_idstringPresent when the analysis is tied to a specific log; upserted on.
modelstringWhich model actually produced the result (local Qwen, Gemini, or the OpenAI fallback).
modestringRequested mode: local or cloud.
problem_type, severity, summary, problem_summary, confidencestringStructured analysis fields.
evidence, troubleshoot, solutionsstring[]Structured analysis fields.
sourcesobject[]RAG references, {id, title}.
timestampdatetimeSet on insert/update.