prometheus / graphite_exporter

Server that accepts metrics via the Graphite protocol and exports them as Prometheus metrics
Apache License 2.0
356 stars 100 forks source link

Invalid match error if there is an asterisk followed by an underscore #241

Open enriquezubiria opened 1 year ago

enriquezubiria commented 1 year ago

Hi, The following mappings file (I include only the relevant part)

- match: "servers.*_guadaltel_es_guadaltel_es.*.*"
  name: "${3}"
  labels:
    instance: "${1}.guadaltel.es"
    type: "${2}"

throws the following error

ts=2023-10-04T09:56:07.639Z caller=main.go:83 level=info msg="Starting graphite_exporter" version_info="(version=0.13.1, branch=HEAD, revision=4848deacb8fd5a1087379026857ad3764a00aa8d)"
ts=2023-10-04T09:56:07.639Z caller=main.go:84 level=info build_context="(go=go1.19.3, user=root@e4fc80d65bcd, date=20221205-15:57:35)"
ts=2023-10-04T09:56:07.639Z caller=main.go:94 level=error msg="Error loading metric mapping config" err="invalid match: servers.*_guadaltel_es_guadaltel_es.*.*"

But if I use match: "servers.*.*.*" or match: "servers.xxxx_guadaltel_es_guadaltel_es.*.*" it works properly. Any suggestion? Regards,

matthiasr commented 11 months ago

I believe this is because we do not support prefix matches yet. The Graphite exporter uses the mapping code from the StatsD exporter, so the implementation would happen over there, and then we pull it in here via a dependency upgrade. If you want to tackle this, please do 😄