Skip to content

Commit 1069f4e

Browse files
authored
fix: use FQDN for Prometheus host to avoid corporate DNS conflicts (#191)
The bare hostname `prometheus` gets resolved via DNS search domains (e.g. `prometheus.amazon.com`) instead of Docker's internal DNS, causing Data Prepper's Armeria client to cache the wrong IP and fail to write metrics to Prometheus. - Change default PROMETHEUS_HOST to `prometheus.observability-stack-network` - Templatize Prometheus host/port in Data Prepper pipeline config - Add sed replacements and env vars for PROMETHEUS_HOST/PORT in docker-compose - Update fallback default in opensearch-dashboards init script Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
1 parent 9af8ed1 commit 1069f4e

4 files changed

Lines changed: 7 additions & 3 deletions

File tree

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ ISM_RETENTION_DAYS=7
4949

5050
# Prometheus Configuration
5151
PROMETHEUS_VERSION=v3.8.1
52-
PROMETHEUS_HOST=prometheus
52+
PROMETHEUS_HOST=prometheus.observability-stack-network
5353
PROMETHEUS_PORT=9090
5454
PROMETHEUS_RETENTION=15d
5555

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ services:
7575
sed -i 's|OPENSEARCH_PROTOCOL|${OPENSEARCH_PROTOCOL}|g' /tmp/pipelines.yaml &&
7676
sed -i 's|OPENSEARCH_HOST|${OPENSEARCH_HOST}|g' /tmp/pipelines.yaml &&
7777
sed -i 's|OPENSEARCH_PORT|${OPENSEARCH_PORT}|g' /tmp/pipelines.yaml &&
78+
sed -i 's|PROMETHEUS_HOST|${PROMETHEUS_HOST}|g' /tmp/pipelines.yaml &&
79+
sed -i 's|PROMETHEUS_PORT|${PROMETHEUS_PORT}|g' /tmp/pipelines.yaml &&
7880
mv /tmp/pipelines.yaml /usr/share/data-prepper/pipelines/pipelines.yaml &&
7981
exec /usr/share/data-prepper/bin/data-prepper"
8082
volumes:
@@ -90,6 +92,8 @@ services:
9092
- OPENSEARCH_PORT=${OPENSEARCH_PORT}
9193
- OPENSEARCH_USER=${OPENSEARCH_USER}
9294
- OPENSEARCH_PASSWORD=${OPENSEARCH_PASSWORD}
95+
- PROMETHEUS_HOST=${PROMETHEUS_HOST}
96+
- PROMETHEUS_PORT=${PROMETHEUS_PORT}
9397
depends_on:
9498
opensearch:
9599
condition: service_healthy

docker-compose/data-prepper/pipelines.template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ service-map-pipeline:
109109
insecure: true
110110
# Route RED metrics to local Prometheus via remote write
111111
- prometheus:
112-
url: "http://prometheus:9090/api/v1/write"
112+
url: "http://PROMETHEUS_HOST:PROMETHEUS_PORT/api/v1/write"
113113
threshold:
114114
max_events: 500
115115
flush_interval: 5s

docker-compose/opensearch-dashboards/init/init-opensearch-dashboards.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
BASE_URL = f"{_dashboards_protocol}://{_dashboards_host}:{_dashboards_port}"
1212
USERNAME = os.getenv("OPENSEARCH_USER", "admin")
1313
PASSWORD = os.getenv("OPENSEARCH_PASSWORD", "My_password_123!@#")
14-
PROMETHEUS_HOST = os.getenv("PROMETHEUS_HOST", "prometheus")
14+
PROMETHEUS_HOST = os.getenv("PROMETHEUS_HOST", "prometheus.observability-stack-network")
1515
PROMETHEUS_PORT = os.getenv("PROMETHEUS_PORT", "9090")
1616
_opensearch_protocol = os.getenv("OPENSEARCH_PROTOCOL", "https")
1717
OPENSEARCH_ENDPOINT = f"{_opensearch_protocol}://{os.getenv('OPENSEARCH_HOST', 'opensearch')}:{os.getenv('OPENSEARCH_PORT', '9200')}"

0 commit comments

Comments
 (0)