ddtrace 0.40.0 → 0.41.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -1
- data/Rakefile +0 -23
- data/ddtrace.gemspec +1 -0
- data/lib/ddtrace/buffer.rb +154 -43
- data/lib/ddtrace/configuration.rb +4 -1
- data/lib/ddtrace/configuration/options.rb +3 -1
- data/lib/ddtrace/configuration/settings.rb +5 -1
- data/lib/ddtrace/contrib/active_record/events/sql.rb +4 -0
- data/lib/ddtrace/contrib/active_support/notifications/subscription.rb +2 -2
- data/lib/ddtrace/contrib/aws/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/dalli/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/elasticsearch/patcher.rb +4 -0
- data/lib/ddtrace/contrib/ethon/easy_patch.rb +4 -2
- data/lib/ddtrace/contrib/ethon/multi_patch.rb +4 -0
- data/lib/ddtrace/contrib/excon/middleware.rb +4 -0
- data/lib/ddtrace/contrib/faraday/middleware.rb +4 -0
- data/lib/ddtrace/contrib/grape/endpoint.rb +6 -4
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/client.rb +4 -0
- data/lib/ddtrace/contrib/grpc/datadog_interceptor/server.rb +4 -0
- data/lib/ddtrace/contrib/http/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/httprb/instrumentation.rb +3 -0
- data/lib/ddtrace/contrib/mongodb/subscribers.rb +4 -0
- data/lib/ddtrace/contrib/mysql2/instrumentation.rb +4 -0
- data/lib/ddtrace/contrib/presto/instrumentation.rb +3 -0
- data/lib/ddtrace/contrib/racecar/event.rb +4 -0
- data/lib/ddtrace/contrib/redis/tags.rb +4 -0
- data/lib/ddtrace/contrib/rest_client/request_patch.rb +4 -0
- data/lib/ddtrace/contrib/sequel/database.rb +3 -1
- data/lib/ddtrace/contrib/sequel/dataset.rb +3 -2
- data/lib/ddtrace/contrib/sequel/ext.rb +1 -0
- data/lib/ddtrace/contrib/sequel/utils.rb +16 -5
- data/lib/ddtrace/ext/integration.rb +8 -0
- data/lib/ddtrace/ext/runtime.rb +1 -0
- data/lib/ddtrace/opentracer/distributed_headers.rb +1 -1
- data/lib/ddtrace/propagation/grpc_propagator.rb +2 -2
- data/lib/ddtrace/runtime/metrics.rb +6 -2
- data/lib/ddtrace/sampler.rb +2 -2
- data/lib/ddtrace/span.rb +152 -27
- data/lib/ddtrace/tracer.rb +3 -4
- data/lib/ddtrace/transport/http/adapters/net.rb +8 -2
- data/lib/ddtrace/transport/http/statistics.rb +14 -1
- data/lib/ddtrace/transport/traces.rb +7 -2
- data/lib/ddtrace/utils.rb +7 -3
- data/lib/ddtrace/version.rb +1 -1
- metadata +17 -2
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ddtrace/contrib/analytics'
|
2
2
|
require 'ddtrace/contrib/aws/ext'
|
3
|
+
require 'ddtrace/ext/integration'
|
3
4
|
|
4
5
|
module Datadog
|
5
6
|
module Contrib
|
@@ -29,6 +30,9 @@ module Datadog
|
|
29
30
|
span.name = Ext::SPAN_COMMAND
|
30
31
|
span.resource = context.safely(:resource)
|
31
32
|
|
33
|
+
# Tag as an external peer service
|
34
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
35
|
+
|
32
36
|
# Set analytics sample rate
|
33
37
|
if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
|
34
38
|
Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ddtrace/ext/integration'
|
1
2
|
require 'ddtrace/ext/net'
|
2
3
|
require 'ddtrace/contrib/analytics'
|
3
4
|
require 'ddtrace/contrib/dalli/ext'
|
@@ -20,6 +21,9 @@ module Datadog
|
|
20
21
|
span.service = datadog_configuration[:service_name]
|
21
22
|
span.span_type = Datadog::Contrib::Dalli::Ext::SPAN_TYPE_COMMAND
|
22
23
|
|
24
|
+
# Tag as an external peer service
|
25
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
26
|
+
|
23
27
|
# Set analytics sample rate
|
24
28
|
if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled])
|
25
29
|
Contrib::Analytics.set_sample_rate(span, datadog_configuration[:analytics_sample_rate])
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ddtrace/contrib/patcher'
|
2
2
|
require 'ddtrace/ext/app_types'
|
3
|
+
require 'ddtrace/ext/integration'
|
3
4
|
require 'ddtrace/ext/net'
|
4
5
|
require 'ddtrace/contrib/analytics'
|
5
6
|
require 'ddtrace/contrib/elasticsearch/ext'
|
@@ -77,6 +78,9 @@ module Datadog
|
|
77
78
|
params = JSON.generate(params) if params && !params.is_a?(String)
|
78
79
|
body = JSON.generate(body) if body && !body.is_a?(String)
|
79
80
|
|
81
|
+
# Tag as an external peer service
|
82
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
83
|
+
|
80
84
|
# Set analytics sample rate
|
81
85
|
if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled])
|
82
86
|
Contrib::Analytics.set_sample_rate(span, datadog_configuration[:analytics_sample_rate])
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ddtrace/ext/net'
|
2
2
|
require 'ddtrace/ext/distributed'
|
3
|
+
require 'ddtrace/ext/integration'
|
3
4
|
require 'ddtrace/propagation/http_propagator'
|
4
5
|
require 'ddtrace/contrib/ethon/ext'
|
5
6
|
require 'ddtrace/contrib/http_annotation_helper'
|
@@ -12,8 +13,8 @@ module Datadog
|
|
12
13
|
def self.included(base)
|
13
14
|
base.send(:prepend, InstanceMethods)
|
14
15
|
end
|
15
|
-
|
16
16
|
# InstanceMethods - implementing instrumentation
|
17
|
+
# rubocop:disable Metrics/ModuleLength
|
17
18
|
module InstanceMethods
|
18
19
|
include Datadog::Contrib::HttpAnnotationHelper
|
19
20
|
|
@@ -103,7 +104,8 @@ module Datadog
|
|
103
104
|
method = @datadog_method.to_s
|
104
105
|
end
|
105
106
|
span.resource = method
|
106
|
-
|
107
|
+
# Tag as an external peer service
|
108
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
107
109
|
# Set analytics sample rate
|
108
110
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
109
111
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ddtrace/ext/net'
|
2
2
|
require 'ddtrace/ext/distributed'
|
3
|
+
require 'ddtrace/ext/integration'
|
3
4
|
require 'ddtrace/propagation/http_propagator'
|
4
5
|
require 'ddtrace/contrib/ethon/ext'
|
5
6
|
|
@@ -52,6 +53,9 @@ module Datadog
|
|
52
53
|
service: datadog_configuration[:service_name]
|
53
54
|
)
|
54
55
|
|
56
|
+
# Tag as an external peer service
|
57
|
+
@datadog_multi_span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, @datadog_multi_span.service)
|
58
|
+
|
55
59
|
# Set analytics sample rate
|
56
60
|
Contrib::Analytics.set_sample_rate(@datadog_multi_span, analytics_sample_rate) if analytics_enabled?
|
57
61
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'excon'
|
2
2
|
require 'ddtrace/ext/http'
|
3
|
+
require 'ddtrace/ext/integration'
|
3
4
|
require 'ddtrace/ext/net'
|
4
5
|
require 'ddtrace/ext/distributed'
|
5
6
|
require 'ddtrace/propagation/http_propagator'
|
@@ -108,6 +109,9 @@ module Datadog
|
|
108
109
|
span.service = service_name(datum[:host], @options)
|
109
110
|
span.span_type = Datadog::Ext::HTTP::TYPE_OUTBOUND
|
110
111
|
|
112
|
+
# Tag as an external peer service
|
113
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
114
|
+
|
111
115
|
# Set analytics sample rate
|
112
116
|
if analytics_enabled?
|
113
117
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'ddtrace/ext/http'
|
3
|
+
require 'ddtrace/ext/integration'
|
3
4
|
require 'ddtrace/ext/net'
|
4
5
|
require 'ddtrace/propagation/http_propagator'
|
5
6
|
require 'ddtrace/contrib/analytics'
|
@@ -41,6 +42,9 @@ module Datadog
|
|
41
42
|
span.service = options[:split_by_domain] ? env[:url].host : options[:service_name]
|
42
43
|
span.span_type = Datadog::Ext::HTTP::TYPE_OUTBOUND
|
43
44
|
|
45
|
+
# Tag as an external peer service
|
46
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
47
|
+
|
44
48
|
# Set analytics sample rate
|
45
49
|
if Contrib::Analytics.enabled?(options[:analytics_enabled])
|
46
50
|
Contrib::Analytics.set_sample_rate(span, options[:analytics_sample_rate])
|
@@ -1,3 +1,4 @@
|
|
1
|
+
|
1
2
|
require 'ddtrace/ext/http'
|
2
3
|
require 'ddtrace/ext/errors'
|
3
4
|
require 'ddtrace/contrib/analytics'
|
@@ -95,7 +96,7 @@ module Datadog
|
|
95
96
|
span.set_tag(Ext::TAG_ROUTE_ENDPOINT, api_view) unless api_view.nil?
|
96
97
|
span.set_tag(Ext::TAG_ROUTE_PATH, path)
|
97
98
|
ensure
|
98
|
-
span.
|
99
|
+
span.start(start)
|
99
100
|
span.finish(finish)
|
100
101
|
end
|
101
102
|
rescue StandardError => e
|
@@ -134,7 +135,7 @@ module Datadog
|
|
134
135
|
|
135
136
|
span.set_error(payload[:exception_object]) unless payload[:exception_object].nil?
|
136
137
|
ensure
|
137
|
-
span.
|
138
|
+
span.start(start)
|
138
139
|
span.finish(finish)
|
139
140
|
end
|
140
141
|
rescue StandardError => e
|
@@ -153,7 +154,8 @@ module Datadog
|
|
153
154
|
span = tracer.trace(
|
154
155
|
Ext::SPAN_ENDPOINT_RUN_FILTERS,
|
155
156
|
service: service_name,
|
156
|
-
span_type: Datadog::Ext::HTTP::TYPE_INBOUND
|
157
|
+
span_type: Datadog::Ext::HTTP::TYPE_INBOUND,
|
158
|
+
start_time: start
|
157
159
|
)
|
158
160
|
|
159
161
|
begin
|
@@ -169,7 +171,7 @@ module Datadog
|
|
169
171
|
span.set_error(payload[:exception_object]) unless payload[:exception_object].nil?
|
170
172
|
span.set_tag(Ext::TAG_FILTER_TYPE, type.to_s)
|
171
173
|
ensure
|
172
|
-
span.
|
174
|
+
span.start(start)
|
173
175
|
span.finish(finish)
|
174
176
|
end
|
175
177
|
rescue StandardError => e
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'ddtrace/ext/http'
|
2
|
+
require 'ddtrace/ext/integration'
|
2
3
|
require 'ddtrace/contrib/analytics'
|
3
4
|
require 'ddtrace/contrib/grpc/ext'
|
4
5
|
|
@@ -32,6 +33,9 @@ module Datadog
|
|
32
33
|
def annotate!(span, metadata)
|
33
34
|
span.set_tags(metadata)
|
34
35
|
|
36
|
+
# Tag as an external peer service
|
37
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
38
|
+
|
35
39
|
# Set analytics sample rate
|
36
40
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
37
41
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'ddtrace/ext/http'
|
2
|
+
require 'ddtrace/ext/integration'
|
2
3
|
require 'ddtrace/contrib/analytics'
|
3
4
|
require 'ddtrace/contrib/grpc/ext'
|
4
5
|
|
@@ -46,6 +47,9 @@ module Datadog
|
|
46
47
|
span.set_tag(header, value)
|
47
48
|
end
|
48
49
|
|
50
|
+
# Tag as an external peer service
|
51
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
52
|
+
|
49
53
|
# Set analytics sample rate
|
50
54
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
51
55
|
|
@@ -2,6 +2,7 @@ require 'uri'
|
|
2
2
|
require 'ddtrace/pin'
|
3
3
|
require 'ddtrace/ext/app_types'
|
4
4
|
require 'ddtrace/ext/http'
|
5
|
+
require 'ddtrace/ext/integration'
|
5
6
|
require 'ddtrace/ext/net'
|
6
7
|
require 'ddtrace/ext/distributed'
|
7
8
|
require 'ddtrace/contrib/analytics'
|
@@ -83,6 +84,9 @@ module Datadog
|
|
83
84
|
span.set_tag(Datadog::Ext::NET::TARGET_HOST, host)
|
84
85
|
span.set_tag(Datadog::Ext::NET::TARGET_PORT, port.to_s)
|
85
86
|
|
87
|
+
# Tag as an external peer service
|
88
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
89
|
+
|
86
90
|
# Set analytics sample rate
|
87
91
|
set_analytics_sample_rate(span, request_options)
|
88
92
|
end
|
@@ -72,6 +72,9 @@ module Datadog
|
|
72
72
|
logger.debug("service #{req_options[:service_name]} span #{Ext::SPAN_REQUEST} missing uri")
|
73
73
|
end
|
74
74
|
|
75
|
+
# Tag as an external peer service
|
76
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
77
|
+
|
75
78
|
set_analytics_sample_rate(span, req_options)
|
76
79
|
end
|
77
80
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'ddtrace/contrib/analytics'
|
2
2
|
require 'ddtrace/contrib/mongodb/ext'
|
3
3
|
require 'ddtrace/contrib/mongodb/parsers'
|
4
|
+
require 'ddtrace/ext/integration'
|
4
5
|
|
5
6
|
module Datadog
|
6
7
|
module Contrib
|
@@ -24,6 +25,9 @@ module Datadog
|
|
24
25
|
query = MongoDB.query_builder(event.command_name, event.database_name, event.command)
|
25
26
|
serialized_query = query.to_s
|
26
27
|
|
28
|
+
# Tag as an external peer service
|
29
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
30
|
+
|
27
31
|
# Set analytics sample rate
|
28
32
|
if analytics_enabled?
|
29
33
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate)
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'ddtrace/ext/app_types'
|
2
|
+
require 'ddtrace/ext/integration'
|
2
3
|
require 'ddtrace/ext/net'
|
3
4
|
require 'ddtrace/ext/sql'
|
4
5
|
require 'ddtrace/contrib/analytics'
|
@@ -21,6 +22,9 @@ module Datadog
|
|
21
22
|
span.service = datadog_pin.service
|
22
23
|
span.span_type = Datadog::Ext::SQL::TYPE
|
23
24
|
|
25
|
+
# Tag as an external peer service
|
26
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
27
|
+
|
24
28
|
# Set analytics sample rate
|
25
29
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
26
30
|
|
@@ -90,6 +90,9 @@ module Datadog
|
|
90
90
|
set_nilable_tag!(span, :http_proxy, Ext::TAG_PROXY)
|
91
91
|
set_nilable_tag!(span, :model_version, Ext::TAG_MODEL_VERSION)
|
92
92
|
|
93
|
+
# Tag as an external peer service
|
94
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
95
|
+
|
93
96
|
# Set analytics sample rate
|
94
97
|
if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled])
|
95
98
|
Contrib::Analytics.set_sample_rate(span, datadog_configuration[:analytics_sample_rate])
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'ddtrace/contrib/analytics'
|
2
2
|
require 'ddtrace/contrib/active_support/notifications/event'
|
3
3
|
require 'ddtrace/contrib/racecar/ext'
|
4
|
+
require 'ddtrace/ext/integration'
|
4
5
|
|
5
6
|
module Datadog
|
6
7
|
module Contrib
|
@@ -37,6 +38,9 @@ module Datadog
|
|
37
38
|
span.service = configuration[:service_name]
|
38
39
|
span.resource = payload[:consumer_class]
|
39
40
|
|
41
|
+
# Tag as an external peer service
|
42
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
43
|
+
|
40
44
|
# Set analytics sample rate
|
41
45
|
if Contrib::Analytics.enabled?(configuration[:analytics_enabled])
|
42
46
|
Contrib::Analytics.set_sample_rate(span, configuration[:analytics_sample_rate])
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'ddtrace/ext/integration'
|
1
2
|
require 'ddtrace/ext/net'
|
2
3
|
require 'ddtrace/contrib/analytics'
|
3
4
|
require 'ddtrace/contrib/redis/ext'
|
@@ -9,6 +10,9 @@ module Datadog
|
|
9
10
|
module Tags
|
10
11
|
class << self
|
11
12
|
def set_common_tags(client, span)
|
13
|
+
# Tag as an external peer service
|
14
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
15
|
+
|
12
16
|
# Set analytics sample rate
|
13
17
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
14
18
|
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'ddtrace/ext/net'
|
2
2
|
require 'ddtrace/ext/distributed'
|
3
|
+
require 'ddtrace/ext/integration'
|
3
4
|
require 'ddtrace/propagation/http_propagator'
|
4
5
|
require 'ddtrace/contrib/rest_client/ext'
|
5
6
|
|
@@ -31,6 +32,9 @@ module Datadog
|
|
31
32
|
def datadog_tag_request(uri, span)
|
32
33
|
span.resource = method.to_s.upcase
|
33
34
|
|
35
|
+
# Tag as an external peer service
|
36
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
37
|
+
|
34
38
|
# Set analytics sample rate
|
35
39
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
36
40
|
|
@@ -24,7 +24,7 @@ module Datadog
|
|
24
24
|
span.service = datadog_pin.service
|
25
25
|
span.resource = opts[:query]
|
26
26
|
span.span_type = Datadog::Ext::SQL::TYPE
|
27
|
-
Utils.
|
27
|
+
Utils.set_common_tags(span)
|
28
28
|
span.set_tag(Ext::TAG_DB_VENDOR, adapter_name)
|
29
29
|
response = super(sql, options)
|
30
30
|
end
|
@@ -52,6 +52,8 @@ module Datadog
|
|
52
52
|
elsif instance_variable_defined?(:@pool) && @pool
|
53
53
|
@pool.db.opts
|
54
54
|
end
|
55
|
+
sql = sql.is_a?(::Sequel::SQL::Expression) ? literal(sql) : sql.to_s
|
56
|
+
|
55
57
|
Utils.parse_opts(sql, opts, db_opts)
|
56
58
|
end
|
57
59
|
end
|
@@ -38,15 +38,16 @@ module Datadog
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def trace_execute(super_method, sql, options, &block)
|
41
|
-
opts = Utils.parse_opts(sql, options, db.opts)
|
41
|
+
opts = Utils.parse_opts(sql, options, db.opts, self)
|
42
42
|
response = nil
|
43
43
|
|
44
44
|
datadog_pin.tracer.trace(Ext::SPAN_QUERY) do |span|
|
45
45
|
span.service = datadog_pin.service
|
46
46
|
span.resource = opts[:query]
|
47
47
|
span.span_type = Datadog::Ext::SQL::TYPE
|
48
|
-
Utils.
|
48
|
+
Utils.set_common_tags(span)
|
49
49
|
span.set_tag(Ext::TAG_DB_VENDOR, adapter_name)
|
50
|
+
span.set_tag(Ext::TAG_PREPARED_NAME, opts[:prepared_name]) if opts[:prepared_name]
|
50
51
|
response = super_method.call(sql, options, &block)
|
51
52
|
end
|
52
53
|
response
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ddtrace/ext/integration'
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Contrib
|
3
5
|
module Sequel
|
@@ -26,21 +28,30 @@ module Datadog
|
|
26
28
|
Datadog::Utils::Database.normalize_vendor(database.database_type.to_s)
|
27
29
|
end
|
28
30
|
|
29
|
-
def parse_opts(sql, opts, db_opts)
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
def parse_opts(sql, opts, db_opts, dataset = nil)
|
32
|
+
# Prepared statements don't provide their sql query in the +sql+ parameter.
|
33
|
+
unless sql.is_a?(String)
|
34
|
+
if dataset && dataset.respond_to?(:prepared_sql) && (resolved_sql = dataset.prepared_sql)
|
35
|
+
# The dataset contains the resolved SQL query and prepared statement name.
|
36
|
+
prepared_name = dataset.prepared_statement_name
|
37
|
+
sql = resolved_sql
|
38
|
+
end
|
33
39
|
end
|
34
40
|
|
35
41
|
{
|
36
42
|
name: opts[:type],
|
37
43
|
query: sql,
|
44
|
+
prepared_name: prepared_name,
|
38
45
|
database: db_opts[:database],
|
39
46
|
host: db_opts[:host]
|
40
47
|
}
|
41
48
|
end
|
42
49
|
|
43
|
-
def
|
50
|
+
def set_common_tags(span)
|
51
|
+
# Tag as an external peer service
|
52
|
+
span.set_tag(Datadog::Ext::Integration::TAG_PEER_SERVICE, span.service)
|
53
|
+
|
54
|
+
# Set analytics sample rate
|
44
55
|
Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?
|
45
56
|
end
|
46
57
|
|
data/lib/ddtrace/ext/runtime.rb
CHANGED
@@ -7,6 +7,7 @@ module Datadog
|
|
7
7
|
LANG = 'ruby'.freeze
|
8
8
|
LANG_INTERPRETER = (RUBY_ENGINE + '-' + RUBY_PLATFORM).freeze
|
9
9
|
LANG_VERSION = RUBY_VERSION
|
10
|
+
RUBY_ENGINE = ::RUBY_ENGINE # e.g. 'ruby', 'jruby', 'truffleruby'
|
10
11
|
TRACER_VERSION = Datadog::VERSION::STRING
|
11
12
|
|
12
13
|
TAG_LANG = 'language'.freeze
|
@@ -44,7 +44,7 @@ module Datadog
|
|
44
44
|
|
45
45
|
def id(header)
|
46
46
|
value = @carrier[header].to_i
|
47
|
-
return if value.zero? || value >= Datadog::Span::
|
47
|
+
return if value.zero? || value >= Datadog::Span::EXTERNAL_MAX_ID
|
48
48
|
value < 0 ? value + 0x1_0000_0000_0000_0000 : value
|
49
49
|
end
|
50
50
|
end
|
@@ -39,12 +39,12 @@ module Datadog
|
|
39
39
|
|
40
40
|
def trace_id
|
41
41
|
value = @metadata[GRPC_METADATA_TRACE_ID].to_i
|
42
|
-
value if (1..Span::
|
42
|
+
value if (1..Span::EXTERNAL_MAX_ID).cover? value
|
43
43
|
end
|
44
44
|
|
45
45
|
def parent_id
|
46
46
|
value = @metadata[GRPC_METADATA_PARENT_ID].to_i
|
47
|
-
value if (1..Span::
|
47
|
+
value if (1..Span::EXTERNAL_MAX_ID).cover? value
|
48
48
|
end
|
49
49
|
|
50
50
|
def sampling_priority
|