mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00: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
740f7ac5e0
commit
5cec9706dc
1 changed files with 12 additions and 0 deletions
|
@ -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 a new issue