ddtrace 1.12.1 → 1.13.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 +109 -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/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 +116 -61
- 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 +4 -1
- 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 +17 -5
- 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 +4 -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/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 +9 -12
- metadata +38 -10
- data/lib/datadog/tracing/contrib/sinatra/headers.rb +0 -35
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,36 +7,36 @@ module Datadog
|
|
5
7
|
# Sidekiq integration constants
|
6
8
|
# @public_api Changing resource names, tag names, or environment variables creates breaking changes.
|
7
9
|
module Ext
|
8
|
-
CLIENT_SERVICE_NAME = 'sidekiq-client'
|
9
|
-
ENV_ENABLED = 'DD_TRACE_SIDEKIQ_ENABLED'
|
10
|
-
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SIDEKIQ_ANALYTICS_ENABLED'
|
11
|
-
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SIDEKIQ_ANALYTICS_SAMPLE_RATE'
|
12
|
-
ENV_TAG_JOB_ARGS = 'DD_SIDEKIQ_TAG_JOB_ARGS'
|
13
|
-
SERVICE_NAME = 'sidekiq'
|
14
|
-
SPAN_PUSH = 'sidekiq.push'
|
15
|
-
SPAN_JOB = 'sidekiq.job'
|
16
|
-
SPAN_JOB_FETCH = 'sidekiq.job_fetch'
|
17
|
-
SPAN_REDIS_INFO = 'sidekiq.redis_info'
|
18
|
-
SPAN_HEARTBEAT = 'sidekiq.heartbeat'
|
19
|
-
SPAN_SCHEDULED_PUSH = 'sidekiq.scheduled_push'
|
20
|
-
SPAN_SCHEDULED_WAIT = 'sidekiq.scheduled_poller_wait'
|
21
|
-
SPAN_STOP = 'sidekiq.stop'
|
22
|
-
TAG_JOB_DELAY = 'sidekiq.job.delay'
|
23
|
-
TAG_JOB_ID = 'sidekiq.job.id'
|
24
|
-
TAG_JOB_QUEUE = 'sidekiq.job.queue'
|
25
|
-
TAG_JOB_RETRY = 'sidekiq.job.retry'
|
26
|
-
TAG_JOB_RETRY_COUNT = 'sidekiq.job.retry_count'
|
27
|
-
TAG_JOB_WRAPPER = 'sidekiq.job.wrapper'
|
28
|
-
TAG_JOB_ARGS = 'sidekiq.job.args'
|
29
|
-
TAG_COMPONENT = 'sidekiq'
|
30
|
-
TAG_OPERATION_PUSH = 'push'
|
31
|
-
TAG_OPERATION_JOB = 'job'
|
32
|
-
TAG_OPERATION_JOB_FETCH = 'job_fetch'
|
33
|
-
TAG_OPERATION_REDIS_INFO = 'redis_info'
|
34
|
-
TAG_OPERATION_HEARTBEAT = 'heartbeat'
|
35
|
-
TAG_OPERATION_SCHEDULED_PUSH = 'scheduled_push'
|
36
|
-
TAG_OPERATION_SCHEDULED_WAIT = 'scheduled_poller_wait'
|
37
|
-
TAG_OPERATION_STOP = 'stop'
|
10
|
+
CLIENT_SERVICE_NAME = 'sidekiq-client'
|
11
|
+
ENV_ENABLED = 'DD_TRACE_SIDEKIQ_ENABLED'
|
12
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SIDEKIQ_ANALYTICS_ENABLED'
|
13
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SIDEKIQ_ANALYTICS_SAMPLE_RATE'
|
14
|
+
ENV_TAG_JOB_ARGS = 'DD_SIDEKIQ_TAG_JOB_ARGS'
|
15
|
+
SERVICE_NAME = 'sidekiq'
|
16
|
+
SPAN_PUSH = 'sidekiq.push'
|
17
|
+
SPAN_JOB = 'sidekiq.job'
|
18
|
+
SPAN_JOB_FETCH = 'sidekiq.job_fetch'
|
19
|
+
SPAN_REDIS_INFO = 'sidekiq.redis_info'
|
20
|
+
SPAN_HEARTBEAT = 'sidekiq.heartbeat'
|
21
|
+
SPAN_SCHEDULED_PUSH = 'sidekiq.scheduled_push'
|
22
|
+
SPAN_SCHEDULED_WAIT = 'sidekiq.scheduled_poller_wait'
|
23
|
+
SPAN_STOP = 'sidekiq.stop'
|
24
|
+
TAG_JOB_DELAY = 'sidekiq.job.delay'
|
25
|
+
TAG_JOB_ID = 'sidekiq.job.id'
|
26
|
+
TAG_JOB_QUEUE = 'sidekiq.job.queue'
|
27
|
+
TAG_JOB_RETRY = 'sidekiq.job.retry'
|
28
|
+
TAG_JOB_RETRY_COUNT = 'sidekiq.job.retry_count'
|
29
|
+
TAG_JOB_WRAPPER = 'sidekiq.job.wrapper'
|
30
|
+
TAG_JOB_ARGS = 'sidekiq.job.args'
|
31
|
+
TAG_COMPONENT = 'sidekiq'
|
32
|
+
TAG_OPERATION_PUSH = 'push'
|
33
|
+
TAG_OPERATION_JOB = 'job'
|
34
|
+
TAG_OPERATION_JOB_FETCH = 'job_fetch'
|
35
|
+
TAG_OPERATION_REDIS_INFO = 'redis_info'
|
36
|
+
TAG_OPERATION_HEARTBEAT = 'heartbeat'
|
37
|
+
TAG_OPERATION_SCHEDULED_PUSH = 'scheduled_push'
|
38
|
+
TAG_OPERATION_SCHEDULED_WAIT = 'scheduled_poller_wait'
|
39
|
+
TAG_OPERATION_STOP = 'stop'
|
38
40
|
end
|
39
41
|
end
|
40
42
|
end
|
@@ -14,23 +14,25 @@ module Datadog
|
|
14
14
|
}.freeze
|
15
15
|
|
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, nilable: true
|
24
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
24
25
|
end
|
25
26
|
|
26
27
|
option :analytics_sample_rate do |o|
|
27
|
-
o.
|
28
|
-
o.
|
28
|
+
o.type :float
|
29
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
30
|
+
o.default 1.0
|
29
31
|
end
|
30
32
|
|
31
|
-
option :distributed_tracing, default: true
|
32
|
-
option :headers, default: DEFAULT_HEADERS
|
33
|
-
option :resource_script_names, default: false
|
33
|
+
option :distributed_tracing, default: true, type: :bool
|
34
|
+
option :headers, default: DEFAULT_HEADERS, type: :hash
|
35
|
+
option :resource_script_names, default: false, type: :bool
|
34
36
|
|
35
37
|
option :service_name
|
36
38
|
end
|
@@ -19,23 +19,6 @@ module Datadog
|
|
19
19
|
env[Ext::RACK_ENV_SINATRA_REQUEST_SPAN] = span
|
20
20
|
end
|
21
21
|
|
22
|
-
def request_header_tags(env, headers)
|
23
|
-
headers ||= []
|
24
|
-
|
25
|
-
{}.tap do |result|
|
26
|
-
headers.each do |header|
|
27
|
-
rack_header = header_to_rack_header(header)
|
28
|
-
if env.key?(rack_header)
|
29
|
-
result[Tracing::Metadata::Ext::HTTP::RequestHeaders.to_tag(header)] = env[rack_header]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def header_to_rack_header(name)
|
36
|
-
"HTTP_#{name.to_s.upcase.gsub(/[-\s]/, '_')}"
|
37
|
-
end
|
38
|
-
|
39
22
|
def route_path(env, use_script_names: Datadog.configuration.tracing[:sinatra][:resource_script_names])
|
40
23
|
return unless env['sinatra.route']
|
41
24
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,27 +7,27 @@ module Datadog
|
|
5
7
|
# Sinatra 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_SINATRA_ENABLED'
|
9
|
-
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SINATRA_ANALYTICS_ENABLED'
|
10
|
-
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SINATRA_ANALYTICS_SAMPLE_RATE'
|
11
|
-
RACK_ENV_SINATRA_REQUEST_SPAN = 'datadog.sinatra_request_span'
|
12
|
-
SPAN_RENDER_TEMPLATE = 'sinatra.render_template'
|
13
|
-
SPAN_REQUEST = 'sinatra.request'
|
14
|
-
SPAN_ROUTE = 'sinatra.route'
|
15
|
-
TAG_APP_NAME = 'sinatra.app.name'
|
16
|
-
TAG_COMPONENT = 'sinatra'
|
17
|
-
TAG_OPERATION_RENDER_TEMPLATE = 'render_template'
|
18
|
-
TAG_OPERATION_REQUEST = 'request'
|
19
|
-
TAG_OPERATION_ROUTE = 'route'
|
20
|
-
TAG_ROUTE_PATH = 'sinatra.route.path'
|
21
|
-
TAG_SCRIPT_NAME = 'sinatra.script_name'
|
22
|
-
TAG_TEMPLATE_ENGINE = 'sinatra.template_engine'
|
23
|
-
TAG_TEMPLATE_NAME = 'sinatra.template_name'
|
10
|
+
ENV_ENABLED = 'DD_TRACE_SINATRA_ENABLED'
|
11
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SINATRA_ANALYTICS_ENABLED'
|
12
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SINATRA_ANALYTICS_SAMPLE_RATE'
|
13
|
+
RACK_ENV_SINATRA_REQUEST_SPAN = 'datadog.sinatra_request_span'
|
14
|
+
SPAN_RENDER_TEMPLATE = 'sinatra.render_template'
|
15
|
+
SPAN_REQUEST = 'sinatra.request'
|
16
|
+
SPAN_ROUTE = 'sinatra.route'
|
17
|
+
TAG_APP_NAME = 'sinatra.app.name'
|
18
|
+
TAG_COMPONENT = 'sinatra'
|
19
|
+
TAG_OPERATION_RENDER_TEMPLATE = 'render_template'
|
20
|
+
TAG_OPERATION_REQUEST = 'request'
|
21
|
+
TAG_OPERATION_ROUTE = 'route'
|
22
|
+
TAG_ROUTE_PATH = 'sinatra.route.path'
|
23
|
+
TAG_SCRIPT_NAME = 'sinatra.script_name'
|
24
|
+
TAG_TEMPLATE_ENGINE = 'sinatra.template_engine'
|
25
|
+
TAG_TEMPLATE_NAME = 'sinatra.template_name'
|
24
26
|
|
25
27
|
# === Deprecated: To be removed ===
|
26
|
-
RACK_ENV_REQUEST_SPAN = 'datadog.sinatra_request_span'
|
27
|
-
RACK_ENV_MIDDLEWARE_START_TIME = 'datadog.sinatra_middleware_start_time'
|
28
|
-
RACK_ENV_MIDDLEWARE_TRACED = 'datadog.sinatra_middleware_traced'
|
28
|
+
RACK_ENV_REQUEST_SPAN = 'datadog.sinatra_request_span'
|
29
|
+
RACK_ENV_MIDDLEWARE_START_TIME = 'datadog.sinatra_middleware_start_time'
|
30
|
+
RACK_ENV_MIDDLEWARE_TRACED = 'datadog.sinatra_middleware_traced'
|
29
31
|
# === Deprecated: To be removed ===
|
30
32
|
end
|
31
33
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
require_relative '../../metadata/ext'
|
4
4
|
require_relative '../analytics'
|
5
5
|
require_relative '../rack/ext'
|
6
|
+
require_relative '../rack/header_tagging'
|
6
7
|
require_relative 'env'
|
7
8
|
require_relative 'ext'
|
8
|
-
require_relative 'headers'
|
9
9
|
|
10
10
|
module Datadog
|
11
11
|
module Tracing
|
@@ -20,8 +20,6 @@ module Datadog
|
|
20
20
|
|
21
21
|
# rubocop:disable Metrics/AbcSize
|
22
22
|
# rubocop:disable Metrics/MethodLength
|
23
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
24
|
-
# rubocop:disable Metrics/PerceivedComplexity
|
25
23
|
def call(env)
|
26
24
|
# Set the trace context (e.g. distributed tracing)
|
27
25
|
if configuration[:distributed_tracing] && Tracing.active_trace.nil?
|
@@ -45,9 +43,7 @@ module Datadog
|
|
45
43
|
|
46
44
|
response = @app.call(env)
|
47
45
|
ensure
|
48
|
-
|
49
|
-
span.set_tag(name, value) if span.get_tag(name).nil?
|
50
|
-
end
|
46
|
+
Contrib::Rack::HeaderTagging.tag_request_headers(span, env, configuration)
|
51
47
|
|
52
48
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
53
49
|
span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_REQUEST)
|
@@ -85,12 +81,7 @@ module Datadog
|
|
85
81
|
end
|
86
82
|
|
87
83
|
if (headers = response[1])
|
88
|
-
|
89
|
-
headers,
|
90
|
-
configuration[:headers][:response]
|
91
|
-
).each do |name, value|
|
92
|
-
span.set_tag(name, value) if span.get_tag(name).nil?
|
93
|
-
end
|
84
|
+
Contrib::Rack::HeaderTagging.tag_response_headers(span, headers, configuration)
|
94
85
|
end
|
95
86
|
end
|
96
87
|
|
@@ -104,8 +95,6 @@ module Datadog
|
|
104
95
|
end
|
105
96
|
# rubocop:enable Metrics/AbcSize
|
106
97
|
# rubocop:enable Metrics/MethodLength
|
107
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
108
|
-
# rubocop:enable Metrics/PerceivedComplexity
|
109
98
|
|
110
99
|
private
|
111
100
|
|
@@ -11,23 +11,29 @@ module Datadog
|
|
11
11
|
# Default settings for the Shoryuken integration
|
12
12
|
class Settings < Contrib::Configuration::Settings
|
13
13
|
option :enabled do |o|
|
14
|
-
o.
|
15
|
-
o.
|
14
|
+
o.type :bool
|
15
|
+
o.env Ext::ENV_ENABLED
|
16
|
+
o.default true
|
16
17
|
end
|
17
18
|
|
18
19
|
option :analytics_enabled do |o|
|
19
|
-
o.
|
20
|
-
o.
|
20
|
+
o.type :bool
|
21
|
+
o.env Ext::ENV_ANALYTICS_ENABLED
|
22
|
+
o.default false
|
21
23
|
end
|
22
24
|
|
23
25
|
option :analytics_sample_rate do |o|
|
24
|
-
o.
|
25
|
-
o.
|
26
|
+
o.type :float
|
27
|
+
o.env Ext::ENV_ANALYTICS_SAMPLE_RATE
|
28
|
+
o.default 1.0
|
26
29
|
end
|
27
30
|
|
28
31
|
option :service_name
|
29
|
-
option :error_handler
|
30
|
-
|
32
|
+
option :error_handler do |o|
|
33
|
+
o.type :proc
|
34
|
+
o.experimental_default_proc(&Tracing::SpanOperation::Events::DEFAULT_ON_ERROR)
|
35
|
+
end
|
36
|
+
option :tag_body, default: false, type: :bool
|
31
37
|
end
|
32
38
|
end
|
33
39
|
end
|
@@ -37,7 +37,7 @@ module Datadog
|
|
37
37
|
|
38
38
|
request_span.resource = @app.to_proc.binding.eval('self.class').to_s
|
39
39
|
request_span.set_tag(Ext::TAG_JOB_ROUTING_KEY, delivery_info.routing_key)
|
40
|
-
request_span.set_tag(
|
40
|
+
request_span.set_tag(Ext::TAG_RABBITMQ_ROUTING_KEY, delivery_info.routing_key)
|
41
41
|
request_span.set_tag(Ext::TAG_JOB_QUEUE, delivery_info.consumer.queue.name)
|
42
42
|
|
43
43
|
request_span.set_tag(Ext::TAG_JOB_BODY, deserialized_msg) if configuration[:tag_body]
|
@@ -1,27 +1,91 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative 'ext'
|
4
|
+
|
3
5
|
module Datadog
|
4
6
|
module Tracing
|
5
7
|
module Contrib
|
6
8
|
# Contains methods for fetching values according to span attributes schema
|
7
9
|
module SpanAttributeSchema
|
8
|
-
|
10
|
+
REFLEXIVE_SOURCES = [Tracing::Metadata::Ext::TAG_PEER_SERVICE].freeze
|
11
|
+
NO_SOURCE = [].freeze
|
9
12
|
|
10
|
-
def fetch_service_name(env, default)
|
13
|
+
def self.fetch_service_name(env, default)
|
11
14
|
ENV.fetch(env) do
|
12
|
-
if Datadog.configuration.tracing.
|
13
|
-
|
14
|
-
Datadog.configuration.service
|
15
|
-
else
|
16
|
-
default
|
15
|
+
if Datadog.configuration.tracing.contrib.global_default_service_name.enabled
|
16
|
+
return Datadog.configuration.service
|
17
17
|
end
|
18
|
+
|
19
|
+
default
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
23
|
+
def self.set_peer_service!(span, sources)
|
24
|
+
# Acquire all peer.service values as well as any potential remapping
|
25
|
+
peer_service_val, peer_service_source = set_peer_service_from_source(span, sources)
|
26
|
+
remap_val = Datadog.configuration.tracing.contrib.peer_service_mapping[peer_service_val]
|
27
|
+
|
28
|
+
# Only continue to setting peer.service if actual source is found
|
29
|
+
return false unless peer_service_source
|
30
|
+
|
31
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_PEER_SERVICE_SOURCE, peer_service_source)
|
32
|
+
|
33
|
+
# Set peer.service to remapped value if found otherwise normally set peer.service
|
34
|
+
if remap_val
|
35
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE, remap_val)
|
36
|
+
span.set_tag(Tracing::Contrib::Ext::Metadata::TAG_PEER_SERVICE_REMAP, peer_service_val)
|
37
|
+
else
|
38
|
+
span.set_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE, peer_service_val)
|
39
|
+
end
|
40
|
+
true
|
41
|
+
end
|
42
|
+
|
43
|
+
# set_peer_service_from_source: Implements the extraction logic to determine the peer.service value
|
44
|
+
# based on the list of source tags passed as a parameter.
|
45
|
+
#
|
46
|
+
# If no values are found, it checks the default list for all spans before returning false for no result
|
47
|
+
# Sets the source of where the information for peer.service was extracted from
|
48
|
+
# Returns a peer.service value if successfully set or not
|
49
|
+
def self.set_peer_service_from_source(span, sources = [])
|
50
|
+
# Filter out sources based on existence of peer.service tag
|
51
|
+
sources = filter_peer_service_sources(span, sources)
|
52
|
+
|
53
|
+
# Find a possible peer.service source from the list of source tags passed in
|
54
|
+
sources.each do |source|
|
55
|
+
source_val = span.get_tag(source)
|
56
|
+
next unless not_empty_tag?(source_val)
|
57
|
+
|
58
|
+
return source_val, source
|
59
|
+
end
|
60
|
+
false
|
24
61
|
end
|
62
|
+
|
63
|
+
private_class_method :set_peer_service_from_source
|
64
|
+
|
65
|
+
# filter_peer_service_sources: returns filtered sources based on existence of peer.service tag
|
66
|
+
# If peer.service exists, we do not read from any other source rather use peer.service as source
|
67
|
+
# This is to prevent overwriting of pre-existing peer.service tags
|
68
|
+
def self.filter_peer_service_sources(span, sources)
|
69
|
+
ps = span.get_tag(Tracing::Metadata::Ext::TAG_PEER_SERVICE)
|
70
|
+
# Do not override existing peer.service tag if it exists based on schema version
|
71
|
+
return REFLEXIVE_SOURCES if not_empty_tag?(ps)
|
72
|
+
|
73
|
+
# Check that peer.service is only set on spankind client/producer spans
|
74
|
+
if (span.get_tag(Tracing::Metadata::Ext::TAG_KIND) == Tracing::Metadata::Ext::SpanKind::TAG_CLIENT) ||
|
75
|
+
(span.get_tag(Tracing::Metadata::Ext::TAG_KIND) == Tracing::Metadata::Ext::SpanKind::TAG_PRODUCER)
|
76
|
+
return sources
|
77
|
+
end
|
78
|
+
|
79
|
+
NO_SOURCE
|
80
|
+
end
|
81
|
+
|
82
|
+
private_class_method :filter_peer_service_sources
|
83
|
+
|
84
|
+
def self.not_empty_tag?(tag)
|
85
|
+
tag && (tag != '')
|
86
|
+
end
|
87
|
+
|
88
|
+
private_class_method :not_empty_tag?
|
25
89
|
end
|
26
90
|
end
|
27
91
|
end
|
@@ -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
|
end
|
29
32
|
end
|
@@ -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
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
@@ -5,19 +7,19 @@ module Datadog
|
|
5
7
|
# SuckerPunch 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_SUCKER_PUNCH_ENABLED'
|
9
|
-
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SUCKER_PUNCH_ANALYTICS_ENABLED'
|
10
|
-
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SUCKER_PUNCH_ANALYTICS_SAMPLE_RATE'
|
11
|
-
SERVICE_NAME = 'sucker_punch'
|
12
|
-
SPAN_PERFORM = 'sucker_punch.perform'
|
13
|
-
SPAN_PERFORM_ASYNC = 'sucker_punch.perform_async'
|
14
|
-
SPAN_PERFORM_IN = 'sucker_punch.perform_in'
|
15
|
-
TAG_PERFORM_IN = 'sucker_punch.perform_in'
|
16
|
-
TAG_QUEUE = 'sucker_punch.queue'
|
17
|
-
TAG_COMPONENT = 'sucker_punch'
|
18
|
-
TAG_OPERATION_PERFORM = 'perform'
|
19
|
-
TAG_OPERATION_PERFORM_ASYNC = 'perform_async'
|
20
|
-
TAG_OPERATION_PERFORM_IN = 'perform_in'
|
10
|
+
ENV_ENABLED = 'DD_TRACE_SUCKER_PUNCH_ENABLED'
|
11
|
+
ENV_ANALYTICS_ENABLED = 'DD_TRACE_SUCKER_PUNCH_ANALYTICS_ENABLED'
|
12
|
+
ENV_ANALYTICS_SAMPLE_RATE = 'DD_TRACE_SUCKER_PUNCH_ANALYTICS_SAMPLE_RATE'
|
13
|
+
SERVICE_NAME = 'sucker_punch'
|
14
|
+
SPAN_PERFORM = 'sucker_punch.perform'
|
15
|
+
SPAN_PERFORM_ASYNC = 'sucker_punch.perform_async'
|
16
|
+
SPAN_PERFORM_IN = 'sucker_punch.perform_in'
|
17
|
+
TAG_PERFORM_IN = 'sucker_punch.perform_in'
|
18
|
+
TAG_QUEUE = 'sucker_punch.queue'
|
19
|
+
TAG_COMPONENT = 'sucker_punch'
|
20
|
+
TAG_OPERATION_PERFORM = 'perform'
|
21
|
+
TAG_OPERATION_PERFORM_ASYNC = 'perform_async'
|
22
|
+
TAG_OPERATION_PERFORM_IN = 'perform_in'
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Contrib
|
4
6
|
module Utils
|
5
7
|
# Common database-related utility functions.
|
6
8
|
module Database
|
7
|
-
VENDOR_DEFAULT = 'defaultdb'
|
8
|
-
VENDOR_POSTGRES = 'postgres'
|
9
|
-
VENDOR_SQLITE = 'sqlite'
|
9
|
+
VENDOR_DEFAULT = 'defaultdb'
|
10
|
+
VENDOR_POSTGRES = 'postgres'
|
11
|
+
VENDOR_SQLITE = 'sqlite'
|
10
12
|
|
11
13
|
module_function
|
12
14
|
|
@@ -23,7 +23,6 @@ module Datadog
|
|
23
23
|
:span_resource,
|
24
24
|
:span_service,
|
25
25
|
:span_type,
|
26
|
-
:trace_id,
|
27
26
|
:trace_name,
|
28
27
|
:trace_resource,
|
29
28
|
:trace_service,
|
@@ -65,22 +64,20 @@ module Datadog
|
|
65
64
|
attributes << "#{LOG_ATTR_ENV}=#{env}" unless env.nil?
|
66
65
|
attributes << "#{LOG_ATTR_SERVICE}=#{service}"
|
67
66
|
attributes << "#{LOG_ATTR_VERSION}=#{version}" unless version.nil?
|
68
|
-
attributes << "#{LOG_ATTR_TRACE_ID}=#{
|
67
|
+
attributes << "#{LOG_ATTR_TRACE_ID}=#{trace_id}"
|
69
68
|
attributes << "#{LOG_ATTR_SPAN_ID}=#{span_id}"
|
70
69
|
attributes.join(' ')
|
71
70
|
end
|
72
71
|
end
|
73
72
|
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
Tracing::Utils::TraceId.to_low_order(@trace_id)
|
83
|
-
end
|
73
|
+
# DEV-2.0: This public method was returning an Integer, but with 128 bit trace id it would return a String.
|
74
|
+
def trace_id
|
75
|
+
if Datadog.configuration.tracing.trace_id_128_bit_logging_enabled &&
|
76
|
+
!Tracing::Utils::TraceId.to_high_order(@trace_id).zero?
|
77
|
+
Kernel.format('%032x', @trace_id)
|
78
|
+
else
|
79
|
+
Tracing::Utils::TraceId.to_low_order(@trace_id)
|
80
|
+
end
|
84
81
|
end
|
85
82
|
end
|
86
83
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Datadog
|
2
4
|
module Tracing
|
3
5
|
module Diagnostics
|
@@ -7,25 +9,25 @@ module Datadog
|
|
7
9
|
module Health
|
8
10
|
# Metrics
|
9
11
|
module Metrics
|
10
|
-
METRIC_API_ERRORS = 'datadog.tracer.api.errors'
|
11
|
-
METRIC_API_REQUESTS = 'datadog.tracer.api.requests'
|
12
|
-
METRIC_API_RESPONSES = 'datadog.tracer.api.responses'
|
13
|
-
METRIC_ERROR_CONTEXT_OVERFLOW = 'datadog.tracer.error.context_overflow'
|
14
|
-
METRIC_ERROR_INSTRUMENTATION_PATCH = 'datadog.tracer.error.instrumentation_patch'
|
15
|
-
METRIC_ERROR_SPAN_FINISH = 'datadog.tracer.error.span_finish'
|
16
|
-
METRIC_ERROR_UNFINISHED_SPANS = 'datadog.tracer.error.unfinished_spans'
|
17
|
-
METRIC_INSTRUMENTATION_PATCHED = 'datadog.tracer.instrumentation_patched'
|
18
|
-
METRIC_QUEUE_ACCEPTED = 'datadog.tracer.queue.accepted'
|
19
|
-
METRIC_QUEUE_ACCEPTED_LENGTHS = 'datadog.tracer.queue.accepted_lengths'
|
20
|
-
METRIC_QUEUE_DROPPED = 'datadog.tracer.queue.dropped'
|
21
|
-
METRIC_QUEUE_LENGTH = 'datadog.tracer.queue.length'
|
22
|
-
METRIC_QUEUE_MAX_LENGTH = 'datadog.tracer.queue.max_length'
|
23
|
-
METRIC_QUEUE_SPANS = 'datadog.tracer.queue.spans'
|
24
|
-
METRIC_SAMPLING_SERVICE_CACHE_LENGTH = 'datadog.tracer.sampling.service_cache_length'
|
25
|
-
METRIC_TRACES_FILTERED = 'datadog.tracer.traces.filtered'
|
26
|
-
METRIC_TRANSPORT_CHUNKED = 'datadog.tracer.transport.chunked'
|
27
|
-
METRIC_TRANSPORT_TRACE_TOO_LARGE = 'datadog.tracer.transport.trace_too_large'
|
28
|
-
METRIC_WRITER_CPU_TIME = 'datadog.tracer.writer.cpu_time'
|
12
|
+
METRIC_API_ERRORS = 'datadog.tracer.api.errors'
|
13
|
+
METRIC_API_REQUESTS = 'datadog.tracer.api.requests'
|
14
|
+
METRIC_API_RESPONSES = 'datadog.tracer.api.responses'
|
15
|
+
METRIC_ERROR_CONTEXT_OVERFLOW = 'datadog.tracer.error.context_overflow'
|
16
|
+
METRIC_ERROR_INSTRUMENTATION_PATCH = 'datadog.tracer.error.instrumentation_patch'
|
17
|
+
METRIC_ERROR_SPAN_FINISH = 'datadog.tracer.error.span_finish'
|
18
|
+
METRIC_ERROR_UNFINISHED_SPANS = 'datadog.tracer.error.unfinished_spans'
|
19
|
+
METRIC_INSTRUMENTATION_PATCHED = 'datadog.tracer.instrumentation_patched'
|
20
|
+
METRIC_QUEUE_ACCEPTED = 'datadog.tracer.queue.accepted'
|
21
|
+
METRIC_QUEUE_ACCEPTED_LENGTHS = 'datadog.tracer.queue.accepted_lengths'
|
22
|
+
METRIC_QUEUE_DROPPED = 'datadog.tracer.queue.dropped'
|
23
|
+
METRIC_QUEUE_LENGTH = 'datadog.tracer.queue.length'
|
24
|
+
METRIC_QUEUE_MAX_LENGTH = 'datadog.tracer.queue.max_length'
|
25
|
+
METRIC_QUEUE_SPANS = 'datadog.tracer.queue.spans'
|
26
|
+
METRIC_SAMPLING_SERVICE_CACHE_LENGTH = 'datadog.tracer.sampling.service_cache_length'
|
27
|
+
METRIC_TRACES_FILTERED = 'datadog.tracer.traces.filtered'
|
28
|
+
METRIC_TRANSPORT_CHUNKED = 'datadog.tracer.transport.chunked'
|
29
|
+
METRIC_TRANSPORT_TRACE_TOO_LARGE = 'datadog.tracer.transport.trace_too_large'
|
30
|
+
METRIC_WRITER_CPU_TIME = 'datadog.tracer.writer.cpu_time'
|
29
31
|
end
|
30
32
|
end
|
31
33
|
end
|
@@ -30,8 +30,8 @@ module Datadog
|
|
30
30
|
return if digest.nil?
|
31
31
|
|
32
32
|
# DEV: We need these to be hex encoded
|
33
|
-
data[@trace_id_key] = digest.trace_id
|
34
|
-
data[@span_id_key] = digest.span_id
|
33
|
+
data[@trace_id_key] = format('%032x', digest.trace_id)
|
34
|
+
data[@span_id_key] = format('%016x', digest.span_id)
|
35
35
|
|
36
36
|
if digest.trace_sampling_priority
|
37
37
|
sampling_priority = Helpers.clamp_sampling_priority(
|
@@ -26,7 +26,7 @@ module Datadog
|
|
26
26
|
return if digest.nil?
|
27
27
|
|
28
28
|
# DEV: We need these to be hex encoded
|
29
|
-
value = "#{digest.trace_id
|
29
|
+
value = "#{format('%032x', digest.trace_id)}-#{format('%016x', digest.span_id)}"
|
30
30
|
|
31
31
|
if digest.trace_sampling_priority
|
32
32
|
sampling_priority = Helpers.clamp_sampling_priority(
|