From 1e7fae62c1017234863493ab18484be6f7c2e236 Mon Sep 17 00:00:00 2001 From: Igor Bozato Date: Tue, 26 Sep 2017 08:07:09 -0300 Subject: [PATCH] Remove metriks support --- Gemfile | 1 - README.md | 2 +- lib/flipper/instrumentation/metriks.rb | 6 --- .../instrumentation/metriks_subscriber.rb | 20 ------- .../metriks_subscriber_spec.rb | 52 ------------------- 5 files changed, 1 insertion(+), 80 deletions(-) delete mode 100644 lib/flipper/instrumentation/metriks.rb delete mode 100644 lib/flipper/instrumentation/metriks_subscriber.rb delete mode 100644 spec/flipper/instrumentation/metriks_subscriber_spec.rb diff --git a/Gemfile b/Gemfile index 02032c45a..65cab8bfa 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,6 @@ end gem 'pry' gem 'rake', '~> 10.4.2' -gem 'metriks', '~> 0.9.9' gem 'shotgun', '~> 0.9' gem 'statsd-ruby', '~> 1.2.1' gem 'rspec', '~> 3.0' diff --git a/README.md b/README.md index 9dc6b02cd..32fe84ba3 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ Of course there are more [examples for you to peruse](examples/). You could also * [Gates](docs/Gates.md) - Boolean, Groups, Actors, % of Actors, and % of Time * [Adapters](docs/Adapters.md) - Mongo, Redis, Cassandra, Active Record... -* [Instrumentation](docs/Instrumentation.md) - ActiveSupport::Notifications, Statsd and Metriks +* [Instrumentation](docs/Instrumentation.md) - ActiveSupport::Notifications and Statsd * [Optimization](docs/Optimization.md) - Memoization middleware and Cache adapters * [Web Interface](docs/ui/README.md) - Point and click... * [API](docs/api/README.md) - HTTP API interface diff --git a/lib/flipper/instrumentation/metriks.rb b/lib/flipper/instrumentation/metriks.rb deleted file mode 100644 index 4dc10976c..000000000 --- a/lib/flipper/instrumentation/metriks.rb +++ /dev/null @@ -1,6 +0,0 @@ -require 'securerandom' -require 'active_support/notifications' -require 'flipper/instrumentation/metriks_subscriber' - -ActiveSupport::Notifications.subscribe /\.flipper$/, - Flipper::Instrumentation::MetriksSubscriber diff --git a/lib/flipper/instrumentation/metriks_subscriber.rb b/lib/flipper/instrumentation/metriks_subscriber.rb deleted file mode 100644 index 5f4826fb0..000000000 --- a/lib/flipper/instrumentation/metriks_subscriber.rb +++ /dev/null @@ -1,20 +0,0 @@ -# Note: You should never need to require this file directly if you are using -# ActiveSupport::Notifications. Instead, you should require the metriks file -# that lives in the same directory as this file. The benefit is that it -# subscribes to the correct events and does everything for your. -require 'flipper/instrumentation/subscriber' -require 'metriks' - -module Flipper - module Instrumentation - class MetriksSubscriber < Subscriber - def update_timer(metric) - Metriks.timer(metric).update(@duration) - end - - def update_counter(metric) - Metriks.meter(metric).mark - end - end - end -end diff --git a/spec/flipper/instrumentation/metriks_subscriber_spec.rb b/spec/flipper/instrumentation/metriks_subscriber_spec.rb deleted file mode 100644 index 2e59fa16d..000000000 --- a/spec/flipper/instrumentation/metriks_subscriber_spec.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'helper' -require 'flipper/adapters/memory' -require 'flipper/instrumentation/metriks' - -RSpec.describe Flipper::Instrumentation::MetriksSubscriber do - let(:adapter) do - memory = Flipper::Adapters::Memory.new - Flipper::Adapters::Instrumented.new(memory, instrumenter: ActiveSupport::Notifications) - end - let(:flipper) do - Flipper.new(adapter, instrumenter: ActiveSupport::Notifications) - end - - let(:user) { user = Flipper::Actor.new('1') } - - before do - Metriks::Registry.default.clear - end - - context 'for enabled feature' do - it 'updates feature metrics when calls happen' do - flipper[:stats].enable(user) - expect(Metriks.timer('flipper.feature_operation.enable').count).to be(1) - - flipper[:stats].enabled?(user) - expect(Metriks.timer('flipper.feature_operation.enabled').count).to be(1) - expect(Metriks.meter('flipper.feature.stats.enabled').count).to be(1) - end - end - - context 'for disabled feature' do - it 'updates feature metrics when calls happen' do - flipper[:stats].disable(user) - expect(Metriks.timer('flipper.feature_operation.disable').count).to be(1) - - flipper[:stats].enabled?(user) - expect(Metriks.timer('flipper.feature_operation.enabled').count).to be(1) - expect(Metriks.meter('flipper.feature.stats.disabled').count).to be(1) - end - end - - it 'updates adapter metrics when calls happen' do - flipper[:stats].enable(user) - expect(Metriks.timer('flipper.adapter.memory.enable').count).to be(1) - - flipper[:stats].enabled?(user) - expect(Metriks.timer('flipper.adapter.memory.get').count).to be(1) - - flipper[:stats].disable(user) - expect(Metriks.timer('flipper.adapter.memory.disable').count).to be(1) - end -end