Skip to content

Commit 24e32a7

Browse files
author
Jesper Söderlund
committed
Added tag-parts, suffixes and prefixes
Signed-off-by: Jesper Söderlund <jesper.soderlund@klarna.com>
1 parent d344192 commit 24e32a7

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

spec/fluent/plugin/filter_prometheus_spec.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
require 'fluent/test/driver/filter'
33
require 'fluent/plugin/filter_prometheus'
44
require_relative 'shared'
5+
require 'json'
56

67
describe Fluent::Plugin::PrometheusFilter do
7-
let(:tag) { 'prometheus.test' }
8+
let(:tag) { 'prometheus.test.additional.parts' }
89
let(:driver) { Fluent::Test::Driver::Filter.new(Fluent::Plugin::PrometheusFilter).configure(config) }
910
let(:registry) { ::Prometheus::Client.registry }
1011

@@ -32,7 +33,4 @@
3233
expect(es.first).to eq(message)
3334
end
3435
end
35-
36-
it_behaves_like 'instruments record'
37-
end
3836
end

spec/fluent/plugin/shared.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,15 @@
8383
key foo
8484
<labels>
8585
foo ${foo}
86+
the_prefix ${tag_prefix[2]}
87+
another_part ${tag_parts[0]}
8688
</labels>
8789
</metric>
8890
<labels>
8991
tag ${tag}
9092
hostname ${hostname}
93+
single_part ${tag_parts[1]}
94+
the_suffix ${tag_suffix[2]}
9195
</labels>
9296
]
9397

0 commit comments

Comments
 (0)