Monitoring & Logging Service (Dante Backend)
This component of the Dante GPU Platform is responsible for aggregating logs and metrics from all backend services to provide observability, facilitate debugging, and monitor system health and performance.
Unlike other backend components that are custom-coded services, the Monitoring & Logging Service is primarily a configuration-based setup of existing, powerful open-source tools.
Objectives
- Centralized Logging: Collect logs from all microservices in a single, searchable location.
- Metrics Collection: Gather key performance indicators (KPIs) and operational metrics from services (e.g., request rates, error rates, latency, resource utilization).
- Visualization & Dashboards: Provide dashboards to visualize metrics and log data for easy monitoring and analysis.
- Alerting: (Future) Set up alerts based on predefined thresholds for metrics or specific log patterns to notify administrators of potential issues.
Chosen Stack (Initial Proposal)
- Metrics Collection: Prometheus
- Description: An open-source systems monitoring and alerting toolkit. Services will need to expose a
/metricsendpoint in a Prometheus-compatible format.
- Description: An open-source systems monitoring and alerting toolkit. Services will need to expose a
- Metrics Visualization: Grafana
- Description: An open-source platform for monitoring and observability. Grafana will use Prometheus as a data source to build dashboards.
- Log Aggregation: Loki
- Description: A horizontally scalable, highly available, multi-tenant log aggregation system inspired by Prometheus. It's designed to be cost-effective and easy to operate.
- Log Shipping: Promtail
- Description: An agent that ships the logs from local files or systemd journal to a private Loki instance or Grafana Cloud.
Alternative Log Aggregation (Considered):
- ELK Stack (Elasticsearch, Logstash, Kibana): A very powerful but potentially more resource-intensive option.
Integration Strategy
-
Metrics:
- Individual Go services (API Gateway, Provider Registry, Scheduler, Storage) will be instrumented using a Go client library for Prometheus (e.g.,
prometheus/client_golang). - Each service will expose an HTTP endpoint (typically
/metrics) that Prometheus can scrape. - The Python-based
auth-servicecan use a Python Prometheus client (e.g.,prometheus-client). - Prometheus will be configured to discover and scrape these endpoints (potentially via Consul service discovery or static configuration).
- Individual Go services (API Gateway, Provider Registry, Scheduler, Storage) will be instrumented using a Go client library for Prometheus (e.g.,
-
Logging:
- Services will continue to output structured logs (e.g., JSON format with Zap in Go services).
- Promtail will be configured to run as an agent (e.g., sidecar in Docker/Kubernetes, or a host agent) to collect these logs.
- Promtail will tail log files or read from container stdout/stderr and forward them to Loki, adding appropriate labels (e.g., service name, instance ID).
- Loki will store and index these logs.
- Grafana will use Loki as a data source for log querying and visualization (e.g., in conjunction with metrics dashboards).
Setup (Conceptual)
This service will be deployed using Docker Compose. The docker-compose.yml file in this directory will define services for:
prometheusgrafanalokipromtail(Promtail might be configured more globally or per-service, but a base config can reside here)
Configuration files for each tool (prometheus.yml, loki-config.yml, Grafana provisioning files) will be volume-mounted into the respective containers.
Running the Stack
# Navigate to monitoring-logging-service directory
docker compose up -d
- Prometheus UI: Typically
http://localhost:9090 - Grafana UI: Typically
http://localhost:3000 - Loki API: (Not usually accessed directly by users)
Next Steps
- Create placeholder configuration files for Prometheus, Grafana, Loki, and Promtail.
- Develop the
docker-compose.ymlto launch the stack. - Instrument existing Go services to expose a
/metricsendpoint. - Configure Promtail to collect logs from example service(s).
- Build basic Grafana dashboards for metrics and logs.