ddtrace 1.21.0 → 1.21.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -2
- data/lib/datadog/auto_instrument.rb +3 -0
- data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +11 -4
- data/lib/datadog/tracing/contrib/configurable.rb +1 -1
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +0 -5
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +4 -28
- data/lib/datadog/tracing/contrib/rails/patcher.rb +0 -16
- data/lib/datadog/tracing/contrib/sinatra/tracer.rb +3 -6
- data/lib/datadog/tracing/metadata/ext.rb +0 -2
- data/lib/ddtrace/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88e2b5d32d76e7c167d43a9868aed0903f8b82936bd0faf8eb10e02ae83d5928
|
4
|
+
data.tar.gz: 65927b5d7037a853debb4da6cd71dda3dec0dd6b765bd90230ac3fa2904655f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c467f5c384aeae1fe813df7a2b081e36c665f7a5f550322b9fbfafc402ad70d1d81ba578094bf4064a9d1c8a97f94be8b998ae2d2218c18e0bfaba97b754d5ea
|
7
|
+
data.tar.gz: 8510f7f8afa6a89591bb128389ab210e2d6f3049c23a2d2ef3f58c4f0c042abe5cc865b6b5efe5198f116a6c98cea34cbf6e257078477744aa66db66aa3e6f1f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [1.21.1] - 2024-03-20
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
* Backports auto instrument shim with `datadog/auto_instrument` ([#3535][])
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
* Fix ActiveRecord resolving invalid string ([#3523][])
|
14
|
+
* Revert `http.route` tagging to fix instrumentation failure for Rails 7.1 apps ([#3539][])
|
15
|
+
* Fix wrong permissions on released gem files ([#3531][])
|
16
|
+
|
5
17
|
## [1.21.0] - 2024-03-14
|
6
18
|
|
7
19
|
### Highlights
|
@@ -2764,7 +2776,8 @@ Release notes: https://github.com/DataDog/dd-trace-rb/releases/tag/v0.3.1
|
|
2764
2776
|
Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
2765
2777
|
|
2766
2778
|
|
2767
|
-
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.
|
2779
|
+
[Unreleased]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.1...master
|
2780
|
+
[1.21.1]: https://github.com/DataDog/dd-trace-rb/compare/v1.21.0...v1.21.1
|
2768
2781
|
[1.21.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.20.0...v1.21.0
|
2769
2782
|
[1.20.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.19.0...v1.20.0
|
2770
2783
|
[1.19.0]: https://github.com/DataDog/dd-trace-rb/compare/v1.18.0...v1.19.0
|
@@ -4056,6 +4069,10 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
4056
4069
|
[#3518]: https://github.com/DataDog/dd-trace-rb/issues/3518
|
4057
4070
|
[#3519]: https://github.com/DataDog/dd-trace-rb/issues/3519
|
4058
4071
|
[#3520]: https://github.com/DataDog/dd-trace-rb/issues/3520
|
4072
|
+
[#3523]: https://github.com/DataDog/dd-trace-rb/issues/3523
|
4073
|
+
[#3531]: https://github.com/DataDog/dd-trace-rb/issues/3531
|
4074
|
+
[#3535]: https://github.com/DataDog/dd-trace-rb/issues/3535
|
4075
|
+
[#3539]: https://github.com/DataDog/dd-trace-rb/issues/3539
|
4059
4076
|
[@AdrianLC]: https://github.com/AdrianLC
|
4060
4077
|
[@Azure7111]: https://github.com/Azure7111
|
4061
4078
|
[@BabyGroot]: https://github.com/BabyGroot
|
@@ -4207,4 +4224,4 @@ Git diff: https://github.com/DataDog/dd-trace-rb/compare/v0.3.0...v0.3.1
|
|
4207
4224
|
[@y-yagi]: https://github.com/y-yagi
|
4208
4225
|
[@yujideveloper]: https://github.com/yujideveloper
|
4209
4226
|
[@yukimurasawa]: https://github.com/yukimurasawa
|
4210
|
-
[@zachmccormick]: https://github.com/zachmccormick
|
4227
|
+
[@zachmccormick]: https://github.com/zachmccormick
|
@@ -37,7 +37,7 @@ module Datadog
|
|
37
37
|
|
38
38
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_DELIVER)
|
39
39
|
|
40
|
-
# Since email
|
40
|
+
# Since email data can contain PII we disable by default
|
41
41
|
# Some of these fields can be either strings or arrays, so we try to normalize
|
42
42
|
# https://github.com/rails/rails/blob/18707ab17fa492eb25ad2e8f9818a320dc20b823/actionmailer/lib/action_mailer/base.rb#L742-L754
|
43
43
|
if configuration[:email_data] == true
|
@@ -65,9 +65,14 @@ module Datadog
|
|
65
65
|
|
66
66
|
config
|
67
67
|
rescue => e
|
68
|
+
# Resolving a valid database configuration should not raise an exception,
|
69
|
+
# but if it does, it can be due to adding a broken pattern match prior to this call.
|
70
|
+
#
|
71
|
+
# `db_config` input may contain sensitive information such as passwords,
|
72
|
+
# hence provide a succinct summary for the error logging.
|
68
73
|
Datadog.logger.error(
|
69
|
-
|
70
|
-
"Cause: #{e.class.name}
|
74
|
+
'Failed to resolve ActiveRecord database configuration. '\
|
75
|
+
"Cause: #{e.class.name} Source: #{Array(e.backtrace).first}"
|
71
76
|
)
|
72
77
|
|
73
78
|
nil
|
@@ -85,9 +90,11 @@ module Datadog
|
|
85
90
|
normalized
|
86
91
|
rescue => e
|
87
92
|
Datadog.logger.error(
|
88
|
-
"Failed to resolve
|
89
|
-
"Cause: #{e.class.name}
|
93
|
+
"Failed to resolve key #{matcher.inspect}. " \
|
94
|
+
"Cause: #{e.class.name} Source: #{Array(e.backtrace).first}"
|
90
95
|
)
|
96
|
+
|
97
|
+
nil
|
91
98
|
end
|
92
99
|
|
93
100
|
#
|
@@ -94,8 +94,6 @@ module Datadog
|
|
94
94
|
|
95
95
|
span.set_error(payload[:exception_object]) if exception_is_error?(payload[:exception_object])
|
96
96
|
|
97
|
-
integration_route = endpoint.env['grape.routing_args'][:route_info].pattern.origin
|
98
|
-
|
99
97
|
# override the current span with this notification values
|
100
98
|
span.set_tag(Ext::TAG_ROUTE_ENDPOINT, api_view) unless api_view.nil?
|
101
99
|
span.set_tag(Ext::TAG_ROUTE_PATH, path)
|
@@ -103,9 +101,6 @@ module Datadog
|
|
103
101
|
|
104
102
|
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_METHOD, request_method)
|
105
103
|
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_URL, path)
|
106
|
-
|
107
|
-
trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE, integration_route)
|
108
|
-
trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH, endpoint.env['SCRIPT_NAME'])
|
109
104
|
ensure
|
110
105
|
span.start(start)
|
111
106
|
span.finish(finish)
|
@@ -66,10 +66,6 @@ module Datadog
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
70
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
71
|
-
# rubocop:disable Metrics/MethodLength
|
72
|
-
# rubocop:disable Metrics/AbcSize
|
73
69
|
def call(env)
|
74
70
|
# Find out if this is rack within rack
|
75
71
|
previous_request_span = env[Ext::RACK_ENV_REQUEST_SPAN]
|
@@ -111,30 +107,6 @@ module Datadog
|
|
111
107
|
|
112
108
|
# call the rest of the stack
|
113
109
|
status, headers, response = @app.call(env)
|
114
|
-
|
115
|
-
if status != 404 && (last_route = request_trace.get_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE))
|
116
|
-
last_script_name = request_trace.get_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH)
|
117
|
-
|
118
|
-
# If the last_script_name is empty but the env['SCRIPT_NAME'] is NOT empty
|
119
|
-
# then the current rack request was not routed and must be accounted for
|
120
|
-
# which only happens in pure nested rack requests i.e /rack/rack/hello/world
|
121
|
-
#
|
122
|
-
# To account for the unaccounted nested rack requests of /rack/hello/world,
|
123
|
-
# we use 'PATH_INFO knowing that rack cannot have named parameters
|
124
|
-
if last_script_name == '' && env['SCRIPT_NAME'] != ''
|
125
|
-
last_script_name = last_route
|
126
|
-
last_route = env['PATH_INFO']
|
127
|
-
end
|
128
|
-
|
129
|
-
# Clear the route and route path tags from the request trace to avoid possibility of misplacement
|
130
|
-
request_trace.clear_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE)
|
131
|
-
request_trace.clear_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH)
|
132
|
-
|
133
|
-
# Ensure tags are placed in rack.request span as desired
|
134
|
-
request_span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE, last_script_name + last_route)
|
135
|
-
request_span.clear_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH)
|
136
|
-
end
|
137
|
-
|
138
110
|
[status, headers, response]
|
139
111
|
|
140
112
|
# rubocop:disable Lint/RescueException
|
@@ -170,6 +142,10 @@ module Datadog
|
|
170
142
|
end
|
171
143
|
# rubocop:enable Lint/RescueException
|
172
144
|
|
145
|
+
# rubocop:disable Metrics/AbcSize
|
146
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
147
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
148
|
+
# rubocop:disable Metrics/MethodLength
|
173
149
|
def set_request_tags!(trace, request_span, env, status, headers, response, original_env)
|
174
150
|
request_header_collection = Header::RequestHeaderCollection.new(env)
|
175
151
|
|
@@ -5,24 +5,11 @@ require_relative 'log_injection'
|
|
5
5
|
require_relative 'middlewares'
|
6
6
|
require_relative 'utils'
|
7
7
|
require_relative '../semantic_logger/patcher'
|
8
|
-
require_relative 'ext'
|
9
8
|
|
10
9
|
module Datadog
|
11
10
|
module Tracing
|
12
11
|
module Contrib
|
13
12
|
module Rails
|
14
|
-
# Patcher to trace rails routing done by JourneyRouter
|
15
|
-
module JourneyRouterPatch
|
16
|
-
def find_routes(*args)
|
17
|
-
result = super
|
18
|
-
integration_route = result.first[2].path.spec.to_s.gsub(/\(\.:format\)/, '') if result.any?
|
19
|
-
request_trace = Tracing.active_trace || TraceOperation.new
|
20
|
-
request_trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE, integration_route)
|
21
|
-
request_trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH, args.first.env['SCRIPT_NAME'])
|
22
|
-
result
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
13
|
# Patcher enables patching of 'rails' module.
|
27
14
|
module Patcher
|
28
15
|
include Contrib::Patcher
|
@@ -54,9 +41,6 @@ module Datadog
|
|
54
41
|
# Sometimes we don't want to activate middleware e.g. OpenTracing, etc.
|
55
42
|
add_middleware(app) if Datadog.configuration.tracing[:rails][:middleware]
|
56
43
|
|
57
|
-
# ActionDispatch::Journey is not available or incompatible in Rails < 4.2.
|
58
|
-
ActionDispatch::Journey::Router.prepend(JourneyRouterPatch) if Integration.version >= Gem::Version.new('4.2')
|
59
|
-
|
60
44
|
Rails::LogInjection.configure_log_tags(app.config)
|
61
45
|
end
|
62
46
|
end
|
@@ -47,16 +47,16 @@ module Datadog
|
|
47
47
|
configuration = Datadog.configuration.tracing[:sinatra]
|
48
48
|
return super unless Tracing.enabled?
|
49
49
|
|
50
|
-
|
50
|
+
datadog_route = Sinatra::Env.route_path(env)
|
51
51
|
|
52
52
|
Tracing.trace(
|
53
53
|
Ext::SPAN_ROUTE,
|
54
54
|
service: configuration[:service_name],
|
55
55
|
span_type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
|
56
|
-
resource: "#{request.request_method} #{
|
56
|
+
resource: "#{request.request_method} #{datadog_route}",
|
57
57
|
) do |span, trace|
|
58
58
|
span.set_tag(Ext::TAG_APP_NAME, settings.name || settings.superclass.name)
|
59
|
-
span.set_tag(Ext::TAG_ROUTE_PATH,
|
59
|
+
span.set_tag(Ext::TAG_ROUTE_PATH, datadog_route)
|
60
60
|
|
61
61
|
if request.script_name && !request.script_name.empty?
|
62
62
|
span.set_tag(Ext::TAG_SCRIPT_NAME, request.script_name)
|
@@ -73,9 +73,6 @@ module Datadog
|
|
73
73
|
|
74
74
|
Contrib::Analytics.set_measured(span)
|
75
75
|
|
76
|
-
_, path = env['sinatra.route'].split(' ', 2)
|
77
|
-
trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE, path)
|
78
|
-
trace.set_tag(Tracing::Metadata::Ext::HTTP::TAG_ROUTE_PATH, env['SCRIPT_NAME'])
|
79
76
|
super
|
80
77
|
end
|
81
78
|
end
|
data/lib/ddtrace/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddtrace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.21.
|
4
|
+
version: 1.21.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-03-
|
11
|
+
date: 2024-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -221,6 +221,7 @@ files:
|
|
221
221
|
- lib/datadog/appsec/utils/http.rb
|
222
222
|
- lib/datadog/appsec/utils/http/media_range.rb
|
223
223
|
- lib/datadog/appsec/utils/http/media_type.rb
|
224
|
+
- lib/datadog/auto_instrument.rb
|
224
225
|
- lib/datadog/core.rb
|
225
226
|
- lib/datadog/core/backport.rb
|
226
227
|
- lib/datadog/core/buffer/cruby.rb
|
@@ -889,7 +890,7 @@ licenses:
|
|
889
890
|
metadata:
|
890
891
|
allowed_push_host: https://rubygems.org
|
891
892
|
changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md
|
892
|
-
post_install_message:
|
893
|
+
post_install_message:
|
893
894
|
rdoc_options: []
|
894
895
|
require_paths:
|
895
896
|
- lib
|
@@ -907,8 +908,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
907
908
|
- !ruby/object:Gem::Version
|
908
909
|
version: 2.0.0
|
909
910
|
requirements: []
|
910
|
-
rubygems_version: 3.4.
|
911
|
-
signing_key:
|
911
|
+
rubygems_version: 3.4.21
|
912
|
+
signing_key:
|
912
913
|
specification_version: 4
|
913
914
|
summary: Datadog tracing code for your Ruby applications
|
914
915
|
test_files: []
|