Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Kubernetes port annotation does not use port number #5281

Closed
bboreham opened this Issue Feb 28, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@bboreham
Copy link
Contributor

bboreham commented Feb 28, 2019

In this line which is given as an example of annotation usage,

- source_labels: [__address__, __meta_kubernetes_service_annotation_example_io_scrape_port]
  action: replace
  regex: ([^:]+)(?::\d+)?;(\d+)
  replacement: $1:$2
  target_label: __address__

I am puzzled that the replacement is $1:$2; I expect it to be $1:$3 so that the port number specified in the annotation is used.

For instance I see a similar line matching my expectation here.

@simonpasquier

This comment has been minimized.

Copy link
Member

simonpasquier commented Feb 28, 2019

This is because the second group ((?::\d+)) isn't captured (eg it starts with (?:).

@bboreham

This comment has been minimized.

Copy link
Contributor Author

bboreham commented Feb 28, 2019

Ooh. TIL.

@bboreham bboreham closed this Feb 28, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.