mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-15 00:13:30 +01:00
lib/promrelabel: add a test from https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3251
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/3251
This commit is contained in:
parent
1357107a11
commit
a72bf87e04
@ -708,6 +708,18 @@ func TestApplyRelabelConfigs(t *testing.T) {
|
||||
source_labels: [xyz]
|
||||
`, `metric{xyz="foo$",a="b"}`, true, `metric{a="b",xyz="bar"}`)
|
||||
})
|
||||
t.Run("issue-3251", func(t *testing.T) {
|
||||
f(`
|
||||
- source_labels: [instance, container_label_com_docker_swarm_task_name]
|
||||
separator: ';'
|
||||
# regex: '(.*?)\..*;(.*?)\..*'
|
||||
regex: '([^.]+).[^;]+;([^.]+).+'
|
||||
replacement: '$2:$1'
|
||||
target_label: container_label_com_docker_swarm_task_name
|
||||
action: replace
|
||||
`, `{instance="subdomain.domain.com",container_label_com_docker_swarm_task_name="myservice.h408nlaxmv8oqkn1pjjtd71to.nv987lz99rb27lkjjnfiay0g4"}`, true,
|
||||
`{container_label_com_docker_swarm_task_name="myservice:subdomain",instance="subdomain.domain.com"}`)
|
||||
})
|
||||
}
|
||||
|
||||
func TestFinalizeLabels(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user