From d02d4e4429d8a4655cb52c6fb68b7a2de910c6a1 Mon Sep 17 00:00:00 2001 From: Pier-Hugues Pellerin Date: Thu, 2 Jun 2016 10:42:06 -0400 Subject: [PATCH] Refactor the metric library interaction The metric library now require an instance of the collector and will not use the singleton Fixes #5446 --- logstash-core/lib/logstash/instrument/metric.rb | 2 +- logstash-core/spec/logstash/instrument/collector_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/logstash-core/lib/logstash/instrument/metric.rb b/logstash-core/lib/logstash/instrument/metric.rb index 601c7b0ed..e6e12262a 100644 --- a/logstash-core/lib/logstash/instrument/metric.rb +++ b/logstash-core/lib/logstash/instrument/metric.rb @@ -13,7 +13,7 @@ module LogStash module Instrument class Metric attr_reader :collector - def initialize(collector = LogStash::Instrument::Collector.instance) + def initialize(collector) @collector = collector end diff --git a/logstash-core/spec/logstash/instrument/collector_spec.rb b/logstash-core/spec/logstash/instrument/collector_spec.rb index b96be4a5e..2a9979d0c 100644 --- a/logstash-core/spec/logstash/instrument/collector_spec.rb +++ b/logstash-core/spec/logstash/instrument/collector_spec.rb @@ -3,7 +3,7 @@ require "logstash/instrument/collector" require "spec_helper" describe LogStash::Instrument::Collector do - subject { LogStash::Instrument::Collector.instance } + subject { LogStash::Instrument::Collector.new } describe "#push" do let(:namespaces_path) { [:root, :pipelines, :pipelines01] } let(:key) { :my_key }