Also, backreferences (e.g. \1) are not supported in regex. Is it possible to set a variable and use it in regex: ?
пятница, 27 мая 2022 г. в 18:25:30 UTC+3, Lior Goikhburg: > Hi! > > My use case is to keep targets (kubernetes sd) only if the values of two > specific lables are equal. Can this be done ? > > My Idea was to concatenate lables and do a regex lookahead comparison. The > problem is that, unfortunately, lookahead is not supported by go's RE2. > > Here is what I tried: > # Only keep pods if container port matches tcp-port annotation > - source_labels: > - __meta_kubernetes_pod_container_port_number > - __meta_kubernetes_pod_annotation_tcp_port > action: keep > regex: ([^;]+);(?=\1$) > > Is there any other way around ? > -- You received this message because you are subscribed to the Google Groups "Prometheus Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/2d6d9363-4ea5-48c3-a264-cb0f4ce93b19n%40googlegroups.com.

