# This is an example config. global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: 'hyper-dht-prometheus' # The metrics of the hyper-dht-prometheus service itself static_configs: - targets: - 'localhost:30000' # Replace with the host and port where the hyper-dht-prometheus http server runs - job_name: 'hyper-dht-prom-redirects' file_sd_configs: - files: - 'targets.json' # Source for relabeling approach: https://stackoverflow.com/questions/59866342/prometheus-dynamic-metrics-path relabel_configs: relabel_configs: # Targets are structured as ::hostname:service (we extract each part) - source_labels: [__address__] regex: '(.+):.{52}:.+' replacement: '$1' target_label: instance - source_labels: [instance] replacement: '/scrape/$1/metrics' target_label: __metrics_path__ # => instead of default /metrics - source_labels: [__address__] regex: '.+:.{52}:([^:]+):.+' replacement: '$1' target_label: hostname - source_labels: [__address__] regex: '.+:.{52}:[^:]+:(.+)' replacement: '$1' target_label: service - source_labels: [__address__] replacement: 'localhost:30000' # Replace with the host and port where the hyper-dht-prometheus http server runs target_label: __address__