-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:
ActiveSupport
constant conflict in Active Model Serializers in…
…strumentation (#1072) When both `ActiveSupport` and `ActiveModelSerializers` instrumentations are loaded, constant `ActiveSupport::Notifications` inside `ActiveModelSerializers` can be incorrectly resolved to `OpenTelemetry::Instrumentation::ActiveSupport`. Co-authored-by: Francis Bogsanyi <francis.bogsanyi@shopify.com>
- Loading branch information
Showing
4 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
instrumentation/all/test/opentelemetry/instrumentation/all_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
require_relative '../../test_helper' | ||
|
||
require 'active_support/all' | ||
require 'active_model_serializers' | ||
|
||
# require Instrumentation so .install method is found: | ||
require_relative '../../../lib/opentelemetry/instrumentation/all' | ||
|
||
describe OpenTelemetry::Instrumentation::All do | ||
describe 'ActiveModelSerializers instrumentation' do | ||
it 'does not conflict with ActiveSupport instrumentation' do | ||
# Expected behavior is that the exception is not raised. | ||
OpenTelemetry::Instrumentation::ActiveSupport::Instrumentation.instance.install | ||
OpenTelemetry::Instrumentation::ActiveModelSerializers::Instrumentation.instance.install | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ | |
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
require 'minitest/autorun' | ||
require 'webmock/minitest' |