improvement(go.d/sd): better prometheus exporters detection (#20348)
Ilya Mashchenko committed
May 26, 2025 at 21:49 UTC
83216507e8a685da457971e77b0ed59b9d16f6c6
1 file changed
+4
-1
src/go/plugin/go.d/config/go.d/sd/net_listeners.conf
+4
-1
@@ -163,7 +163,7 @@ classify:
163
tags: "-unknown exporter"
164
match:
165
- tags: "exporter"
166
- expr: '{{ and (not (empty (promPort .Port))) (not (eq .Comm "docker-proxy")) }}'
166
+ expr: '{{ or (and (not (empty (promPort .Port))) (not (eq .Comm "docker-proxy"))) (glob .Comm "*exporter*") }}'
167
compose:
168
- name: "Applications"
169
selector: "app"
@@ -608,6 +608,9 @@ compose:
608
- selector: "exporter"
609
template: |
610
{{ $name := promPort .Port -}}
611
+ {{ if empty $name -}}
612
+ {{ $name = printf "%s_%s" .Comm .Port -}}
613
+ {{ end -}}
614
module: prometheus
615
name: {{$name}}_local
616
url: http://{{.Address}}/metrics