Skip to content

Add remote metrics setup#5

Merged
vladiant merged 2 commits into
mainfrom
add_remote_metrics
Mar 14, 2026
Merged

Add remote metrics setup#5
vladiant merged 2 commits into
mainfrom
add_remote_metrics

Conversation

@vladiant
Copy link
Copy Markdown
Collaborator

Summary

This MR adds a remote observability setup so local Grafana/Prometheus can monitor a remotely hosted Commerce API (for example, Render), and adds an optional server-side Promtail agent for shipping remote Docker logs to Loki.

Motivation

The existing setup assumes the app and database run in the same local Docker Compose network.
When the app/database are remote, local observability was not directly usable.
This change introduces configurable remote scraping and remote log shipping paths.

Scope of Changes

Added

  • .env.remote.example
  • .env.server-logs.example
  • docker-compose.remote.yml
  • docker-compose.server-logs.yml
  • observability/prometheus.remote.yml.tmpl
  • observability/promtail.remote.yml.tmpl

Updated

  • README.md

What’s Included

1) Remote metrics stack (docker-compose.remote.yml)

  • Runs local observability services for remote targets:
  • grafana
  • prometheus
  • loki
  • tempo
  • otel-collector
  • Prometheus config is rendered from env vars at container startup.
  • Supports HTTPS and custom metrics path through:
  • REMOTE_SERVER_ADDRESS
  • REMOTE_APP_SCHEME
  • REMOTE_APP_PORT
  • REMOTE_METRICS_PATH

2) Server-side remote log shipping (docker-compose.server-logs.yml)

  • Adds a Promtail agent intended to run on the remote Docker host.
  • Pushes logs to a configurable Loki endpoint.
  • Uses:
  • REMOTE_LOKI_PUSH_URL
  • REMOTE_LOG_HOST
  • REMOTE_LOG_JOB

3) Documentation updates (README.md)

  • Added a full remote observability flow under Development Server Option B.
  • Added a concrete Render example for:
  • https://commercesystemdemo.onrender.com/
  • Added quick verification commands and dashboard links.
  • Documented remote limitations and server-side log shipping notes.
  • Renumbered old local option to Option C.

Validation

  • Verified remote endpoints on Render:
  • / returns 200
  • /health returns 200
  • /metrics returns 200 with commerce_* metrics
  • Verified compose rendering:
  • docker compose -f docker-compose.remote.yml ... config
  • docker compose -f docker-compose.server-logs.yml ... config
  • Verified runtime behavior:
  • Remote Prometheus target is up for commercesystemdemo.onrender.com:443
  • Grafana is healthy and provisioned dashboards are available

How to Use (Render example)

cp .env.remote.example .env.remote

@vladiant vladiant merged commit c083aa2 into main Mar 14, 2026
1 check passed
@vladiant vladiant deleted the add_remote_metrics branch March 14, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant