Monitoring & Observability

Tarasol uses a comprehensive monitoring stack for application performance, logging, and metrics collection across all microservices.

Stack Overview

ToolPurpose
Elastic APMApplication performance monitoring
ElasticsearchLog aggregation and search
WinstonStructured logging framework
PrometheusMetrics collection
MorganHTTP request logging

Elastic APM

Every NestJS service includes the Elastic APM agent for:

  • Transaction Tracing — End-to-end request tracking across services
  • Error Tracking — Automatic error capture and alerting
  • Performance Metrics — Response times, throughput, latency

Configuration

NameTypeDefaultDescription
ELASTIC_APM_SERVER_URLstring-APM Server URL
ELASTIC_APM_SERVICE_NAMEstring-Service name for APM
ELASTIC_APM_SECRET_TOKENstring-APM authentication token
ELASTIC_APM_ENVIRONMENTstringproductionEnvironment name

Logging

All services use Winston with ECS (Elastic Common Schema) format:

// Logging configuration
{
  format: winston.format.combine(
    winston.format.timestamp(),
    ecsFormat()
  ),
  transports: [
    new winston.transports.Console(),
    new ElasticsearchTransport({
      node: ELASTICSEARCH_URL
    })
  ]
}

Log Levels

LevelUsage
errorApplication errors, unhandled exceptions
warnDeprecation notices, retry attempts
infoRequest lifecycle, business events
debugDetailed diagnostic information

Prometheus Metrics

Services expose metrics at /metrics endpoint:

  • http_request_duration_seconds — Request duration histogram
  • http_requests_total — Total request counter
  • active_connections — Current active connections
  • rabbitmq_messages_consumed — Messages consumed counter

Health Checks

Every service exposes /health with checks for:

  • Database connectivity
  • Redis connectivity
  • RabbitMQ connectivity
  • External service dependencies