mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 22:57:16 -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
|
||||
|
||||
def namespace(name)
|
||||
NamespacedMetric.new(metric, namespace_name.concat(Array(name)))
|
||||
NamespacedMetric.new(metric, namespace_name + Array(name))
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -22,4 +22,11 @@ describe LogStash::Instrument::NamespacedMetric do
|
|||
it "returns the value of the block" do
|
||||
expect(subject.time(:duration_ms) { "hello" }).to eq("hello")
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue