-
Notifications
You must be signed in to change notification settings - Fork 209
feat: Suppress internal spans by default #1533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
59ae02a
7185ad2
d9b44ce
c8df9ed
07d0a02
f8f0694
7ec9182
29f377e
a2b71e8
e7e5045
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ def call(context) | |
) do |span| | ||
MessagingHelper.inject_context_if_supported(context, client_method, service_id) | ||
|
||
if HandlerHelper.instrumentation_config[:suppress_internal_instrumentation] | ||
if HandlerHelper.skip_internal_instrumentation? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kaylareopelle I realize this is a common pattern we have in the code base already but I would recommend we look into refactoring cases like this where we create separate mixins for "untraced" instead of evaluating this logic with every request. |
||
OpenTelemetry::Common::Utilities.untraced { super } | ||
else | ||
super | ||
|
@@ -32,7 +32,6 @@ def call(context) | |
OpenTelemetry::SemanticConventions::Trace::HTTP_STATUS_CODE, | ||
context.http_response.status_code | ||
) | ||
|
||
if (err = response.error) | ||
span.record_exception(err) | ||
span.status = Trace::Status.error(err.to_s) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,24 +19,27 @@ module AwsSdk | |
# - `false` **(default)** - Context key/value will not be added. | ||
# - `true` - Context key/value will be added. | ||
# | ||
# ### `:suppress_internal_instrumentation` | ||
# ### `:enable_internal_instrumentation` | ||
# Enables tracing of spans of `internal` span kind. | ||
# | ||
# Disables tracing of spans of `internal` span kind. | ||
# - `false` **(default)** - Internal spans are not traced | ||
# - `true` - Internal spans are traced. | ||
# | ||
# - `false` **(default)** - Internal spans are traced. | ||
# - `true` - Internal spans are not traced. | ||
# ### `:suppress_internal_instrumentation` (deprecated) | ||
# This configuration has been deprecated in a favor of `:enable_internal_instrumentation` | ||
# | ||
# @example An explicit default configuration | ||
# @example An explicit default configurations | ||
# OpenTelemetry::SDK.configure do |c| | ||
# c.use 'OpenTelemetry::Instrumentation::AwsSdk', { | ||
# inject_messaging_context: false, | ||
# suppress_internal_instrumentation: false | ||
# enable_internal_instrumentation: false | ||
# } | ||
# end | ||
class Instrumentation < OpenTelemetry::Instrumentation::Base | ||
MINIMUM_VERSION = Gem::Version.new('2.0.0') | ||
|
||
install do |_config| | ||
install do |config| | ||
resolve_config(config) | ||
require_dependencies | ||
patch_telemetry_plugin if telemetry_plugin? | ||
add_plugins(Seahorse::Client::Base, *loaded_service_clients) | ||
|
@@ -52,6 +55,7 @@ class Instrumentation < OpenTelemetry::Instrumentation::Base | |
|
||
option :inject_messaging_context, default: false, validate: :boolean | ||
option :suppress_internal_instrumentation, default: false, validate: :boolean | ||
option :enable_internal_instrumentation, default: false, validate: :boolean | ||
|
||
def gem_version | ||
if Gem.loaded_specs['aws-sdk'] | ||
|
@@ -65,6 +69,15 @@ def gem_version | |
|
||
private | ||
|
||
def resolve_config(config) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How are we providing backward compatability for the deprecated option? Is it not supposed to work at all? |
||
return unless config[:suppress_internal_instrumentation] | ||
|
||
OpenTelemetry.logger.warn( | ||
'Instrumentation AwsSdk configuration option suppress_internal_instrumentation has been deprecated,' \ | ||
'use enable_internal_instrumentation option instead' | ||
) | ||
end | ||
|
||
def require_dependencies | ||
require_relative 'handler' | ||
require_relative 'handler_helper' | ||
|
Uh oh!
There was an error while loading. Please reload this page.