prometheus
prometheus copied to clipboard
docs (label_replace): illustrate use of named capturing group
Illustrate use of named capturing group syntax available from https://github.com/google/re2/wiki/Syntax and their usage in the replacement field
Signed-off-by: Guillaume Berche [email protected]
Thank you for your pull request.
Our documentation is not meant as a replacement for re2 syntax and I feel like dropping such an example would be more confusing for users. In addition, for the very vast majority of usecases, named groups are not needed since label replace deals with simple replacements.
thanks for your review. The proposed changed does not aim at duplicating RE2 syntax, but to rather confirm that named groups can be accessed by $name. I had to guess it as only indexed group reference such as $1 were documented.
I've added a commit to remove the example and only keep the description refinement.
We have discussed this during our bug scrub. We found out that it is confusing that this pull request does not explain how to do capturing groups. Maybe the sentence should be moved to a dedicated example showing the usage of named capturing groups, WDYT?
We have discussed this during our bug scrub. We found out that it is confusing that this pull request does not explain how to do capturing groups. Maybe the sentence should be moved to a dedicated example showing the usage of named capturing groups, WDYT?
Thanks @roidelapluie the original change at https://github.com/prometheus/prometheus/pull/11404/commits/ea40c15fe9d69273281bda41ab3e300087156ec8 explained usage of named group by comparing it with syntax without named group.
Is it what what was expected during the bug scrub ?
Can we maybe split the named capture group into a second exemple with the explanation?
Can you please review https://github.com/prometheus/prometheus/pull/11404/commits/60b380da70213975bfd343be64f5b89b03e2c944 ?
Feel free to squash / edit as needed if this can be faster or more productive.
Thanks!