Skip to content

Commit

Permalink
Remove the private and internal extension system (#818)
Browse files Browse the repository at this point in the history
This system was introduced eight years ago in this commit:
dda717d

It is currently unused. Let's remove it so we remove some unused code
and can't confuse future readers.

Fixes #817
  • Loading branch information
tombruijn authored Feb 8, 2022
1 parent 0e9b72f commit 3f503ad
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 39 deletions.
6 changes: 6 additions & 0 deletions .changesets/remove-internal-extensions-system.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
bump: "patch"
type: "remove"
---

Remove internal `Appsignal.extensions` system. It was unused.
15 changes: 0 additions & 15 deletions lib/appsignal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,6 @@ class << self
# @see start_logger
attr_writer :logger

# @api private
def extensions
@extensions ||= []
end

# @api private
def initialize_extensions
Appsignal.logger.debug("Initializing extensions")
extensions.each do |extension|
Appsignal.logger.debug("Initializing #{extension}")
extension.initializer
end
end

# @api private
def testing?
false
Expand Down Expand Up @@ -123,7 +109,6 @@ def start
config.write_to_environment
Appsignal::Extension.start
Appsignal::Hooks.load_hooks
initialize_extensions

if config[:enable_allocation_tracking] && !Appsignal::System.jruby?
Appsignal::Extension.install_allocation_event_hook
Expand Down
18 changes: 0 additions & 18 deletions spec/lib/appsignal_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# Make sure we have a clean state because we want to test
# initialization here.
Appsignal.config = nil
Appsignal.extensions.clear
end

let(:transaction) { http_request_transaction }
Expand All @@ -20,14 +19,6 @@
end
end

describe ".extensions" do
it "should keep a list of extensions" do
expect(Appsignal.extensions).to be_empty
Appsignal.extensions << Appsignal::MockExtension
expect(Appsignal.extensions.size).to eq(1)
end
end

describe ".start" do
context "with no config set beforehand" do
it "should do nothing when config is not set and there is no valid config in the env" do
Expand Down Expand Up @@ -63,15 +54,6 @@
Appsignal.start
end

context "with an extension" do
before { Appsignal.extensions << Appsignal::MockExtension }

it "should call the extension's initializer" do
expect(Appsignal::MockExtension).to receive(:initializer)
Appsignal.start
end
end

context "when allocation tracking and gc instrumentation have been enabled" do
before do
allow(GC::Profiler).to receive(:enable)
Expand Down
6 changes: 0 additions & 6 deletions spec/support/mocks/mock_extension.rb

This file was deleted.

0 comments on commit 3f503ad

Please sign in to comment.