The only "variables" in rewriting rules are additional temporary labels, 
starting __tmp_.  I don't think there's anything you can do with those, 
that you can't do with a regular label.

On Saturday, 28 May 2022 at 11:27:14 UTC+1 [email protected] wrote:

> 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/3e13011a-f19b-4724-97c9-8629f4b66625n%40googlegroups.com.

Reply via email to