mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
Make sure the namespace metric is send to the plugin correctly and MetricType#To_hash wont return all the values
Fixes: #5529 Fixes #5532
This commit is contained in:
parent
72b277404b
commit
1dd44383c7
5 changed files with 6 additions and 15 deletions
|
@ -22,7 +22,7 @@ module LogStash
|
|||
|
||||
# Scope the metrics to the plugin
|
||||
namespaced_metric = metric.namespace(@filter.plugin_unique_name.to_sym)
|
||||
@filter.metric = metric
|
||||
@filter.metric = namespaced_metric
|
||||
|
||||
@metric_events = namespaced_metric.namespace(:events)
|
||||
namespaced_metric.gauge(:name, config_name)
|
||||
|
|
|
@ -17,10 +17,7 @@ module LogStash module Instrument module MetricType
|
|||
|
||||
def to_hash
|
||||
{
|
||||
"namespaces" => namespaces,
|
||||
"key" => key,
|
||||
"type" => type,
|
||||
"value" => value
|
||||
key => value
|
||||
}
|
||||
end
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ module LogStash class OutputDelegator
|
|||
|
||||
# Scope the metrics to the plugin
|
||||
namespaced_metric = metric.namespace(output.plugin_unique_name.to_sym)
|
||||
output.metric = namespaced_metric
|
||||
|
||||
@metric_events = namespaced_metric.namespace(:events)
|
||||
namespaced_metric.gauge(:name, config_name)
|
||||
|
||||
|
|
|
@ -28,12 +28,7 @@ describe LogStash::Instrument::MetricType::Counter do
|
|||
|
||||
context "When creating a hash " do
|
||||
it "creates the hash from all the values" do
|
||||
metric_hash = {
|
||||
"key" => key,
|
||||
"namespaces" => namespaces,
|
||||
"value" => 0,
|
||||
"type" => "counter"
|
||||
}
|
||||
metric_hash = { key => 0 }
|
||||
expect(subject.to_hash).to match(metric_hash)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -29,10 +29,7 @@ describe LogStash::Instrument::MetricType::Gauge do
|
|||
context "When creating a hash " do
|
||||
it "creates the hash from all the values" do
|
||||
metric_hash = {
|
||||
"key" => key,
|
||||
"namespaces" => namespaces,
|
||||
"value" => value,
|
||||
"type" => "gauge"
|
||||
key => value
|
||||
}
|
||||
expect(subject.to_hash).to match(metric_hash)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue