datadog 2.48.0 → 2.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -1
- data/ext/datadog_profiling_native_extension/collectors_stack.c +1 -1
- data/ext/datadog_profiling_native_extension/collectors_stack.h +4 -2
- data/ext/datadog_profiling_native_extension/extconf.rb +3 -0
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +13 -21
- data/ext/libdatadog_api/extconf.rb +2 -0
- data/ext/libdatadog_api/feature_flags.c +137 -0
- data/ext/libdatadog_api/process_discovery.c +3 -3
- data/ext/libdatadog_extconf_helpers.rb +1 -1
- data/lib/datadog/ai_guard/contrib/rack/patcher.rb +3 -5
- data/lib/datadog/ai_guard/contrib/rails/patcher.rb +7 -9
- data/lib/datadog/ai_guard/contrib/ruby_llm/patcher.rb +3 -5
- data/lib/datadog/ai_guard/metrics/telemetry.rb +2 -4
- data/lib/datadog/appsec/actions_handler.rb +5 -7
- data/lib/datadog/appsec/api_security/endpoint_collection/grape_route_serializer.rb +1 -3
- data/lib/datadog/appsec/api_security/endpoint_collection/rails_route_serializer.rb +1 -3
- data/lib/datadog/appsec/api_security/endpoint_collection/sinatra_route_serializer.rb +1 -3
- data/lib/datadog/appsec/assets.rb +8 -10
- data/lib/datadog/appsec/configuration.rb +1 -1
- data/lib/datadog/appsec/context.rb +63 -6
- data/lib/datadog/appsec/contrib/active_record/instrumentation.rb +1 -3
- data/lib/datadog/appsec/contrib/active_record/patcher.rb +21 -24
- data/lib/datadog/appsec/contrib/aws_lambda/patcher.rb +3 -5
- data/lib/datadog/appsec/contrib/aws_lambda/waf_addresses.rb +9 -11
- data/lib/datadog/appsec/contrib/devise/configuration.rb +2 -4
- data/lib/datadog/appsec/contrib/devise/patcher.rb +3 -5
- data/lib/datadog/appsec/contrib/excon/patcher.rb +3 -5
- data/lib/datadog/appsec/contrib/faraday/patcher.rb +4 -6
- data/lib/datadog/appsec/contrib/graphql/patcher.rb +3 -5
- data/lib/datadog/appsec/contrib/rack/input_peeker.rb +3 -5
- data/lib/datadog/appsec/contrib/rack/patcher.rb +3 -5
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +5 -4
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +6 -7
- data/lib/datadog/appsec/contrib/rails/patcher.rb +19 -16
- data/lib/datadog/appsec/contrib/rails/patches/live_thread_patch.rb +33 -0
- data/lib/datadog/appsec/contrib/rest_client/patcher.rb +3 -5
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +4 -6
- data/lib/datadog/appsec/default_header_tags.rb +2 -4
- data/lib/datadog/appsec/metrics/exporter.rb +4 -6
- data/lib/datadog/appsec/metrics/telemetry.rb +1 -3
- data/lib/datadog/appsec/metrics/telemetry_exporter.rb +2 -4
- data/lib/datadog/appsec/route_normalizer/route_text.rb +1 -3
- data/lib/datadog/appsec/route_normalizer.rb +4 -6
- data/lib/datadog/appsec/utils/http/body_reader.rb +3 -5
- data/lib/datadog/appsec/utils/http/url_encoded.rb +2 -4
- data/lib/datadog/core/borrowing_token_bucket.rb +60 -0
- data/lib/datadog/core/chunker.rb +1 -3
- data/lib/datadog/core/configuration/components.rb +48 -17
- data/lib/datadog/core/configuration/settings.rb +2 -1
- data/lib/datadog/core/configuration/supported_configurations.rb +2 -0
- data/lib/datadog/core/diagnostics/environment_logger.rb +1 -6
- data/lib/datadog/core/encoding.rb +8 -12
- data/lib/datadog/core/environment/cgroup.rb +3 -5
- data/lib/datadog/core/environment/container.rb +9 -11
- data/lib/datadog/core/environment/ext.rb +1 -6
- data/lib/datadog/core/environment/gc.rb +2 -4
- data/lib/datadog/core/environment/identity.rb +13 -15
- data/lib/datadog/core/environment/platform.rb +10 -12
- data/lib/datadog/core/environment/socket.rb +3 -5
- data/lib/datadog/core/environment/thread_count.rb +2 -4
- data/lib/datadog/core/environment/variable_helpers.rb +2 -6
- data/lib/datadog/core/environment/vm_cache.rb +5 -7
- data/lib/datadog/core/environment/yjit.rb +25 -24
- data/lib/datadog/core/logger.rb +5 -2
- data/lib/datadog/core/metrics/client.rb +8 -16
- data/lib/datadog/core/metrics/helpers.rb +3 -0
- data/lib/datadog/core/metrics/metric.rb +3 -1
- data/lib/datadog/core/rate_limiter.rb +9 -31
- data/lib/datadog/core/refillable_bucket.rb +72 -0
- data/lib/datadog/core/remote/client/capabilities.rb +4 -0
- data/lib/datadog/core/remote/client.rb +1 -5
- data/lib/datadog/core/remote/transport/http.rb +2 -4
- data/lib/datadog/core/tag_normalizer.rb +0 -2
- data/lib/datadog/core/telemetry/configuration_value.rb +1 -3
- data/lib/datadog/core/telemetry/transport/http.rb +2 -4
- data/lib/datadog/core/telemetry/worker.rb +30 -24
- data/lib/datadog/core/transport/http.rb +2 -4
- data/lib/datadog/core/utils/at_fork_monkey_patch.rb +2 -2
- data/lib/datadog/core/utils/forking.rb +1 -1
- data/lib/datadog/core/utils/lru_cache.rb +2 -2
- data/lib/datadog/core/utils/network.rb +1 -1
- data/lib/datadog/core/utils/time.rb +2 -2
- data/lib/datadog/core/utils/truncation.rb +1 -3
- data/lib/datadog/core/workers/async.rb +16 -14
- data/lib/datadog/core/workers/runtime_metrics.rb +1 -1
- data/lib/datadog/data_streams/transport/http.rb +1 -3
- data/lib/datadog/di/component.rb +14 -2
- data/lib/datadog/di/context.rb +50 -0
- data/lib/datadog/di/contrib.rb +2 -2
- data/lib/datadog/di/correlation_sampler/trace_budget.rb +75 -0
- data/lib/datadog/di/correlation_sampler/trace_budget_ledger/entry.rb +34 -0
- data/lib/datadog/di/correlation_sampler/trace_budget_ledger.rb +104 -0
- data/lib/datadog/di/correlation_sampler.rb +224 -0
- data/lib/datadog/di/guardrails_telemetry/reason.rb +8 -3
- data/lib/datadog/di/instrumenter.rb +294 -109
- data/lib/datadog/di/probe.rb +13 -2
- data/lib/datadog/di/probe_builder.rb +6 -8
- data/lib/datadog/di/probe_file_loader.rb +2 -2
- data/lib/datadog/di/probe_manager.rb +7 -30
- data/lib/datadog/di/probe_notification_builder.rb +42 -11
- data/lib/datadog/di/probe_notifier_worker.rb +11 -0
- data/lib/datadog/di/snapshot_pruner/node.rb +190 -0
- data/lib/datadog/di/snapshot_pruner/node_queue.rb +104 -0
- data/lib/datadog/di/snapshot_pruner/parser.rb +102 -0
- data/lib/datadog/di/snapshot_pruner.rb +128 -0
- data/lib/datadog/di/transport/input.rb +75 -15
- data/lib/datadog/di/utils.rb +3 -3
- data/lib/datadog/di.rb +29 -0
- data/lib/datadog/error_tracking/filters.rb +6 -8
- data/lib/datadog/open_feature/agentless/parser.rb +2 -4
- data/lib/datadog/open_feature/component.rb +24 -2
- data/lib/datadog/open_feature/configuration.rb +13 -0
- data/lib/datadog/open_feature/evaluation_engine.rb +5 -5
- data/lib/datadog/open_feature/exposure_hook.rb +146 -0
- data/lib/datadog/open_feature/exposures/event.rb +10 -8
- data/lib/datadog/open_feature/exposures/reporter.rb +34 -25
- data/lib/datadog/open_feature/ext.rb +12 -0
- data/lib/datadog/open_feature/flag_evaluation/aggregator.rb +10 -8
- data/lib/datadog/open_feature/flag_evaluation/writer.rb +9 -6
- data/lib/datadog/open_feature/hooks/exposure_logging_hook.rb +58 -0
- data/lib/datadog/open_feature/hooks/flag_eval_evp_hook.rb +4 -2
- data/lib/datadog/open_feature/hooks/flag_eval_metrics_hook.rb +3 -5
- data/lib/datadog/open_feature/hooks/span_enrichment_hook/codec.rb +3 -5
- data/lib/datadog/open_feature/native_evaluator.rb +30 -2
- data/lib/datadog/open_feature/noop_evaluator.rb +3 -1
- data/lib/datadog/open_feature/provider.rb +54 -4
- data/lib/datadog/open_feature/resolution_details.rb +1 -0
- data/lib/datadog/open_feature/split_features.rb +76 -0
- data/lib/datadog/opentelemetry/sdk/propagator.rb +5 -2
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +28 -31
- data/lib/datadog/profiling/component.rb +31 -9
- data/lib/datadog/profiling/profiler.rb +6 -0
- data/lib/datadog/profiling/remote.rb +381 -0
- data/lib/datadog/profiling/worker_state.rb +65 -0
- data/lib/datadog/profiling.rb +1 -0
- data/lib/datadog/symbol_database/file_hash.rb +1 -3
- data/lib/datadog/tracing/component.rb +14 -16
- data/lib/datadog/tracing/configuration/settings.rb +2 -2
- data/lib/datadog/tracing/contrib/action_cable/events/broadcast.rb +4 -6
- data/lib/datadog/tracing/contrib/action_cable/events/perform_action.rb +4 -6
- data/lib/datadog/tracing/contrib/action_cable/events/transmit.rb +4 -6
- data/lib/datadog/tracing/contrib/action_cable/events.rb +3 -5
- data/lib/datadog/tracing/contrib/action_cable/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +5 -7
- data/lib/datadog/tracing/contrib/action_mailer/events/process.rb +4 -6
- data/lib/datadog/tracing/contrib/action_mailer/events.rb +3 -5
- data/lib/datadog/tracing/contrib/action_mailer/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +2 -4
- data/lib/datadog/tracing/contrib/action_pack/action_controller/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/action_pack/action_dispatch/instrumentation.rb +2 -4
- data/lib/datadog/tracing/contrib/action_pack/action_dispatch/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/action_pack/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/action_view/events/render_partial.rb +3 -5
- data/lib/datadog/tracing/contrib/action_view/events/render_template.rb +3 -5
- data/lib/datadog/tracing/contrib/action_view/events.rb +3 -5
- data/lib/datadog/tracing/contrib/action_view/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/action_view/utils.rb +1 -3
- data/lib/datadog/tracing/contrib/active_job/events/discard.rb +3 -5
- data/lib/datadog/tracing/contrib/active_job/events/enqueue.rb +3 -5
- data/lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb +3 -5
- data/lib/datadog/tracing/contrib/active_job/events/enqueue_retry.rb +3 -5
- data/lib/datadog/tracing/contrib/active_job/events/perform.rb +3 -5
- data/lib/datadog/tracing/contrib/active_job/events/retry_stopped.rb +3 -5
- data/lib/datadog/tracing/contrib/active_job/events.rb +3 -5
- data/lib/datadog/tracing/contrib/active_job/patcher.rb +4 -6
- data/lib/datadog/tracing/contrib/active_model_serializers/events/render.rb +4 -6
- data/lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb +4 -6
- data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +3 -5
- data/lib/datadog/tracing/contrib/active_model_serializers/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/active_record/events/instantiation.rb +4 -6
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +3 -5
- data/lib/datadog/tracing/contrib/active_record/events.rb +3 -5
- data/lib/datadog/tracing/contrib/active_record/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/active_support/cache/events/cache.rb +8 -10
- data/lib/datadog/tracing/contrib/active_support/cache/events.rb +3 -5
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +5 -7
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +4 -6
- data/lib/datadog/tracing/contrib/active_support/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/analytics.rb +4 -6
- data/lib/datadog/tracing/contrib/aws/patcher.rb +5 -7
- data/lib/datadog/tracing/contrib/concurrent_ruby/patcher.rb +5 -7
- data/lib/datadog/tracing/contrib/configuration/settings.rb +17 -0
- data/lib/datadog/tracing/contrib/dalli/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/dalli/quantize.rb +1 -3
- data/lib/datadog/tracing/contrib/delayed_job/patcher.rb +4 -6
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +6 -8
- data/lib/datadog/tracing/contrib/ethon/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/excon/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/faraday/patcher.rb +4 -6
- data/lib/datadog/tracing/contrib/grape/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/graphql/patcher.rb +4 -6
- data/lib/datadog/tracing/contrib/graphql/trace_patcher.rb +1 -3
- data/lib/datadog/tracing/contrib/graphql/tracing_patcher.rb +1 -3
- data/lib/datadog/tracing/contrib/graphql/unified_trace_patcher.rb +1 -3
- data/lib/datadog/tracing/contrib/grpc/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/hanami/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/http/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/httpclient/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/httprb/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/kafka/events/connection/request.rb +4 -6
- data/lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.rb +3 -5
- data/lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb +3 -5
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb +3 -5
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/join_group.rb +2 -4
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/leave_group.rb +2 -4
- data/lib/datadog/tracing/contrib/kafka/events/consumer_group/sync_group.rb +2 -4
- data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +4 -6
- data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +4 -6
- data/lib/datadog/tracing/contrib/kafka/events.rb +3 -5
- data/lib/datadog/tracing/contrib/kafka/patcher.rb +4 -6
- data/lib/datadog/tracing/contrib/karafka/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/lograge/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/mongodb/parsers.rb +5 -7
- data/lib/datadog/tracing/contrib/mongodb/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/mysql2/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +1 -3
- data/lib/datadog/tracing/contrib/opensearch/quantize.rb +5 -7
- data/lib/datadog/tracing/contrib/pg/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/presto/patcher.rb +1 -3
- data/lib/datadog/tracing/contrib/que/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/racecar/events/batch.rb +3 -5
- data/lib/datadog/tracing/contrib/racecar/events/consume.rb +3 -5
- data/lib/datadog/tracing/contrib/racecar/events/message.rb +3 -5
- data/lib/datadog/tracing/contrib/racecar/events.rb +3 -5
- data/lib/datadog/tracing/contrib/racecar/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/rack/patcher.rb +13 -19
- data/lib/datadog/tracing/contrib/rack/request_queue.rb +1 -3
- data/lib/datadog/tracing/contrib/rack/route_inference.rb +4 -6
- data/lib/datadog/tracing/contrib/rack/trace_proxy_middleware.rb +4 -6
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +4 -0
- data/lib/datadog/tracing/contrib/rails/ext.rb +2 -0
- data/lib/datadog/tracing/contrib/rails/framework.rb +6 -8
- data/lib/datadog/tracing/contrib/rails/log_injection.rb +1 -3
- data/lib/datadog/tracing/contrib/rails/patcher.rb +9 -11
- data/lib/datadog/tracing/contrib/rake/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/redis/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/redis/quantize.rb +7 -9
- data/lib/datadog/tracing/contrib/resque/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/rest_client/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/roda/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/semantic_logger/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/sequel/patcher.rb +4 -6
- data/lib/datadog/tracing/contrib/shoryuken/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/sidekiq/patcher.rb +7 -9
- data/lib/datadog/tracing/contrib/sinatra/env.rb +3 -5
- data/lib/datadog/tracing/contrib/sinatra/patcher.rb +5 -7
- data/lib/datadog/tracing/contrib/sneakers/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/stripe/patcher.rb +2 -4
- data/lib/datadog/tracing/contrib/stripe/request.rb +4 -6
- data/lib/datadog/tracing/contrib/sucker_punch/exception_handler.rb +1 -3
- data/lib/datadog/tracing/contrib/sucker_punch/instrumentation.rb +1 -3
- data/lib/datadog/tracing/contrib/sucker_punch/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/support.rb +1 -3
- data/lib/datadog/tracing/contrib/trilogy/configuration/settings.rb +4 -0
- data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +2 -1
- data/lib/datadog/tracing/contrib/trilogy/patcher.rb +3 -5
- data/lib/datadog/tracing/contrib/utils/database.rb +1 -3
- data/lib/datadog/tracing/contrib/utils/quantization/hash_formatter.rb +8 -10
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +11 -13
- data/lib/datadog/tracing/contrib/waterdrop/patcher.rb +3 -5
- data/lib/datadog/tracing/correlation.rb +3 -5
- data/lib/datadog/tracing/distributed/propagation.rb +2 -2
- data/lib/datadog/tracing/distributed/propagation_policy.rb +1 -3
- data/lib/datadog/tracing/distributed/trace_state/datadog.rb +5 -5
- data/lib/datadog/tracing/distributed/trace_state/open_telemetry.rb +2 -2
- data/lib/datadog/tracing/metadata/ext.rb +3 -9
- data/lib/datadog/tracing/remote.rb +1 -1
- data/lib/datadog/tracing/trace_operation.rb +11 -3
- data/lib/datadog/tracing/tracer.rb +9 -1
- data/lib/datadog/tracing/transport/http.rb +1 -3
- data/lib/datadog/tracing/transport/io.rb +2 -4
- data/lib/datadog/tracing/transport/traces.rb +1 -3
- data/lib/datadog/tracing/utils.rb +4 -6
- data/lib/datadog/version.rb +1 -1
- metadata +22 -6
|
@@ -17,22 +17,20 @@ module Datadog
|
|
|
17
17
|
|
|
18
18
|
EVENT_NAME = "instantiation.active_record"
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def supported?
|
|
20
|
+
def self.supported?
|
|
23
21
|
Gem.loaded_specs["activerecord"] \
|
|
24
22
|
&& Gem.loaded_specs["activerecord"].version >= Gem::Version.new("4.2")
|
|
25
23
|
end
|
|
26
24
|
|
|
27
|
-
def event_name
|
|
25
|
+
def self.event_name
|
|
28
26
|
self::EVENT_NAME
|
|
29
27
|
end
|
|
30
28
|
|
|
31
|
-
def span_name
|
|
29
|
+
def self.span_name
|
|
32
30
|
Ext::SPAN_INSTANTIATION
|
|
33
31
|
end
|
|
34
32
|
|
|
35
|
-
def on_start(span, event, _id, payload)
|
|
33
|
+
def self.on_start(span, event, _id, payload)
|
|
36
34
|
span.resource = payload.fetch(:class_name)
|
|
37
35
|
span.type = Ext::SPAN_TYPE_INSTANTIATION
|
|
38
36
|
span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)
|
|
@@ -20,17 +20,15 @@ module Datadog
|
|
|
20
20
|
EVENT_NAME = "sql.active_record"
|
|
21
21
|
PAYLOAD_CACHE = "CACHE"
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def event_name
|
|
23
|
+
def self.event_name
|
|
26
24
|
self::EVENT_NAME
|
|
27
25
|
end
|
|
28
26
|
|
|
29
|
-
def span_name
|
|
27
|
+
def self.span_name
|
|
30
28
|
Ext::SPAN_SQL
|
|
31
29
|
end
|
|
32
30
|
|
|
33
|
-
def on_start(span, event, _id, payload)
|
|
31
|
+
def self.on_start(span, event, _id, payload)
|
|
34
32
|
config = Utils.connection_config(payload[:connection], payload[:connection_id])
|
|
35
33
|
settings = Datadog.configuration.tracing[:active_record, config]
|
|
36
34
|
adapter_name = Contrib::Utils::Database.normalize_vendor(config[:adapter])
|
|
@@ -14,17 +14,15 @@ module Datadog
|
|
|
14
14
|
Events::SQL,
|
|
15
15
|
].freeze
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def all
|
|
17
|
+
def self.all
|
|
20
18
|
self::ALL
|
|
21
19
|
end
|
|
22
20
|
|
|
23
|
-
def subscriptions
|
|
21
|
+
def self.subscriptions
|
|
24
22
|
all.collect(&:subscriptions).collect(&:to_a).flatten
|
|
25
23
|
end
|
|
26
24
|
|
|
27
|
-
def subscribe!
|
|
25
|
+
def self.subscribe!
|
|
28
26
|
all.each(&:subscribe!)
|
|
29
27
|
end
|
|
30
28
|
end
|
|
@@ -14,23 +14,21 @@ module Datadog
|
|
|
14
14
|
module Cache
|
|
15
15
|
include ActiveSupport::Cache::Event
|
|
16
16
|
|
|
17
|
-
module_function
|
|
18
|
-
|
|
19
17
|
# Acts as this module's initializer.
|
|
20
|
-
def subscribe!
|
|
18
|
+
def self.subscribe!
|
|
21
19
|
@cache_backend = {}
|
|
22
20
|
super
|
|
23
21
|
end
|
|
24
22
|
|
|
25
|
-
def event_name
|
|
23
|
+
def self.event_name
|
|
26
24
|
/\Acache_(?:delete|read|read_multi|write|write_multi)\.active_support\z/
|
|
27
25
|
end
|
|
28
26
|
|
|
29
|
-
def span_name
|
|
27
|
+
def self.span_name
|
|
30
28
|
Ext::SPAN_CACHE
|
|
31
29
|
end
|
|
32
30
|
|
|
33
|
-
def span_options
|
|
31
|
+
def self.span_options
|
|
34
32
|
{
|
|
35
33
|
type: Ext::SPAN_TYPE_CACHE,
|
|
36
34
|
}
|
|
@@ -45,7 +43,7 @@ module Datadog
|
|
|
45
43
|
"cache_write_multi.active_support" => {resource: Ext::RESOURCE_CACHE_MSET, multi_key: true},
|
|
46
44
|
}.freeze
|
|
47
45
|
|
|
48
|
-
def trace?(event, payload)
|
|
46
|
+
def self.trace?(event, payload)
|
|
49
47
|
return false if !Tracing.enabled? || !configuration.enabled
|
|
50
48
|
|
|
51
49
|
if (cache_store = configuration[:cache_store])
|
|
@@ -67,7 +65,7 @@ module Datadog
|
|
|
67
65
|
end
|
|
68
66
|
end
|
|
69
67
|
|
|
70
|
-
def on_start(span, event, _id, payload)
|
|
68
|
+
def self.on_start(span, event, _id, payload)
|
|
71
69
|
# Since Rails 8, `dd_original_keys` contains the denormalized key provided by the user.
|
|
72
70
|
# In previous versions, the denormalized key is stored in the official `key` attribute.
|
|
73
71
|
# We fall back to `key`, even in Rails 8, as a defensive measure.
|
|
@@ -95,7 +93,7 @@ module Datadog
|
|
|
95
93
|
Datadog::Core::Telemetry::Logger.report(e)
|
|
96
94
|
end
|
|
97
95
|
|
|
98
|
-
def set_cache_key(span, key, multi_key)
|
|
96
|
+
def self.set_cache_key(span, key, multi_key)
|
|
99
97
|
if multi_key
|
|
100
98
|
keys = key.is_a?(Hash) ? key.keys : key # `write`s use Hashes, while `read`s use Arrays
|
|
101
99
|
resolved_key = keys.map { |k| ::ActiveSupport::Cache.expand_cache_key(k) }
|
|
@@ -130,7 +128,7 @@ module Datadog
|
|
|
130
128
|
#
|
|
131
129
|
# Also, this method caches the store name, given this value will be retrieve
|
|
132
130
|
# multiple times and involves string manipulation.
|
|
133
|
-
def cache_backend(store)
|
|
131
|
+
def self.cache_backend(store)
|
|
134
132
|
# Cache the backend name to avoid the expensive string manipulation required to calculate it.
|
|
135
133
|
# DEV: We can't store it directly in the `store` object because it is a frozen String.
|
|
136
134
|
if (name = @cache_backend[store])
|
|
@@ -13,17 +13,15 @@ module Datadog
|
|
|
13
13
|
Events::Cache,
|
|
14
14
|
].freeze
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def all
|
|
16
|
+
def self.all
|
|
19
17
|
self::ALL
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
def subscriptions
|
|
20
|
+
def self.subscriptions
|
|
23
21
|
all.collect(&:subscriptions).collect(&:to_a).flatten
|
|
24
22
|
end
|
|
25
23
|
|
|
26
|
-
def subscribe!
|
|
24
|
+
def self.subscribe!
|
|
27
25
|
all.each(&:subscribe!)
|
|
28
26
|
end
|
|
29
27
|
end
|
|
@@ -36,12 +36,10 @@ module Datadog
|
|
|
36
36
|
#
|
|
37
37
|
# Defines the deprecate monkey-patch instrumentation for `ActiveSupport::Cache::Store#fetch`
|
|
38
38
|
module Instrumentation
|
|
39
|
-
module_function
|
|
40
|
-
|
|
41
39
|
# @param action [String] type of cache operation. Will be set as the span resource.
|
|
42
40
|
# @param key [Object] redis cache key. Used for actions with a single key locator.
|
|
43
41
|
# @param multi_key [Array<Object>] list of redis cache keys. Used for actions with a multiple key locators.
|
|
44
|
-
def trace(action, store, key: nil, multi_key: nil)
|
|
42
|
+
def self.trace(action, store, key: nil, multi_key: nil)
|
|
45
43
|
return yield unless enabled?
|
|
46
44
|
|
|
47
45
|
# create a new ``Span`` and add it to the tracing context
|
|
@@ -70,18 +68,18 @@ module Datadog
|
|
|
70
68
|
# DEV-3.0: We should not have these checks in the 3.x series because ActiveSupport events provide more
|
|
71
69
|
# DEV-3.0: legible nested spans. While using ActiveSupport events, the nested spans actually provide meaningful
|
|
72
70
|
# DEV-3.0: information.
|
|
73
|
-
def nested_read?
|
|
71
|
+
def self.nested_read?
|
|
74
72
|
current_span = Tracing.active_span
|
|
75
73
|
current_span && current_span.name == Ext::SPAN_CACHE && current_span.resource == Ext::RESOURCE_CACHE_GET
|
|
76
74
|
end
|
|
77
75
|
|
|
78
76
|
# (see #nested_read?)
|
|
79
|
-
def nested_multiread?
|
|
77
|
+
def self.nested_multiread?
|
|
80
78
|
current_span = Tracing.active_span
|
|
81
79
|
current_span && current_span.name == Ext::SPAN_CACHE && current_span.resource == Ext::RESOURCE_CACHE_MGET
|
|
82
80
|
end
|
|
83
81
|
|
|
84
|
-
def set_cache_key(span, single_key, multi_key)
|
|
82
|
+
def self.set_cache_key(span, single_key, multi_key)
|
|
85
83
|
if multi_key
|
|
86
84
|
resolved_key = multi_key.map { |key| ::ActiveSupport::Cache.expand_cache_key(key) }
|
|
87
85
|
cache_key = Core::Utils.truncate(resolved_key, Ext::QUANTIZE_CACHE_MAX_KEY_SIZE)
|
|
@@ -93,7 +91,7 @@ module Datadog
|
|
|
93
91
|
end
|
|
94
92
|
end
|
|
95
93
|
|
|
96
|
-
def enabled?
|
|
94
|
+
def self.enabled?
|
|
97
95
|
Tracing.enabled? && Datadog.configuration.tracing[:active_support][:enabled]
|
|
98
96
|
end
|
|
99
97
|
|
|
@@ -13,13 +13,11 @@ module Datadog
|
|
|
13
13
|
module Patcher
|
|
14
14
|
include Contrib::Patcher
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def target_version
|
|
16
|
+
def self.target_version
|
|
19
17
|
Integration.version
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
def patch
|
|
20
|
+
def self.patch
|
|
23
21
|
Events.subscribe!
|
|
24
22
|
|
|
25
23
|
if Integration.version >= Gem::Version.new("8.0.0")
|
|
@@ -40,11 +38,11 @@ module Datadog
|
|
|
40
38
|
# This method is overwritten by
|
|
41
39
|
# `datadog/tracing/contrib/active_support/cache/redis.rb`
|
|
42
40
|
# with more complex behavior.
|
|
43
|
-
def cache_store_class(meth)
|
|
41
|
+
def self.cache_store_class(meth)
|
|
44
42
|
[::ActiveSupport::Cache::Store]
|
|
45
43
|
end
|
|
46
44
|
|
|
47
|
-
def patch_legacy_cache_store
|
|
45
|
+
def self.patch_legacy_cache_store
|
|
48
46
|
cache_store_class(:read_multi).each { |clazz| clazz.prepend(Cache::Instrumentation::ReadMulti) }
|
|
49
47
|
cache_store_class(:fetch).each { |clazz| clazz.prepend(Cache::Instrumentation::Fetch) }
|
|
50
48
|
cache_store_class(:fetch_multi).each { |clazz| clazz.prepend(Cache::Instrumentation::FetchMulti) }
|
|
@@ -7,24 +7,22 @@ module Datadog
|
|
|
7
7
|
module Contrib
|
|
8
8
|
# Defines analytics behavior for integrations
|
|
9
9
|
module Analytics
|
|
10
|
-
module_function
|
|
11
|
-
|
|
12
10
|
# Applies Analytics sampling rate, if applicable for this Contrib::Configuration.
|
|
13
|
-
def set_rate!(span, configuration)
|
|
11
|
+
def self.set_rate!(span, configuration)
|
|
14
12
|
set_sample_rate(span, configuration[:analytics_sample_rate]) if enabled?(configuration[:analytics_enabled])
|
|
15
13
|
end
|
|
16
14
|
|
|
17
15
|
# Checks whether analytics should be enabled.
|
|
18
16
|
# `flag` is a truthy/falsey value that represents a setting on the integration.
|
|
19
|
-
def enabled?(flag = nil)
|
|
17
|
+
def self.enabled?(flag = nil)
|
|
20
18
|
(Datadog.configuration.tracing.analytics.enabled && flag != false) || flag == true
|
|
21
19
|
end
|
|
22
20
|
|
|
23
|
-
def set_sample_rate(span, sample_rate)
|
|
21
|
+
def self.set_sample_rate(span, sample_rate)
|
|
24
22
|
Tracing::Analytics.set_sample_rate(span, sample_rate)
|
|
25
23
|
end
|
|
26
24
|
|
|
27
|
-
def set_measured(span, value = true)
|
|
25
|
+
def self.set_measured(span, value = true)
|
|
28
26
|
Tracing::Analytics.set_measured(span, value)
|
|
29
27
|
end
|
|
30
28
|
end
|
|
@@ -11,13 +11,11 @@ module Datadog
|
|
|
11
11
|
module Patcher
|
|
12
12
|
include Contrib::Patcher
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def target_version
|
|
14
|
+
def self.target_version
|
|
17
15
|
Integration.version
|
|
18
16
|
end
|
|
19
17
|
|
|
20
|
-
def patch
|
|
18
|
+
def self.patch
|
|
21
19
|
require_relative "parsed_context"
|
|
22
20
|
require_relative "instrumentation"
|
|
23
21
|
require_relative "services"
|
|
@@ -29,11 +27,11 @@ module Datadog
|
|
|
29
27
|
::Aws::S3::Presigner.prepend(S3Presigner) if defined?(::Aws::S3::Presigner)
|
|
30
28
|
end
|
|
31
29
|
|
|
32
|
-
def add_plugin(*targets)
|
|
30
|
+
def self.add_plugin(*targets)
|
|
33
31
|
targets.each { |klass| klass.add_plugin(Instrumentation) }
|
|
34
32
|
end
|
|
35
33
|
|
|
36
|
-
def loaded_constants
|
|
34
|
+
def self.loaded_constants
|
|
37
35
|
# Cross-check services against loaded AWS constants
|
|
38
36
|
# Module#const_get can return a constant from ancestors when there's a miss.
|
|
39
37
|
# If this conincidentally matches another constant, it will attempt to patch
|
|
@@ -51,7 +49,7 @@ module Datadog
|
|
|
51
49
|
end
|
|
52
50
|
end
|
|
53
51
|
|
|
54
|
-
def get_option(option)
|
|
52
|
+
def self.get_option(option)
|
|
55
53
|
Datadog.configuration.tracing[:aws].get_option(option)
|
|
56
54
|
end
|
|
57
55
|
end
|
|
@@ -10,13 +10,11 @@ module Datadog
|
|
|
10
10
|
module Patcher
|
|
11
11
|
include Contrib::Patcher
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def target_version
|
|
13
|
+
def self.target_version
|
|
16
14
|
Integration.version
|
|
17
15
|
end
|
|
18
16
|
|
|
19
|
-
def patch
|
|
17
|
+
def self.patch
|
|
20
18
|
require_relative "future_patch"
|
|
21
19
|
patch_future
|
|
22
20
|
require_relative "promises_future_patch"
|
|
@@ -26,7 +24,7 @@ module Datadog
|
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
# Propagate tracing context in Concurrent::Async
|
|
29
|
-
def async_patch
|
|
27
|
+
def self.async_patch
|
|
30
28
|
if defined?(::Concurrent::Async)
|
|
31
29
|
# NOTE: AsyncDelegator is a private constant
|
|
32
30
|
::Concurrent::Async.const_get(:AsyncDelegator).prepend(AsyncPatch)
|
|
@@ -34,12 +32,12 @@ module Datadog
|
|
|
34
32
|
end
|
|
35
33
|
|
|
36
34
|
# Propagate tracing context in Concurrent::Future
|
|
37
|
-
def patch_future
|
|
35
|
+
def self.patch_future
|
|
38
36
|
::Concurrent::Future.prepend(FuturePatch) if defined?(::Concurrent::Future)
|
|
39
37
|
end
|
|
40
38
|
|
|
41
39
|
# Propagate tracing context in Concurrent::Promises::Future
|
|
42
|
-
def patch_promises_future
|
|
40
|
+
def self.patch_promises_future
|
|
43
41
|
::Concurrent::Promises.singleton_class.prepend(PromisesFuturePatch) if defined?(::Concurrent::Promises::Future)
|
|
44
42
|
end
|
|
45
43
|
end
|
|
@@ -36,6 +36,23 @@ module Datadog
|
|
|
36
36
|
def []=(name, value)
|
|
37
37
|
respond_to?("#{name}=") ? send("#{name}=", value) : set_option(name, value)
|
|
38
38
|
end
|
|
39
|
+
|
|
40
|
+
# Copies the named options that are configured on another integration's settings,
|
|
41
|
+
# keeping the precedence of each value. Options still at their default on the
|
|
42
|
+
# source are left unchanged, and a copied value does not replace a value of higher
|
|
43
|
+
# precedence.
|
|
44
|
+
#
|
|
45
|
+
# @param source_settings settings of the integration to copy values from
|
|
46
|
+
# @param option_names names of the options, identical on both integrations
|
|
47
|
+
# @!visibility private
|
|
48
|
+
def copy_configured_options(source_settings, option_names)
|
|
49
|
+
option_names.each do |name|
|
|
50
|
+
next if source_settings.using_default?(name)
|
|
51
|
+
|
|
52
|
+
precedence = source_settings.options.fetch(name).precedence_set
|
|
53
|
+
set_option(name, source_settings[name], precedence: precedence)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
39
56
|
end
|
|
40
57
|
end
|
|
41
58
|
end
|
|
@@ -12,13 +12,11 @@ module Datadog
|
|
|
12
12
|
module Patcher
|
|
13
13
|
include Contrib::Patcher
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def target_version
|
|
15
|
+
def self.target_version
|
|
18
16
|
Integration.version
|
|
19
17
|
end
|
|
20
18
|
|
|
21
|
-
def patch
|
|
19
|
+
def self.patch
|
|
22
20
|
Integration.dalli_class.include(Instrumentation)
|
|
23
21
|
end
|
|
24
22
|
end
|
|
@@ -8,9 +8,7 @@ module Datadog
|
|
|
8
8
|
module Dalli
|
|
9
9
|
# Quantize contains dalli-specic quantization tools.
|
|
10
10
|
module Quantize
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def format_command(operation, args)
|
|
11
|
+
def self.format_command(operation, args)
|
|
14
12
|
placeholder = "#{operation} BLOB (OMITTED)"
|
|
15
13
|
command = [operation, *args].join(" ").strip
|
|
16
14
|
command = Core::Utils.utf8_encode(command, binary: true, placeholder: placeholder)
|
|
@@ -10,23 +10,21 @@ module Datadog
|
|
|
10
10
|
module Patcher
|
|
11
11
|
include Contrib::Patcher
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def target_version
|
|
13
|
+
def self.target_version
|
|
16
14
|
Integration.version
|
|
17
15
|
end
|
|
18
16
|
|
|
19
|
-
def patch
|
|
17
|
+
def self.patch
|
|
20
18
|
require_relative "plugin"
|
|
21
19
|
add_instrumentation(::Delayed::Worker)
|
|
22
20
|
patch_server_internals
|
|
23
21
|
end
|
|
24
22
|
|
|
25
|
-
def add_instrumentation(klass)
|
|
23
|
+
def self.add_instrumentation(klass)
|
|
26
24
|
klass.plugins << Plugin
|
|
27
25
|
end
|
|
28
26
|
|
|
29
|
-
def patch_server_internals
|
|
27
|
+
def self.patch_server_internals
|
|
30
28
|
require_relative "server_internal_tracer/worker"
|
|
31
29
|
::Delayed::Worker.prepend(ServerInternalTracer::Worker)
|
|
32
30
|
end
|
|
@@ -15,13 +15,11 @@ module Datadog
|
|
|
15
15
|
module Patcher
|
|
16
16
|
include Contrib::Patcher
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
def target_version
|
|
18
|
+
def self.target_version
|
|
21
19
|
Integration.version
|
|
22
20
|
end
|
|
23
21
|
|
|
24
|
-
def patch
|
|
22
|
+
def self.patch
|
|
25
23
|
require "uri"
|
|
26
24
|
require "json"
|
|
27
25
|
require_relative "quantize"
|
|
@@ -154,7 +152,7 @@ module Datadog
|
|
|
154
152
|
|
|
155
153
|
# `Elasticsearch` namespace renamed to `Elastic` in version 8.0.0 of the transport gem:
|
|
156
154
|
# @see https://github.com/elastic/elastic-transport-ruby/commit/ef804cbbd284f2a82d825221f87124f8b5ff823c
|
|
157
|
-
def transport_module
|
|
155
|
+
def self.transport_module
|
|
158
156
|
if Integration.version >= Gem::Version.new("8.0.0")
|
|
159
157
|
::Elastic::Transport
|
|
160
158
|
else
|
|
@@ -18,20 +18,18 @@ module Datadog
|
|
|
18
18
|
placeholder: PLACEHOLDER,
|
|
19
19
|
}.freeze
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
def format_url(url)
|
|
21
|
+
def self.format_url(url)
|
|
24
22
|
sanitize_fragment_with_id(url)
|
|
25
23
|
.gsub(/(?:\d+)/, PLACEHOLDER)
|
|
26
24
|
end
|
|
27
25
|
|
|
28
|
-
def format_body(body, options = {})
|
|
26
|
+
def self.format_body(body, options = {})
|
|
29
27
|
format_body!(body, options)
|
|
30
28
|
rescue
|
|
31
29
|
options[:placeholder] || PLACEHOLDER
|
|
32
30
|
end
|
|
33
31
|
|
|
34
|
-
def format_body!(body, options = {})
|
|
32
|
+
def self.format_body!(body, options = {})
|
|
35
33
|
options = merge_options(DEFAULT_OPTIONS, options)
|
|
36
34
|
|
|
37
35
|
# Determine if bulk query or not, based on content
|
|
@@ -45,7 +43,7 @@ module Datadog
|
|
|
45
43
|
end.join("\n")
|
|
46
44
|
end
|
|
47
45
|
|
|
48
|
-
def merge_options(original, additional)
|
|
46
|
+
def self.merge_options(original, additional)
|
|
49
47
|
{}.tap do |options|
|
|
50
48
|
# Show
|
|
51
49
|
# If either is :all, value becomes :all
|
|
@@ -63,7 +61,7 @@ module Datadog
|
|
|
63
61
|
# Parses a JSON object from a string, passes its value
|
|
64
62
|
# to the block provided, and dumps its result back to JSON.
|
|
65
63
|
# If JSON parsing fails, it prints fail_value.
|
|
66
|
-
def reserialize_json(string, fail_value = PLACEHOLDER)
|
|
64
|
+
def self.reserialize_json(string, fail_value = PLACEHOLDER)
|
|
67
65
|
return string unless block_given?
|
|
68
66
|
|
|
69
67
|
begin
|
|
@@ -77,7 +75,7 @@ module Datadog
|
|
|
77
75
|
# Sanitizes URL fragment by changing it to ? whenever a number is detected
|
|
78
76
|
# This is meant as simple heuristic that attempts to detect if particular fragment
|
|
79
77
|
# represents document Id. This is meant to reduce the cardinality in most frequent cases.
|
|
80
|
-
def sanitize_fragment_with_id(url)
|
|
78
|
+
def self.sanitize_fragment_with_id(url)
|
|
81
79
|
url.gsub(%r{^(/?[^/]*/[^/]*/)(?:[^?/\d]*\d+[^?/]*)}, ID_PLACEHOLDER)
|
|
82
80
|
end
|
|
83
81
|
end
|
|
@@ -10,13 +10,11 @@ module Datadog
|
|
|
10
10
|
module Patcher
|
|
11
11
|
include Contrib::Patcher
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def target_version
|
|
13
|
+
def self.target_version
|
|
16
14
|
Integration.version
|
|
17
15
|
end
|
|
18
16
|
|
|
19
|
-
def patch
|
|
17
|
+
def self.patch
|
|
20
18
|
require_relative "easy_patch"
|
|
21
19
|
require_relative "multi_patch"
|
|
22
20
|
|
|
@@ -10,18 +10,16 @@ module Datadog
|
|
|
10
10
|
module Patcher
|
|
11
11
|
include Contrib::Patcher
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def target_version
|
|
13
|
+
def self.target_version
|
|
16
14
|
Integration.version
|
|
17
15
|
end
|
|
18
16
|
|
|
19
|
-
def patch
|
|
17
|
+
def self.patch
|
|
20
18
|
require_relative "middleware"
|
|
21
19
|
add_middleware
|
|
22
20
|
end
|
|
23
21
|
|
|
24
|
-
def add_middleware
|
|
22
|
+
def self.add_middleware
|
|
25
23
|
::Excon.defaults[:middlewares] = Middleware.around_default_stack
|
|
26
24
|
end
|
|
27
25
|
end
|
|
@@ -13,24 +13,22 @@ module Datadog
|
|
|
13
13
|
module Patcher
|
|
14
14
|
include Contrib::Patcher
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def target_version
|
|
16
|
+
def self.target_version
|
|
19
17
|
Integration.version
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
def patch
|
|
20
|
+
def self.patch
|
|
23
21
|
require_relative "middleware"
|
|
24
22
|
|
|
25
23
|
register_middleware!
|
|
26
24
|
add_default_middleware!
|
|
27
25
|
end
|
|
28
26
|
|
|
29
|
-
def register_middleware!
|
|
27
|
+
def self.register_middleware!
|
|
30
28
|
::Faraday::Middleware.register_middleware(datadog_tracing: Middleware)
|
|
31
29
|
end
|
|
32
30
|
|
|
33
|
-
def add_default_middleware!
|
|
31
|
+
def self.add_default_middleware!
|
|
34
32
|
if target_version >= Gem::Version.new("1.0.0")
|
|
35
33
|
# Patch the default connection (e.g. +Faraday.get+)
|
|
36
34
|
::Faraday.default_connection.use(:datadog_tracing)
|
|
@@ -13,13 +13,11 @@ module Datadog
|
|
|
13
13
|
module Patcher
|
|
14
14
|
include Contrib::Patcher
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def target_version
|
|
16
|
+
def self.target_version
|
|
19
17
|
Integration.version
|
|
20
18
|
end
|
|
21
19
|
|
|
22
|
-
def patch
|
|
20
|
+
def self.patch
|
|
23
21
|
# Patch endpoints
|
|
24
22
|
::Grape::Endpoint.prepend(Instrumentation::InstanceMethods)
|
|
25
23
|
if target_version < Gem::Version.new("3.0.0")
|
|
@@ -14,13 +14,11 @@ module Datadog
|
|
|
14
14
|
module Patcher
|
|
15
15
|
include Contrib::Patcher
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def target_version
|
|
17
|
+
def self.target_version
|
|
20
18
|
Integration.version
|
|
21
19
|
end
|
|
22
20
|
|
|
23
|
-
def patch
|
|
21
|
+
def self.patch
|
|
24
22
|
# DEV-3.0: We should remove as many patching options as possible, given the alternatives do not
|
|
25
23
|
# DEV-3.0: provide any benefit to the recommended `with_unified_tracer` patching method.
|
|
26
24
|
# DEV-3.0: `with_deprecated_tracer` is likely safe to remove.
|
|
@@ -44,11 +42,11 @@ module Datadog
|
|
|
44
42
|
end
|
|
45
43
|
end
|
|
46
44
|
|
|
47
|
-
def configuration
|
|
45
|
+
def self.configuration
|
|
48
46
|
Datadog.configuration.tracing[:graphql]
|
|
49
47
|
end
|
|
50
48
|
|
|
51
|
-
def schemas
|
|
49
|
+
def self.schemas
|
|
52
50
|
configuration[:schemas]
|
|
53
51
|
end
|
|
54
52
|
end
|
|
@@ -6,9 +6,7 @@ module Datadog
|
|
|
6
6
|
module GraphQL
|
|
7
7
|
# Provides instrumentation for `graphql` through with GraphQL's trace
|
|
8
8
|
module TracePatcher
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def patch!(schemas)
|
|
9
|
+
def self.patch!(schemas)
|
|
12
10
|
if schemas.empty?
|
|
13
11
|
::GraphQL::Schema.trace_with(::GraphQL::Tracing::DataDogTrace)
|
|
14
12
|
else
|