Skip to content

Commit 084ca9c

Browse files
committed
Add DEV-3.0 comments for breaking changes
1 parent c85b9ac commit 084ca9c

File tree

10 files changed

+19
-5
lines changed

10 files changed

+19
-5
lines changed

lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ def finish_processing(payload)
7777

7878
exception = payload[:exception_object]
7979
if exception.nil?
80-
# [christian] in some cases :status is not defined,
81-
# rather than firing an error, simply acknowledge we don't know it.
8280
status = payload[:status]
8381
if status && Datadog.configuration.tracing.http_error_statuses.server.include?(status)
8482
span.status = Tracing::Metadata::Ext::Errors::STATUS

lib/datadog/tracing/contrib/action_pack/utils.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ def self.exception_is_error?(exception)
1313
# Gets the equivalent status code for the exception (not all are 5XX)
1414
# You can add custom errors via `config.action_dispatch.rescue_responses`
1515
status = ::ActionDispatch::ExceptionWrapper.status_code_for_exception(exception.class.name)
16-
# By default, only 5XX exceptions are actually errors (e.g. don't flag 404s).
17-
# This can be changed by setting `DD_TRACE_HTTP_SERVER_ERROR_STATUSES` environment variable.
1816
Datadog.configuration.tracing.http_error_statuses.server.include?(status)
1917
else
2018
true

lib/datadog/tracing/contrib/aws/instrumentation.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ def annotate!(span, context)
3636
span.name = Ext::SPAN_COMMAND
3737
span.resource = context.safely(:resource)
3838

39-
# Set error on the span if the Response Status Code is in error range
39+
# DEV-3.0: This was previously checking against a 500..599 range.
40+
# To not introduce breaking change, this was changed to use `http_error_statuses.server`,
41+
# but `aws` is a client library, this check should use `http_error_statuses.client` instead.
4042
if Datadog.configuration.tracing.http_error_statuses.server.include?(context.safely(:status_code))
4143
# At this point we do not have any additional diagnostics
4244
# besides the HTTP status code which is recorded in the span tags

lib/datadog/tracing/contrib/ethon/easy_patch.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def complete
5757
set_span_error_message("Request has failed: #{message}")
5858
else
5959
@datadog_span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, response_code)
60+
# DEV-3.0: This was previously checking against a 500..599 range.
61+
# To not introduce breaking change, this was changed to use `http_error_statuses.server`,
62+
# but `ethon` is a client library, this check should use `http_error_statuses.client` instead.
6063
if Datadog.configuration.tracing.http_error_statuses.server.include?(response_code)
6164
set_span_error_message("Request has failed with HTTP error: #{response_code}")
6265
end

lib/datadog/tracing/contrib/excon/configuration/settings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ class Settings < Contrib::Configuration::Settings
4444
o.setter do |value|
4545
if value.nil?
4646
# Fallback to global config, which is defaulted to client (400..499) + server (500..599)
47+
# DEV-3.0: `excon` is a client library, this should fall back to `http_error_statuses.client` only.
48+
# We cannot change it without causing a breaking change.
4749
client_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.client
4850
server_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.server
4951
client_global_error_statuses + server_global_error_statuses

lib/datadog/tracing/contrib/faraday/configuration/settings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class Settings < Contrib::Configuration::Settings
4343
o.setter do |value|
4444
if value.nil?
4545
# Fallback to global config, which is defaulted to client (400..499) + server (500..599)
46+
# DEV-3.0: `faraday` is a client library, this should fall back to `http_error_statuses.client` only.
47+
# We cannot change it without causing a breaking change.
4648
client_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.client
4749
server_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.server
4850
client_global_error_statuses + server_global_error_statuses

lib/datadog/tracing/contrib/http/configuration/settings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class Settings < Contrib::Configuration::Settings
4949
o.setter do |value|
5050
if value.nil?
5151
# Fallback to global config, which is defaulted to client (400..499) + server (500..599)
52+
# DEV-3.0: `http` is a client library, this should fall back to `http_error_statuses.client` only.
53+
# We cannot change it without causing a breaking change.
5254
client_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.client
5355
server_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.server
5456
client_global_error_statuses + server_global_error_statuses

lib/datadog/tracing/contrib/httpclient/configuration/settings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class Settings < Contrib::Configuration::Settings
4848
o.setter do |value|
4949
if value.nil?
5050
# Fallback to global config, which is defaulted to client (400..499) + server (500..599)
51+
# DEV-3.0: `httpclient` is a client library, this should fall back to `http_error_statuses.client` only.
52+
# We cannot change it without causing a breaking change.
5153
client_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.client
5254
server_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.server
5355
client_global_error_statuses + server_global_error_statuses

lib/datadog/tracing/contrib/httprb/configuration/settings.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class Settings < Contrib::Configuration::Settings
4848
o.setter do |value|
4949
if value.nil?
5050
# Fallback to global config, which is defaulted to client (400..499) + server (500..599)
51+
# DEV-3.0: `httprb` is a client library, this should fall back to `http_error_statuses.client` only.
52+
# We cannot change it without causing a breaking change.
5153
client_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.client
5254
server_global_error_statuses = Datadog.configuration.tracing.http_error_statuses.server
5355
client_global_error_statuses + server_global_error_statuses

lib/datadog/tracing/contrib/rest_client/request_patch.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ def datadog_trace_request(uri)
9999
end
100100
end
101101
rescue ::RestClient::ExceptionWithResponse => e
102+
# DEV-3.0: This was previously checking against a 500..599 range.
103+
# To not introduce breaking change, this was changed to use `http_error_statuses.server`,
104+
# but `rest_client` is a client library, this check should use `http_error_statuses.client` instead.
102105
span.set_error(e) if Datadog.configuration.tracing.http_error_statuses.server.include?(e.http_code)
103106
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, e.http_code)
104107

0 commit comments

Comments
 (0)