From ed2979735d3c4870329b38c98a234b33a4af5d07 Mon Sep 17 00:00:00 2001 From: manu vasconcelos Date: Thu, 11 Sep 2025 16:35:18 -0300 Subject: [PATCH 1/2] Uupdates with enpoint environment variable I also renamed to make it more pender specific, to make it obvious that those are only pender related metrics. Adding other exporters and pipelines seems pretty straight forward, just add '/service_name'. But adding a second Prometheus receiver, or making sure it sends scraped data to the correct pipeline seems more complex. --- docker-compose.yml | 3 ++- otel-collector-config.yaml | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 162bfe6..53d087b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -168,11 +168,12 @@ services: # volumes: # - ./otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml # environment: + # pender_metrics_endpoint: "pender:3200" # x_honeycomb_team: ${X_HONEYCOMB_TEAM} # Set this env var in your shell before running docker-compose # RAILS_ENV: development # SERVER_PORT: 3200 # networks: - # - dev + # - dev web: build: check-web platform: linux/x86_64 diff --git a/otel-collector-config.yaml b/otel-collector-config.yaml index 0c852e5..c332672 100644 --- a/otel-collector-config.yaml +++ b/otel-collector-config.yaml @@ -2,10 +2,10 @@ receivers: prometheus: config: scrape_configs: - - job_name: "prometheus" + - job_name: "pender_metrics" scrape_interval: 15s static_configs: - - targets: ["pender:3200"] + - targets: ["${env:pender_metrics_endpoint}"] processors: memory_limiter: @@ -17,7 +17,7 @@ processors: send_batch_size: 8192 exporters: - otlp/metrics: + otlp/pender_metrics: endpoint: "api.honeycomb.io:443" # US instance #endpoint: "api.eu1.honeycomb.io:443" # EU instance headers: @@ -29,7 +29,7 @@ service: # logs: # level: "debug" pipelines: - metrics: + metrics/pender_metrics: receivers: [prometheus] processors: [memory_limiter, batch] - exporters: [otlp/metrics] + exporters: [otlp/pender_metrics] From 8205ccf43d3dd956dac60d9bc7323e2451d58a3e Mon Sep 17 00:00:00 2001 From: manu vasconcelos Date: Thu, 25 Sep 2025 16:49:37 -0300 Subject: [PATCH 2/2] Add routing connector to OTEL config So we can route a specific service prometheus metrics to the specific service honeycomb dataset. Notes: 1. We don't need to send the dataset when sending traces, but we still do when sending metrics. 2. While we can aliases most otel-collector components, e.g.: otlp/pender_metrics. The prometheus receiver does not support that, so we need the router connector to send to the right pipeline. (There is a target-allocation feature in the prometheus receiver, but it is specific to kubernetes.) --- otel-collector-config.yaml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/otel-collector-config.yaml b/otel-collector-config.yaml index c332672..7890046 100644 --- a/otel-collector-config.yaml +++ b/otel-collector-config.yaml @@ -6,6 +6,7 @@ receivers: scrape_interval: 15s static_configs: - targets: ["${env:pender_metrics_endpoint}"] + metrics_path: /metrics processors: memory_limiter: @@ -23,13 +24,33 @@ exporters: headers: "x-honeycomb-team": ${env:x_honeycomb_team} # Honeycomb API KEY "x-honeycomb-dataset": "pender" + # for debugging purposes only + # debug: + # verbosity: normal + +connectors: + routing: + default_pipelines: [] + # for debugging purposes only + # default_pipelines: [metrics/debug] + table: + - context: resource + condition: attributes["service.name"] == "pender_metrics" + pipelines: [metrics/pender_honeycomb] service: # telemetry: # logs: # level: "debug" pipelines: - metrics/pender_metrics: + metrics/prometheus: receivers: [prometheus] + exporters: [routing] + metrics/pender_honeycomb: + receivers: [routing] processors: [memory_limiter, batch] exporters: [otlp/pender_metrics] + # for debugging purposes only + # metrics/debug: + # receivers: [routing] + # exporters: [debug]