mirror of
https://github.com/elastic/logstash.git
synced 2025-04-25 07:07:54 -04:00
Namespace should use a copy of the arrays when creating a sub space
Fix: #5510 Fixes #5513
This commit is contained in:
parent
74672c994b
commit
73c1e68050
2 changed files with 8 additions and 1 deletions
|
@ -45,7 +45,7 @@ module LogStash module Instrument
|
||||||
end
|
end
|
||||||
|
|
||||||
def namespace(name)
|
def namespace(name)
|
||||||
NamespacedMetric.new(metric, namespace_name.concat(Array(name)))
|
NamespacedMetric.new(metric, namespace_name + Array(name))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -22,4 +22,11 @@ describe LogStash::Instrument::NamespacedMetric do
|
||||||
it "returns the value of the block" do
|
it "returns the value of the block" do
|
||||||
expect(subject.time(:duration_ms) { "hello" }).to eq("hello")
|
expect(subject.time(:duration_ms) { "hello" }).to eq("hello")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "its doesnt change the original `namespace` when creating a subnamespace" do
|
||||||
|
new_namespace = subject.namespace(:wally)
|
||||||
|
|
||||||
|
expect(subject.namespace_name).to eq([namespace])
|
||||||
|
expect(new_namespace.namespace_name).to eq([:stats, :wally])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue