ddtrace 1.12.1 → 1.13.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 +129 -9
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +97 -14
- data/ext/ddtrace_profiling_native_extension/extconf.rb +6 -0
- data/ext/ddtrace_profiling_native_extension/http_transport.c +19 -6
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +1 -1
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +41 -2
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.h +6 -0
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +6 -10
- data/ext/ddtrace_profiling_native_extension/time_helpers.c +40 -4
- data/ext/ddtrace_profiling_native_extension/time_helpers.h +14 -0
- data/lib/datadog/appsec/component.rb +9 -0
- data/lib/datadog/appsec/configuration/settings.rb +104 -195
- data/lib/datadog/appsec/configuration.rb +0 -79
- data/lib/datadog/appsec/contrib/auto_instrument.rb +2 -4
- data/lib/datadog/appsec/contrib/devise/event.rb +57 -0
- data/lib/datadog/appsec/contrib/devise/ext.rb +13 -0
- data/lib/datadog/appsec/contrib/devise/integration.rb +42 -0
- data/lib/datadog/appsec/contrib/devise/patcher/authenticatable_patch.rb +76 -0
- data/lib/datadog/appsec/contrib/devise/patcher/registration_controller_patch.rb +52 -0
- data/lib/datadog/appsec/contrib/devise/patcher.rb +45 -0
- data/lib/datadog/appsec/contrib/devise/resource.rb +35 -0
- data/lib/datadog/appsec/contrib/devise/tracking.rb +49 -0
- data/lib/datadog/appsec/contrib/rack/ext.rb +2 -1
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +1 -1
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +12 -7
- data/lib/datadog/appsec/contrib/rails/ext.rb +3 -2
- data/lib/datadog/appsec/contrib/rails/framework.rb +1 -3
- data/lib/datadog/appsec/contrib/rails/patcher.rb +8 -8
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +1 -1
- data/lib/datadog/appsec/contrib/sinatra/ext.rb +2 -1
- data/lib/datadog/appsec/contrib/sinatra/framework.rb +1 -3
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +1 -1
- data/lib/datadog/appsec/event.rb +1 -1
- data/lib/datadog/appsec/extensions.rb +1 -130
- data/lib/datadog/appsec/monitor/reactive/set_user.rb +1 -1
- data/lib/datadog/appsec/processor.rb +1 -1
- data/lib/datadog/appsec/rate_limiter.rb +1 -1
- data/lib/datadog/appsec/remote.rb +1 -1
- data/lib/datadog/appsec.rb +1 -2
- data/lib/datadog/ci/configuration/settings.rb +6 -8
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +7 -5
- data/lib/datadog/ci/contrib/cucumber/ext.rb +10 -8
- data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +35 -0
- data/lib/datadog/ci/contrib/minitest/ext.rb +21 -0
- data/lib/datadog/ci/contrib/minitest/integration.rb +49 -0
- data/lib/datadog/ci/contrib/minitest/patcher.rb +27 -0
- data/lib/datadog/ci/contrib/minitest/test_helper.rb +68 -0
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +7 -5
- data/lib/datadog/ci/contrib/rspec/ext.rb +9 -7
- data/lib/datadog/ci.rb +1 -0
- data/lib/datadog/core/backport.rb +51 -0
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +9 -5
- data/lib/datadog/core/configuration/base.rb +5 -5
- data/lib/datadog/core/configuration/components.rb +6 -1
- data/lib/datadog/core/configuration/ext.rb +7 -5
- data/lib/datadog/core/configuration/option.rb +269 -19
- data/lib/datadog/core/configuration/option_definition.rb +76 -11
- data/lib/datadog/core/configuration/options.rb +22 -10
- data/lib/datadog/core/configuration/settings.rb +139 -61
- data/lib/datadog/core/environment/execution.rb +55 -0
- data/lib/datadog/core/environment/ext.rb +13 -11
- data/lib/datadog/core/environment/yjit.rb +58 -0
- data/lib/datadog/core/git/ext.rb +24 -22
- data/lib/datadog/core/logging/ext.rb +3 -1
- data/lib/datadog/core/metrics/ext.rb +7 -5
- data/lib/datadog/core/remote/client/capabilities.rb +5 -0
- data/lib/datadog/core/remote/client.rb +3 -0
- data/lib/datadog/core/remote/component.rb +25 -34
- data/lib/datadog/core/remote/configuration/content.rb +28 -1
- data/lib/datadog/core/remote/configuration/repository.rb +3 -1
- data/lib/datadog/core/remote/ext.rb +1 -1
- data/lib/datadog/core/remote/negotiation.rb +17 -4
- data/lib/datadog/core/runtime/ext.rb +22 -12
- data/lib/datadog/core/runtime/metrics.rb +43 -0
- data/lib/datadog/core/telemetry/client.rb +12 -2
- data/lib/datadog/core/telemetry/emitter.rb +4 -2
- data/lib/datadog/core/telemetry/event.rb +19 -4
- data/lib/datadog/core/telemetry/ext.rb +4 -1
- data/lib/datadog/core/telemetry/heartbeat.rb +2 -4
- data/lib/datadog/core/telemetry/http/ext.rb +10 -8
- data/lib/datadog/core/telemetry/http/transport.rb +1 -0
- data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +41 -0
- data/lib/datadog/core/telemetry/v2/request.rb +29 -0
- data/lib/datadog/core/transport/http/client.rb +1 -1
- data/lib/datadog/core/transport/http/config.rb +10 -0
- data/lib/datadog/core/utils/duration.rb +52 -0
- data/lib/datadog/core/utils/hash.rb +47 -0
- data/lib/datadog/core/utils/network.rb +1 -1
- data/lib/datadog/core/utils/safe_dup.rb +27 -20
- data/lib/datadog/core/utils.rb +1 -1
- data/lib/datadog/core/workers/async.rb +2 -2
- data/lib/datadog/kit/appsec/events.rb +139 -89
- data/lib/datadog/kit/identity.rb +80 -65
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +3 -0
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -0
- data/lib/datadog/profiling/collectors/thread_context.rb +9 -2
- data/lib/datadog/profiling/component.rb +41 -9
- data/lib/datadog/profiling/exporter.rb +5 -1
- data/lib/datadog/profiling/flush.rb +9 -2
- data/lib/datadog/profiling/http_transport.rb +13 -3
- data/lib/datadog/profiling/load_native_extension.rb +7 -1
- data/lib/datadog/profiling.rb +11 -1
- data/lib/datadog/tracing/component.rb +58 -6
- data/lib/datadog/tracing/configuration/dynamic/option.rb +71 -0
- data/lib/datadog/tracing/configuration/dynamic.rb +64 -0
- data/lib/datadog/tracing/configuration/ext.rb +35 -32
- data/lib/datadog/tracing/configuration/http.rb +74 -0
- data/lib/datadog/tracing/configuration/settings.rb +106 -92
- data/lib/datadog/tracing/contrib/action_cable/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/action_cable/ext.rb +20 -18
- data/lib/datadog/tracing/contrib/action_mailer/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/action_mailer/ext.rb +20 -18
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +8 -6
- data/lib/datadog/tracing/contrib/action_pack/ext.rb +10 -8
- data/lib/datadog/tracing/contrib/action_view/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/action_view/ext.rb +12 -10
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +13 -7
- data/lib/datadog/tracing/contrib/active_job/ext.rb +25 -23
- data/lib/datadog/tracing/contrib/active_job/log_injection.rb +1 -1
- data/lib/datadog/tracing/contrib/active_job/patcher.rb +1 -1
- data/lib/datadog/tracing/contrib/active_model_serializers/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/active_model_serializers/ext.rb +12 -10
- data/lib/datadog/tracing/contrib/active_record/configuration/settings.rb +9 -7
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +0 -8
- data/lib/datadog/tracing/contrib/active_record/ext.rb +17 -15
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +0 -5
- data/lib/datadog/tracing/contrib/active_support/configuration/settings.rb +9 -7
- data/lib/datadog/tracing/contrib/active_support/ext.rb +18 -16
- data/lib/datadog/tracing/contrib/aws/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/aws/ext.rb +37 -24
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/concurrent_ruby/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/concurrent_ruby/ext.rb +4 -2
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/dalli/ext.rb +19 -11
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +8 -6
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +13 -7
- data/lib/datadog/tracing/contrib/delayed_job/ext.rb +16 -14
- data/lib/datadog/tracing/contrib/elasticsearch/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/elasticsearch/ext.rb +21 -15
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +8 -5
- data/lib/datadog/tracing/contrib/ethon/configuration/settings.rb +16 -9
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +43 -3
- data/lib/datadog/tracing/contrib/ethon/ext.rb +19 -11
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +0 -5
- data/lib/datadog/tracing/contrib/excon/configuration/settings.rb +19 -10
- data/lib/datadog/tracing/contrib/excon/ext.rb +16 -8
- data/lib/datadog/tracing/contrib/excon/middleware.rb +20 -5
- data/lib/datadog/tracing/contrib/ext.rb +23 -1
- data/lib/datadog/tracing/contrib/extensions.rb +32 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +20 -10
- data/lib/datadog/tracing/contrib/faraday/ext.rb +16 -8
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +16 -5
- data/lib/datadog/tracing/contrib/grape/configuration/settings.rb +8 -6
- data/lib/datadog/tracing/contrib/grape/ext.rb +16 -14
- data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +8 -6
- data/lib/datadog/tracing/contrib/graphql/ext.rb +7 -5
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +19 -9
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +29 -20
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +21 -20
- data/lib/datadog/tracing/contrib/grpc/ext.rb +16 -13
- data/lib/datadog/tracing/contrib/grpc/formatting.rb +127 -0
- data/lib/datadog/tracing/contrib/hanami/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/hanami/ext.rb +10 -8
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +4 -7
- data/lib/datadog/tracing/contrib/http/configuration/settings.rb +33 -11
- data/lib/datadog/tracing/contrib/http/ext.rb +16 -9
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +22 -7
- data/lib/datadog/tracing/contrib/httpclient/configuration/settings.rb +33 -11
- data/lib/datadog/tracing/contrib/httpclient/ext.rb +17 -9
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +17 -5
- data/lib/datadog/tracing/contrib/httprb/configuration/settings.rb +33 -11
- data/lib/datadog/tracing/contrib/httprb/ext.rb +16 -9
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +17 -5
- data/lib/datadog/tracing/contrib/kafka/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/kafka/ext.rb +42 -39
- data/lib/datadog/tracing/contrib/lograge/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/lograge/ext.rb +3 -1
- data/lib/datadog/tracing/contrib/lograge/instrumentation.rb +1 -0
- data/lib/datadog/tracing/contrib/mongodb/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/mongodb/ext.rb +20 -16
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +9 -5
- data/lib/datadog/tracing/contrib/mysql2/configuration/settings.rb +17 -14
- data/lib/datadog/tracing/contrib/mysql2/ext.rb +15 -10
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/opensearch/configuration/settings.rb +52 -0
- data/lib/datadog/tracing/contrib/opensearch/ext.rb +37 -0
- data/lib/datadog/tracing/contrib/opensearch/integration.rb +44 -0
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +128 -0
- data/lib/datadog/tracing/contrib/opensearch/quantize.rb +81 -0
- data/lib/datadog/tracing/contrib/pg/configuration/settings.rb +17 -14
- data/lib/datadog/tracing/contrib/pg/ext.rb +22 -19
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/presto/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/presto/ext.rb +25 -20
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +9 -5
- data/lib/datadog/tracing/contrib/propagation/sql_comment/ext.rb +12 -10
- data/lib/datadog/tracing/contrib/qless/configuration/settings.rb +12 -8
- data/lib/datadog/tracing/contrib/qless/ext.rb +14 -12
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +21 -12
- data/lib/datadog/tracing/contrib/racecar/configuration/settings.rb +9 -7
- data/lib/datadog/tracing/contrib/racecar/event.rb +0 -5
- data/lib/datadog/tracing/contrib/racecar/ext.rb +20 -18
- data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +16 -12
- data/lib/datadog/tracing/contrib/rack/ext.rb +18 -16
- data/lib/datadog/tracing/contrib/rack/header_collection.rb +3 -0
- data/lib/datadog/tracing/contrib/rack/header_tagging.rb +53 -0
- data/lib/datadog/tracing/contrib/rack/middlewares.rb +8 -49
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +15 -11
- data/lib/datadog/tracing/contrib/rails/ext.rb +7 -5
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +7 -10
- data/lib/datadog/tracing/contrib/rails/patcher.rb +10 -41
- data/lib/datadog/tracing/contrib/rails/railtie.rb +3 -3
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +12 -9
- data/lib/datadog/tracing/contrib/rake/ext.rb +14 -12
- data/lib/datadog/tracing/contrib/redis/configuration/settings.rb +17 -9
- data/lib/datadog/tracing/contrib/redis/ext.rb +22 -15
- data/lib/datadog/tracing/contrib/redis/tags.rb +9 -5
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +13 -7
- data/lib/datadog/tracing/contrib/resque/ext.rb +9 -7
- data/lib/datadog/tracing/contrib/rest_client/configuration/settings.rb +16 -9
- data/lib/datadog/tracing/contrib/rest_client/ext.rb +15 -8
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +20 -5
- data/lib/datadog/tracing/contrib/roda/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/semantic_logger/configuration/settings.rb +3 -2
- data/lib/datadog/tracing/contrib/semantic_logger/ext.rb +3 -1
- data/lib/datadog/tracing/contrib/semantic_logger/instrumentation.rb +1 -0
- data/lib/datadog/tracing/contrib/sequel/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/sequel/ext.rb +10 -8
- data/lib/datadog/tracing/contrib/sequel/utils.rb +2 -7
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +14 -8
- data/lib/datadog/tracing/contrib/shoryuken/ext.rb +14 -12
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +18 -11
- data/lib/datadog/tracing/contrib/sidekiq/ext.rb +32 -30
- data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +11 -9
- data/lib/datadog/tracing/contrib/sinatra/env.rb +0 -17
- data/lib/datadog/tracing/contrib/sinatra/ext.rb +21 -19
- data/lib/datadog/tracing/contrib/sinatra/tracer_middleware.rb +3 -14
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +14 -8
- data/lib/datadog/tracing/contrib/sneakers/ext.rb +1 -0
- data/lib/datadog/tracing/contrib/sneakers/tracer.rb +1 -1
- data/lib/datadog/tracing/contrib/span_attribute_schema.rb +74 -10
- data/lib/datadog/tracing/contrib/stripe/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/sucker_punch/configuration/settings.rb +9 -6
- data/lib/datadog/tracing/contrib/sucker_punch/ext.rb +15 -13
- data/lib/datadog/tracing/contrib/utils/database.rb +5 -3
- data/lib/datadog/tracing/contrib.rb +1 -0
- data/lib/datadog/tracing/correlation.rb +9 -12
- data/lib/datadog/tracing/diagnostics/ext.rb +21 -19
- data/lib/datadog/tracing/distributed/b3_multi.rb +2 -2
- data/lib/datadog/tracing/distributed/b3_single.rb +1 -1
- data/lib/datadog/tracing/distributed/trace_context.rb +52 -17
- data/lib/datadog/tracing/metadata/ext.rb +9 -6
- data/lib/datadog/tracing/remote.rb +78 -0
- data/lib/datadog/tracing/sampling/rule_sampler.rb +29 -0
- data/lib/datadog/tracing/span_operation.rb +3 -15
- data/lib/datadog/tracing/trace_operation.rb +16 -3
- data/lib/datadog/tracing/trace_segment.rb +5 -2
- data/lib/datadog/tracing/tracer.rb +10 -1
- data/lib/ddtrace/transport/ext.rb +15 -9
- data/lib/ddtrace/transport/trace_formatter.rb +9 -0
- data/lib/ddtrace/version.rb +8 -11
- metadata +36 -7
- data/lib/datadog/tracing/contrib/sinatra/headers.rb +0 -35
@@ -0,0 +1,128 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../../metadata/ext'
|
4
|
+
require_relative '../analytics'
|
5
|
+
require_relative 'ext'
|
6
|
+
require_relative '../ext'
|
7
|
+
require_relative '../integration'
|
8
|
+
require_relative '../patcher'
|
9
|
+
|
10
|
+
module Datadog
|
11
|
+
module Tracing
|
12
|
+
module Contrib
|
13
|
+
module OpenSearch
|
14
|
+
# Patcher enables patching of 'opensearch' module.
|
15
|
+
module Patcher
|
16
|
+
include Contrib::Patcher
|
17
|
+
|
18
|
+
module_function
|
19
|
+
|
20
|
+
def patch
|
21
|
+
require 'uri'
|
22
|
+
require 'json'
|
23
|
+
require_relative 'quantize'
|
24
|
+
|
25
|
+
::OpenSearch::Transport::Client.prepend(Client)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Patches OpenSearch::Transport::Client module
|
29
|
+
module Client
|
30
|
+
# rubocop:disable Metrics/MethodLength
|
31
|
+
def perform_request(method, path, params = {}, body = nil, headers = nil)
|
32
|
+
response = nil
|
33
|
+
# rubocop:disable Metrics/BlockLength
|
34
|
+
Tracing.trace('opensearch.query', service: datadog_configuration[:service_name]) do |span|
|
35
|
+
begin
|
36
|
+
# Set generic tags
|
37
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
38
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
39
|
+
span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM)
|
40
|
+
|
41
|
+
# Set argument tags
|
42
|
+
span.set_tag(OpenSearch::Ext::TAG_METHOD, method)
|
43
|
+
span.set_tag(OpenSearch::Ext::TAG_PATH, path)
|
44
|
+
|
45
|
+
tag_params(params, span)
|
46
|
+
tag_body(body, span)
|
47
|
+
|
48
|
+
# Parse url
|
49
|
+
original_url = transport.get_connection.full_url(path, {})
|
50
|
+
url = URI.parse(original_url)
|
51
|
+
host = url.host
|
52
|
+
port = url.port
|
53
|
+
scheme = url.scheme
|
54
|
+
# Set url.user to nil to remove sensitive information (i.e. user's username and password)
|
55
|
+
url.user = nil
|
56
|
+
|
57
|
+
if datadog_configuration[:peer_service]
|
58
|
+
span.set_tag(
|
59
|
+
Tracing::Metadata::Ext::TAG_PEER_SERVICE,
|
60
|
+
datadog_configuration[:peer_service]
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Set url tags
|
65
|
+
span.set_tag(OpenSearch::Ext::TAG_URL, url)
|
66
|
+
span.set_tag(OpenSearch::Ext::TAG_HOST, host)
|
67
|
+
span.set_tag(OpenSearch::Ext::TAG_PORT, port)
|
68
|
+
span.set_tag(OpenSearch::Ext::TAG_SCHEME, scheme)
|
69
|
+
|
70
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_PEER_HOSTNAME, host) if host
|
71
|
+
|
72
|
+
# Define span resource
|
73
|
+
quantized_url = OpenSearch::Quantize.format_url(url)
|
74
|
+
span.resource = "#{method} #{quantized_url}"
|
75
|
+
Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
|
76
|
+
rescue StandardError => e
|
77
|
+
Datadog.logger.error(e.message)
|
78
|
+
ensure
|
79
|
+
begin
|
80
|
+
response = super
|
81
|
+
rescue => e
|
82
|
+
status_code = ::OpenSearch::Transport::Transport::ERRORS.key(e.class)
|
83
|
+
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, status_code) if status_code
|
84
|
+
raise
|
85
|
+
end
|
86
|
+
# Set post-response tags
|
87
|
+
span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, response.status)
|
88
|
+
if response.headers['content-length']
|
89
|
+
span.set_tag(
|
90
|
+
OpenSearch::Ext::TAG_RESPONSE_CONTENT_LENGTH,
|
91
|
+
response.headers['content-length'].to_i
|
92
|
+
)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
# rubocop:enable Metrics/BlockLength
|
97
|
+
response
|
98
|
+
end
|
99
|
+
|
100
|
+
def tag_params(params, span)
|
101
|
+
return unless params
|
102
|
+
|
103
|
+
params = JSON.generate(params) unless params.is_a?(String)
|
104
|
+
span.set_tag(OpenSearch::Ext::TAG_PARAMS, params)
|
105
|
+
end
|
106
|
+
|
107
|
+
def tag_body(body, span)
|
108
|
+
return unless body
|
109
|
+
|
110
|
+
body = JSON.generate(body) unless body.is_a?(String)
|
111
|
+
quantize_options = datadog_configuration[:quantize]
|
112
|
+
quantized_body = OpenSearch::Quantize.format_body(
|
113
|
+
body,
|
114
|
+
quantize_options
|
115
|
+
)
|
116
|
+
span.set_tag(OpenSearch::Ext::TAG_BODY, quantized_body)
|
117
|
+
end
|
118
|
+
|
119
|
+
def datadog_configuration
|
120
|
+
Datadog.configuration.tracing[:opensearch]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
# rubocop:enable Metrics/MethodLength
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../utils/quantization/hash'
|
4
|
+
|
5
|
+
module Datadog
|
6
|
+
module Tracing
|
7
|
+
module Contrib
|
8
|
+
module OpenSearch
|
9
|
+
# Removes sensitive data from OpenSearch strings (i.e. url and body).
|
10
|
+
module Quantize
|
11
|
+
PLACEHOLDER = '/?'
|
12
|
+
DEFAULT_PLACEHOLDER = '?'
|
13
|
+
EXCLUDE_KEYS = [].freeze
|
14
|
+
SHOW_KEYS = [:_index, :_type, :_id].freeze
|
15
|
+
DEFAULT_OPTIONS = {
|
16
|
+
exclude: EXCLUDE_KEYS,
|
17
|
+
show: SHOW_KEYS,
|
18
|
+
placeholder: PLACEHOLDER
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
module_function
|
22
|
+
|
23
|
+
def format_url(url)
|
24
|
+
# Url does not contain path, so just replace last digit(s) with '?' if '/' precedes the digit(s)
|
25
|
+
url.to_s.gsub(%r{/\d+$}, PLACEHOLDER)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Use Elasticsearch implementation
|
29
|
+
def format_body(body, options = {})
|
30
|
+
format_body!(body, options)
|
31
|
+
rescue StandardError
|
32
|
+
options[:placeholder] || DEFAULT_PLACEHOLDER
|
33
|
+
end
|
34
|
+
|
35
|
+
def format_body!(body, options = {})
|
36
|
+
options = merge_options(DEFAULT_OPTIONS, options)
|
37
|
+
|
38
|
+
# Determine if bulk query or not, based on content
|
39
|
+
statements = body.end_with?("\n") ? body.split("\n") : [body]
|
40
|
+
|
41
|
+
# Parse each statement and quantize them.
|
42
|
+
statements.collect do |string|
|
43
|
+
reserialize_json(string, options[:placeholder]) do |obj|
|
44
|
+
Contrib::Utils::Quantization::Hash.format(obj, options)
|
45
|
+
end
|
46
|
+
end.join("\n")
|
47
|
+
end
|
48
|
+
|
49
|
+
def merge_options(original, additional)
|
50
|
+
{}.tap do |options|
|
51
|
+
# Show
|
52
|
+
# If either is :all, value becomes :all
|
53
|
+
options[:show] = if original[:show] == :all || additional[:show] == :all
|
54
|
+
:all
|
55
|
+
else
|
56
|
+
(original[:show] || []).dup.concat(additional[:show] || []).uniq
|
57
|
+
end
|
58
|
+
|
59
|
+
# Exclude
|
60
|
+
options[:exclude] = (original[:exclude] || []).dup.concat(additional[:exclude] || []).uniq
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# Parses a JSON object from a string, passes its value
|
65
|
+
# to the block provided, and dumps its result back to JSON.
|
66
|
+
# If JSON parsing fails, it prints fail_value.
|
67
|
+
def reserialize_json(string, fail_value = DEFAULT_PLACEHOLDER)
|
68
|
+
return string unless block_given?
|
69
|
+
|
70
|
+
begin
|
71
|
+
JSON.dump(yield(JSON.parse(string)))
|
72
|
+
rescue JSON::ParserError
|
73
|
+
# If it can't parse/dump, don't raise an error.
|
74
|
+
fail_value
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -14,18 +14,21 @@ module Datadog
|
|
14
14
|
# @public_api
|
15
15
|
class Settings < Contrib::Configuration::Settings
|
16
16
|
option :enabled do |o|
|
17
|
-
o.
|
18
|
-
o.
|
17
|
+
o.type :bool
|
18
|
+
o.env Ext::ENV_ENABLED
|
19
|
+
o.default true
|
19
20
|
end
|
20
21
|
|
21
22
|
option :analytics_enabled do |o|
|
22
|
-
o.
|
23
|
-
o.
|
23
|
+
o.type :bool
|
24
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
25
|
+
o.default false
|
24
26
|
end
|
25
27
|
|
26
28
|
option :analytics_sample_rate do |o|
|
27
|
-
o.
|
28
|
-
o.
|
29
|
+
o.type :float
|
30
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
31
|
+
o.default 1.0
|
29
32
|
end
|
30
33
|
|
31
34
|
option :service_name do |o|
|
@@ -35,17 +38,17 @@ module Datadog
|
|
35
38
|
Ext::DEFAULT_PEER_SERVICE_NAME
|
36
39
|
)
|
37
40
|
end
|
38
|
-
o.lazy
|
39
41
|
end
|
40
42
|
|
41
43
|
option :comment_propagation do |o|
|
42
|
-
o.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
o.
|
44
|
+
o.type :string
|
45
|
+
o.env Contrib::Propagation::SqlComment::Ext::ENV_DBM_PROPAGATION_MODE
|
46
|
+
o.default Contrib::Propagation::SqlComment::Ext::DISABLED
|
47
|
+
end
|
48
|
+
|
49
|
+
option :peer_service do |o|
|
50
|
+
o.type :string, nilable: true
|
51
|
+
o.env Ext::ENV_PEER_SERVICE
|
49
52
|
end
|
50
53
|
end
|
51
54
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,25 +7,26 @@ module Datadog
|
|
5
7
|
# pg integration constants
|
6
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
7
9
|
module Ext
|
8
|
-
ENV_ENABLED = 'DD_TRACE_PG_ENABLED'
|
9
|
-
ENV_SERVICE_NAME = 'DD_TRACE_PG_SERVICE_NAME'
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
TAG_SYSTEM = 'postgresql'
|
10
|
+
ENV_ENABLED = 'DD_TRACE_PG_ENABLED'
|
11
|
+
ENV_SERVICE_NAME = 'DD_TRACE_PG_SERVICE_NAME'
|
12
|
+
ENV_PEER_SERVICE = 'DD_TRACE_PG_PEER_SERVICE'
|
13
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_PG_ANALYTICS_ENABLED'
|
14
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_PG_ANALYTICS_SAMPLE_RATE'
|
15
|
+
DEFAULT_PEER_SERVICE_NAME = 'pg'
|
16
|
+
SPAN_EXEC = 'pg.exec'
|
17
|
+
SPAN_EXEC_PARAMS = 'pg.exec.params'
|
18
|
+
SPAN_EXEC_PREPARED = 'pg.exec.prepared'
|
19
|
+
SPAN_ASYNC_EXEC = 'pg.async.exec'
|
20
|
+
SPAN_ASYNC_EXEC_PARAMS = 'pg.async.exec.params'
|
21
|
+
SPAN_ASYNC_EXEC_PREPARED = 'pg.async.exec.prepared'
|
22
|
+
SPAN_SYNC_EXEC = 'pg.sync.exec'
|
23
|
+
SPAN_SYNC_EXEC_PARAMS = 'pg.sync.exec.params'
|
24
|
+
SPAN_SYNC_EXEC_PREPARED = 'pg.sync.exec.prepared'
|
25
|
+
TAG_DB_NAME = 'pg.db.name'
|
26
|
+
TAG_COMPONENT = 'pg'
|
27
|
+
TAG_OPERATION_QUERY = 'query'
|
28
|
+
TAG_SYSTEM = 'postgresql'
|
29
|
+
PEER_SERVICE_SOURCES = Contrib::Ext::DB::PEER_SERVICE_SOURCES.freeze
|
27
30
|
end
|
28
31
|
end
|
29
32
|
end
|
@@ -122,15 +122,17 @@ module Datadog
|
|
122
122
|
def annotate_span_with_query!(span, service)
|
123
123
|
span.set_tag(Ext::TAG_DB_NAME, db)
|
124
124
|
|
125
|
+
if datadog_configuration[:peer_service]
|
126
|
+
span.set_tag(
|
127
|
+
Tracing::Metadata::Ext::TAG_PEER_SERVICE,
|
128
|
+
datadog_configuration[:peer_service]
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
125
132
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
126
133
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_QUERY)
|
127
134
|
span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_CLIENT)
|
128
135
|
|
129
|
-
if Contrib::SpanAttributeSchema.default_span_attribute_schema?
|
130
|
-
# Tag as an external peer service
|
131
|
-
span.set_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE, span.service)
|
132
|
-
end
|
133
|
-
|
134
136
|
span.set_tag(Tracing::Metadata::Ext::TAG_PEER_HOSTNAME, host)
|
135
137
|
|
136
138
|
span.set_tag(Contrib::Ext::DB::TAG_INSTANCE, db)
|
@@ -141,6 +143,8 @@ module Datadog
|
|
141
143
|
span.set_tag(Tracing::Metadata::Ext::NET::TAG_TARGET_PORT, port)
|
142
144
|
span.set_tag(Tracing::Metadata::Ext::NET::TAG_DESTINATION_NAME, host)
|
143
145
|
span.set_tag(Tracing::Metadata::Ext::NET::TAG_DESTINATION_PORT, port)
|
146
|
+
|
147
|
+
Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
|
144
148
|
end
|
145
149
|
|
146
150
|
# @param [PG::Result] result
|
@@ -12,18 +12,21 @@ module Datadog
|
|
12
12
|
# @public_api
|
13
13
|
class Settings < Contrib::Configuration::Settings
|
14
14
|
option :enabled do |o|
|
15
|
-
o.
|
16
|
-
o.
|
15
|
+
o.type :bool
|
16
|
+
o.env Ext::ENV_ENABLED
|
17
|
+
o.default true
|
17
18
|
end
|
18
19
|
|
19
20
|
option :analytics_enabled do |o|
|
20
|
-
o.
|
21
|
-
o.
|
21
|
+
o.type :bool
|
22
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
23
|
+
o.default false
|
22
24
|
end
|
23
25
|
|
24
26
|
option :analytics_sample_rate do |o|
|
25
|
-
o.
|
26
|
-
o.
|
27
|
+
o.type :float
|
28
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
29
|
+
o.default 1.0
|
27
30
|
end
|
28
31
|
|
29
32
|
option :service_name do |o|
|
@@ -33,7 +36,11 @@ module Datadog
|
|
33
36
|
Ext::DEFAULT_PEER_SERVICE_NAME
|
34
37
|
)
|
35
38
|
end
|
36
|
-
|
39
|
+
end
|
40
|
+
|
41
|
+
option :peer_service do |o|
|
42
|
+
o.type :string, nilable: true
|
43
|
+
o.env Ext::ENV_PEER_SERVICE
|
37
44
|
end
|
38
45
|
end
|
39
46
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,26 +7,29 @@ module Datadog
|
|
5
7
|
# Presto integration constants
|
6
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
7
9
|
module Ext
|
8
|
-
ENV_ENABLED = 'DD_TRACE_PRESTO_ENABLED'
|
9
|
-
ENV_SERVICE_NAME = 'DD_TRACE_PRESTO_SERVICE_NAME'
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
10
|
+
ENV_ENABLED = 'DD_TRACE_PRESTO_ENABLED'
|
11
|
+
ENV_SERVICE_NAME = 'DD_TRACE_PRESTO_SERVICE_NAME'
|
12
|
+
ENV_PEER_SERVICE = 'DD_TRACE_PRESTO_PEER_SERVICE'
|
13
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_PRESTO_ANALYTICS_ENABLED'
|
14
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_PRESTO_ANALYTICS_SAMPLE_RATE'
|
15
|
+
DEFAULT_PEER_SERVICE_NAME = 'presto'
|
16
|
+
SPAN_QUERY = 'presto.query'
|
17
|
+
SPAN_KILL = 'presto.kill_query'
|
18
|
+
TAG_SCHEMA_NAME = 'presto.schema'
|
19
|
+
TAG_CATALOG_NAME = 'presto.catalog'
|
20
|
+
TAG_USER_NAME = 'presto.user'
|
21
|
+
TAG_TIME_ZONE = 'presto.time_zone'
|
22
|
+
TAG_LANGUAGE = 'presto.language'
|
23
|
+
TAG_PROXY = 'presto.http_proxy'
|
24
|
+
TAG_MODEL_VERSION = 'presto.model_version'
|
25
|
+
TAG_QUERY_ID = 'presto.query.id'
|
26
|
+
TAG_QUERY_ASYNC = 'presto.query.async'
|
27
|
+
TAG_COMPONENT = 'presto'
|
28
|
+
TAG_OPERATION_QUERY = 'query'
|
29
|
+
TAG_OPERATION_KILL = 'kill'
|
30
|
+
TAG_SYSTEM = 'presto'
|
31
|
+
PEER_SERVICE_SOURCES = (Array[Ext::TAG_SCHEMA_NAME] +
|
32
|
+
Contrib::Ext::DB::PEER_SERVICE_SOURCES).freeze
|
28
33
|
end
|
29
34
|
end
|
30
35
|
end
|
@@ -83,6 +83,13 @@ module Datadog
|
|
83
83
|
|
84
84
|
span.set_tag(Contrib::Ext::DB::TAG_SYSTEM, Ext::TAG_SYSTEM)
|
85
85
|
|
86
|
+
if datadog_configuration[:peer_service]
|
87
|
+
span.set_tag(
|
88
|
+
Tracing::Metadata::Ext::TAG_PEER_SERVICE,
|
89
|
+
datadog_configuration[:peer_service]
|
90
|
+
)
|
91
|
+
end
|
92
|
+
|
86
93
|
if (host_port = @options[:server])
|
87
94
|
host, port = Core::Utils.extract_host_port(host_port)
|
88
95
|
if host && port
|
@@ -104,15 +111,12 @@ module Datadog
|
|
104
111
|
set_nilable_tag!(span, :http_proxy, Ext::TAG_PROXY)
|
105
112
|
set_nilable_tag!(span, :model_version, Ext::TAG_MODEL_VERSION)
|
106
113
|
|
107
|
-
if Contrib::SpanAttributeSchema.default_span_attribute_schema?
|
108
|
-
# Tag as an external peer service
|
109
|
-
span.set_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE, span.service)
|
110
|
-
end
|
111
|
-
|
112
114
|
# Set analytics sample rate
|
113
115
|
if Contrib::Analytics.enabled?(datadog_configuration[:analytics_enabled])
|
114
116
|
Contrib::Analytics.set_sample_rate(span, datadog_configuration[:analytics_sample_rate])
|
115
117
|
end
|
118
|
+
|
119
|
+
Contrib::SpanAttributeSchema.set_peer_service!(span, Ext::PEER_SERVICE_SOURCES)
|
116
120
|
end
|
117
121
|
|
118
122
|
def set_nilable_tag!(span, key, tag_name)
|
@@ -1,28 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
4
6
|
module Propagation
|
5
7
|
module SqlComment
|
6
8
|
module Ext
|
7
|
-
ENV_DBM_PROPAGATION_MODE = 'DD_DBM_PROPAGATION_MODE'
|
9
|
+
ENV_DBM_PROPAGATION_MODE = 'DD_DBM_PROPAGATION_MODE'
|
8
10
|
|
9
11
|
# The default mode for sql comment propagation
|
10
|
-
DISABLED = 'disabled'
|
12
|
+
DISABLED = 'disabled'
|
11
13
|
|
12
14
|
# The `service` mode propagates service configuration
|
13
|
-
SERVICE = 'service'
|
15
|
+
SERVICE = 'service'
|
14
16
|
|
15
17
|
# The `full` mode propagates service configuration + trace context
|
16
|
-
FULL = 'full'
|
18
|
+
FULL = 'full'
|
17
19
|
|
18
20
|
# The value should be `true` when `full` mode
|
19
|
-
TAG_DBM_TRACE_INJECTED = '_dd.dbm_trace_injected'
|
21
|
+
TAG_DBM_TRACE_INJECTED = '_dd.dbm_trace_injected'
|
20
22
|
|
21
|
-
KEY_DATABASE_SERVICE = 'dddbs'
|
22
|
-
KEY_ENVIRONMENT = 'dde'
|
23
|
-
KEY_PARENT_SERVICE = 'ddps'
|
24
|
-
KEY_VERSION = 'ddpv'
|
25
|
-
KEY_TRACEPARENT = 'traceparent'
|
23
|
+
KEY_DATABASE_SERVICE = 'dddbs'
|
24
|
+
KEY_ENVIRONMENT = 'dde'
|
25
|
+
KEY_PARENT_SERVICE = 'ddps'
|
26
|
+
KEY_VERSION = 'ddpv'
|
27
|
+
KEY_TRACEPARENT = 'traceparent'
|
26
28
|
end
|
27
29
|
end
|
28
30
|
end
|
@@ -12,23 +12,27 @@ module Datadog
|
|
12
12
|
# @public_api
|
13
13
|
class Settings < Contrib::Configuration::Settings
|
14
14
|
option :analytics_enabled do |o|
|
15
|
-
o.
|
16
|
-
o.
|
15
|
+
o.type :bool
|
16
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
17
|
+
o.default false
|
17
18
|
end
|
18
19
|
|
19
20
|
option :analytics_sample_rate do |o|
|
20
|
-
o.
|
21
|
-
o.
|
21
|
+
o.type :float
|
22
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
23
|
+
o.default 1.0
|
22
24
|
end
|
23
25
|
|
24
26
|
option :tag_job_data do |o|
|
25
|
-
o.
|
26
|
-
o.
|
27
|
+
o.type :bool
|
28
|
+
o.env Ext::ENV_TAG_JOB_DATA
|
29
|
+
o.default false
|
27
30
|
end
|
28
31
|
|
29
32
|
option :tag_job_tags do |o|
|
30
|
-
o.
|
31
|
-
o.
|
33
|
+
o.type :bool
|
34
|
+
o.env Ext::ENV_TAG_JOB_TAGS
|
35
|
+
o.default false
|
32
36
|
end
|
33
37
|
|
34
38
|
option :service_name
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,18 +7,18 @@ module Datadog
|
|
5
7
|
# Qless integration constants
|
6
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
7
9
|
module Ext
|
8
|
-
ENV_ANALYTICS_ENABLED = 'DD_TRACE_QLESS_ANALYTICS_ENABLED'
|
9
|
-
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_QLESS_ANALYTICS_SAMPLE_RATE'
|
10
|
-
ENV_TAG_JOB_DATA = 'DD_QLESS_TAG_JOB_DATA'
|
11
|
-
ENV_TAG_JOB_TAGS = 'DD_QLESS_TAG_JOB_TAGS'
|
12
|
-
SERVICE_NAME = 'qless'
|
13
|
-
SPAN_JOB = 'qless.job'
|
14
|
-
TAG_JOB_ID = 'qless.job.id'
|
15
|
-
TAG_JOB_DATA = 'qless.job.data'
|
16
|
-
TAG_JOB_QUEUE = 'qless.job.queue'
|
17
|
-
TAG_JOB_TAGS = 'qless.job.tags'
|
18
|
-
TAG_COMPONENT = 'qless'
|
19
|
-
TAG_OPERATION_JOB = 'job'
|
10
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_QLESS_ANALYTICS_ENABLED'
|
11
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_QLESS_ANALYTICS_SAMPLE_RATE'
|
12
|
+
ENV_TAG_JOB_DATA = 'DD_QLESS_TAG_JOB_DATA'
|
13
|
+
ENV_TAG_JOB_TAGS = 'DD_QLESS_TAG_JOB_TAGS'
|
14
|
+
SERVICE_NAME = 'qless'
|
15
|
+
SPAN_JOB = 'qless.job'
|
16
|
+
TAG_JOB_ID = 'qless.job.id'
|
17
|
+
TAG_JOB_DATA = 'qless.job.data'
|
18
|
+
TAG_JOB_QUEUE = 'qless.job.queue'
|
19
|
+
TAG_JOB_TAGS = 'qless.job.tags'
|
20
|
+
TAG_COMPONENT = 'qless'
|
21
|
+
TAG_OPERATION_JOB = 'job'
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -12,33 +12,42 @@ module Datadog
|
|
12
12
|
# Default settings for the Que integration
|
13
13
|
class Settings < Contrib::Configuration::Settings
|
14
14
|
option :service_name
|
15
|
-
option :distributed_tracing, default: true
|
15
|
+
option :distributed_tracing, default: true, type: :bool
|
16
16
|
|
17
17
|
option :enabled do |o|
|
18
|
-
o.
|
19
|
-
o.
|
18
|
+
o.type :bool
|
19
|
+
o.env Ext::ENV_ENABLED
|
20
|
+
o.default true
|
20
21
|
end
|
21
22
|
|
22
23
|
option :analytics_enabled do |o|
|
23
|
-
o.
|
24
|
-
o.
|
24
|
+
o.type :bool
|
25
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
26
|
+
o.default false
|
25
27
|
end
|
26
28
|
|
27
29
|
option :analytics_sample_rate do |o|
|
28
|
-
o.
|
29
|
-
o.
|
30
|
+
o.type :float
|
31
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
32
|
+
o.default 1.0
|
30
33
|
end
|
31
34
|
|
32
35
|
option :tag_args do |o|
|
33
|
-
o.
|
34
|
-
o.
|
36
|
+
o.type :bool
|
37
|
+
o.env Ext::ENV_TAG_ARGS_ENABLED
|
38
|
+
o.default false
|
35
39
|
end
|
36
40
|
|
37
41
|
option :tag_data do |o|
|
38
|
-
o.
|
39
|
-
o.
|
42
|
+
o.type :bool
|
43
|
+
o.env Ext::ENV_TAG_DATA_ENABLED
|
44
|
+
o.default false
|
45
|
+
end
|
46
|
+
|
47
|
+
option :error_handler do |o|
|
48
|
+
o.type :proc
|
49
|
+
o.experimental_default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
40
50
|
end
|
41
|
-
option :error_handler, default: Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
|
42
51
|
end
|
43
52
|
end
|
44
53
|
end
|