prometheus / alertmanager

Prometheus Alertmanager
https://prometheus.io
Apache License 2.0
6.66k stars 2.16k forks source link

Struct tags are not longer supporting multiple space separated keys #2625

Open Duologic opened 3 years ago

Duologic commented 3 years ago

https://github.com/prometheus/alertmanager/blob/58169c14126074bf45cce3e168641ede9eb23e47/config/config.go#L268

While working on an AST parser for Alertmanager to generate a Jsonnet library, I noticed I could not parse the struct tags with fatih/structtags. Apparently there was a period that multiple keys in the struct tags was supported but this is not longer the case.

Reference from fatih/structtags: https://github.com/fatih/structtag/pull/14

And upstream in golang/go: https://github.com/golang/go/issues/40281

I'm not sure if there are alternatives to this yet, just wanted to raise this issue, maybe someone else already has encountered this (and hopefully found a solution).

roidelapluie commented 3 years ago

I have not encountered this.

I'd also like to note that, for the API itself, you should/could work out of the OpenAPI spec and not from the go code.

Duologic commented 3 years ago

Wasn't aware of the OpenAPI spec here, does that also exist for Prometheus?

Duologic commented 3 years ago

Fyi, been working on this here: https://github.com/Duologic/prom-gen

roidelapluie commented 3 years ago

This might land in Prometheus in the future.