ddtrace 1.14.0 → 1.15.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 +178 -2
- data/ext/ddtrace_profiling_native_extension/NativeExtensionDesign.md +3 -5
- data/ext/ddtrace_profiling_native_extension/clock_id.h +0 -3
- data/ext/ddtrace_profiling_native_extension/clock_id_from_pthread.c +0 -22
- data/ext/ddtrace_profiling_native_extension/clock_id_noop.c +0 -1
- data/ext/ddtrace_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +41 -6
- data/ext/ddtrace_profiling_native_extension/collectors_idle_sampling_helper.c +3 -0
- data/ext/ddtrace_profiling_native_extension/collectors_stack.c +76 -24
- data/ext/ddtrace_profiling_native_extension/collectors_stack.h +1 -1
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.c +207 -32
- data/ext/ddtrace_profiling_native_extension/collectors_thread_context.h +1 -1
- data/ext/ddtrace_profiling_native_extension/extconf.rb +8 -2
- data/ext/ddtrace_profiling_native_extension/http_transport.c +26 -10
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.c +42 -0
- data/ext/ddtrace_profiling_native_extension/libdatadog_helpers.h +6 -0
- data/ext/ddtrace_profiling_native_extension/native_extension_helpers.rb +1 -16
- data/ext/ddtrace_profiling_native_extension/pid_controller.c +57 -0
- data/ext/ddtrace_profiling_native_extension/pid_controller.h +45 -0
- data/ext/ddtrace_profiling_native_extension/private_vm_api_access.c +17 -12
- data/ext/ddtrace_profiling_native_extension/profiling.c +0 -2
- data/ext/ddtrace_profiling_native_extension/stack_recorder.c +74 -37
- data/ext/ddtrace_profiling_native_extension/stack_recorder.h +13 -3
- data/lib/datadog/appsec/assets/waf_rules/processors.json +92 -0
- data/lib/datadog/appsec/assets/waf_rules/recommended.json +698 -75
- data/lib/datadog/appsec/assets/waf_rules/scanners.json +114 -0
- data/lib/datadog/appsec/assets/waf_rules/strict.json +98 -8
- data/lib/datadog/appsec/assets.rb +8 -0
- data/lib/datadog/appsec/component.rb +9 -2
- data/lib/datadog/appsec/configuration/settings.rb +61 -2
- data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +8 -6
- data/lib/datadog/appsec/contrib/rack/reactive/request.rb +2 -7
- data/lib/datadog/appsec/contrib/rack/reactive/request_body.rb +2 -5
- data/lib/datadog/appsec/contrib/rack/reactive/response.rb +2 -5
- data/lib/datadog/appsec/contrib/rack/request_body_middleware.rb +3 -2
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +23 -9
- data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +3 -2
- data/lib/datadog/appsec/contrib/rails/patcher.rb +9 -3
- data/lib/datadog/appsec/contrib/rails/reactive/action.rb +2 -5
- data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +6 -4
- data/lib/datadog/appsec/contrib/sinatra/patcher.rb +13 -7
- data/lib/datadog/appsec/contrib/sinatra/reactive/routed.rb +2 -5
- data/lib/datadog/appsec/event.rb +106 -50
- data/lib/datadog/appsec/monitor/gateway/watcher.rb +3 -3
- data/lib/datadog/appsec/monitor/reactive/set_user.rb +2 -5
- data/lib/datadog/appsec/processor/actions.rb +49 -0
- data/lib/datadog/appsec/processor/rule_merger.rb +22 -2
- data/lib/datadog/appsec/processor.rb +34 -6
- data/lib/datadog/appsec/remote.rb +4 -1
- data/lib/datadog/appsec/response.rb +82 -4
- data/lib/datadog/appsec/sample_rate.rb +21 -0
- data/lib/datadog/appsec.rb +2 -2
- data/lib/datadog/core/configuration/agent_settings_resolver.rb +29 -24
- data/lib/datadog/core/configuration/base.rb +1 -11
- data/lib/datadog/core/configuration/components.rb +7 -2
- data/lib/datadog/core/configuration/ext.rb +21 -0
- data/lib/datadog/core/configuration/option.rb +2 -4
- data/lib/datadog/core/configuration/option_definition.rb +17 -41
- data/lib/datadog/core/configuration/options.rb +5 -5
- data/lib/datadog/core/configuration/settings.rb +47 -45
- data/lib/datadog/core/environment/execution.rb +47 -9
- data/lib/datadog/core/environment/variable_helpers.rb +0 -69
- data/lib/datadog/core/error.rb +1 -0
- data/lib/datadog/core/git/ext.rb +2 -0
- data/lib/datadog/core/remote/client/capabilities.rb +1 -1
- data/lib/datadog/core/remote/component.rb +2 -2
- data/lib/datadog/core/remote/negotiation.rb +2 -2
- data/lib/datadog/core/remote/transport/config.rb +60 -0
- data/lib/datadog/core/remote/transport/http/api/instance.rb +39 -0
- data/lib/datadog/core/remote/transport/http/api/spec.rb +21 -0
- data/lib/datadog/core/remote/transport/http/api.rb +58 -0
- data/lib/datadog/core/remote/transport/http/builder.rb +219 -0
- data/lib/datadog/core/remote/transport/http/client.rb +48 -0
- data/lib/datadog/core/remote/transport/http/config.rb +280 -0
- data/lib/datadog/core/remote/transport/http/negotiation.rb +146 -0
- data/lib/datadog/core/remote/transport/http.rb +179 -0
- data/lib/datadog/core/{transport → remote/transport}/negotiation.rb +25 -23
- data/lib/datadog/core/telemetry/collector.rb +3 -2
- data/lib/datadog/core/telemetry/http/transport.rb +2 -1
- data/lib/datadog/core/transport/ext.rb +47 -0
- data/lib/datadog/core/transport/http/adapters/net.rb +168 -0
- data/lib/datadog/core/transport/http/adapters/registry.rb +29 -0
- data/lib/datadog/core/transport/http/adapters/test.rb +89 -0
- data/lib/datadog/core/transport/http/adapters/unix_socket.rb +83 -0
- data/lib/datadog/core/transport/http/api/endpoint.rb +31 -0
- data/lib/datadog/core/transport/http/api/fallbacks.rb +26 -0
- data/lib/datadog/core/transport/http/api/map.rb +18 -0
- data/lib/datadog/core/transport/http/env.rb +62 -0
- data/lib/datadog/core/transport/http/response.rb +60 -0
- data/lib/datadog/core/transport/parcel.rb +22 -0
- data/lib/datadog/core/transport/request.rb +17 -0
- data/lib/datadog/core/transport/response.rb +64 -0
- data/lib/datadog/core/workers/polling.rb +2 -2
- data/lib/datadog/opentelemetry/api/context.rb +10 -3
- data/lib/datadog/opentelemetry/sdk/propagator.rb +2 -1
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +14 -2
- data/lib/datadog/opentelemetry/sdk/trace/span.rb +68 -0
- data/lib/datadog/opentelemetry/trace.rb +58 -0
- data/lib/datadog/opentelemetry.rb +1 -0
- data/lib/datadog/opentracer.rb +9 -0
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +12 -18
- data/lib/datadog/profiling/collectors/idle_sampling_helper.rb +1 -1
- data/lib/datadog/profiling/collectors/thread_context.rb +9 -1
- data/lib/datadog/profiling/component.rb +24 -99
- data/lib/datadog/profiling/ext.rb +0 -12
- data/lib/datadog/profiling/flush.rb +0 -3
- data/lib/datadog/profiling/http_transport.rb +6 -3
- data/lib/datadog/profiling/native_extension.rb +0 -21
- data/lib/datadog/profiling/profiler.rb +11 -12
- data/lib/datadog/profiling.rb +8 -81
- data/lib/datadog/tracing/component.rb +10 -4
- data/lib/datadog/tracing/configuration/agent_settings_resolver.rb +13 -0
- data/lib/datadog/tracing/configuration/ext.rb +4 -2
- data/lib/datadog/tracing/configuration/settings.rb +14 -7
- data/lib/datadog/tracing/contrib/action_pack/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_job/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/events/sql.rb +4 -0
- data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +104 -197
- data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +3 -0
- data/lib/datadog/tracing/contrib/aws/instrumentation.rb +7 -0
- data/lib/datadog/tracing/contrib/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/dalli/configuration/settings.rb +6 -0
- data/lib/datadog/tracing/contrib/dalli/ext.rb +7 -0
- data/lib/datadog/tracing/contrib/dalli/instrumentation.rb +9 -2
- data/lib/datadog/tracing/contrib/delayed_job/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/elasticsearch/patcher.rb +5 -0
- data/lib/datadog/tracing/contrib/ethon/easy_patch.rb +5 -0
- data/lib/datadog/tracing/contrib/ethon/multi_patch.rb +8 -0
- data/lib/datadog/tracing/contrib/excon/middleware.rb +5 -0
- data/lib/datadog/tracing/contrib/ext.rb +3 -0
- data/lib/datadog/tracing/contrib/faraday/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/faraday/middleware.rb +5 -0
- data/lib/datadog/tracing/contrib/grpc/configuration/settings.rb +21 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +11 -1
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +18 -0
- data/lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb +0 -4
- data/lib/datadog/tracing/contrib/http/circuit_breaker.rb +3 -3
- data/lib/datadog/tracing/contrib/http/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/httpclient/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/httprb/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/mongodb/subscribers.rb +7 -0
- data/lib/datadog/tracing/contrib/mysql2/instrumentation.rb +13 -3
- data/lib/datadog/tracing/contrib/opensearch/integration.rb +2 -2
- data/lib/datadog/tracing/contrib/opensearch/patcher.rb +7 -0
- data/lib/datadog/tracing/contrib/pg/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/presto/instrumentation.rb +5 -0
- data/lib/datadog/tracing/contrib/propagation/sql_comment.rb +1 -1
- data/lib/datadog/tracing/contrib/que/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/racecar/event.rb +5 -0
- data/lib/datadog/tracing/contrib/rack/header_tagging.rb +14 -4
- data/lib/datadog/tracing/contrib/rails/configuration/settings.rb +4 -4
- data/lib/datadog/tracing/contrib/rake/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/redis/tags.rb +5 -0
- data/lib/datadog/tracing/contrib/resque/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/rest_client/request_patch.rb +5 -0
- data/lib/datadog/tracing/contrib/sequel/utils.rb +5 -0
- data/lib/datadog/tracing/contrib/shoryuken/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/sidekiq/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/sneakers/configuration/settings.rb +1 -1
- data/lib/datadog/tracing/contrib/utils/quantization/http.rb +2 -2
- data/lib/datadog/tracing/distributed/propagation.rb +13 -33
- data/lib/datadog/tracing/metadata/tagging.rb +3 -3
- data/lib/datadog/tracing/sync_writer.rb +3 -3
- data/lib/datadog/tracing/tracer.rb +2 -0
- data/lib/datadog/{core → tracing}/transport/http/api/instance.rb +1 -1
- data/lib/datadog/{core → tracing}/transport/http/api/spec.rb +1 -1
- data/lib/datadog/tracing/transport/http/api.rb +43 -0
- data/lib/datadog/{core → tracing}/transport/http/builder.rb +13 -68
- data/lib/datadog/tracing/transport/http/client.rb +57 -0
- data/lib/datadog/tracing/transport/http/statistics.rb +47 -0
- data/lib/datadog/tracing/transport/http/traces.rb +152 -0
- data/lib/datadog/tracing/transport/http.rb +124 -0
- data/lib/datadog/tracing/transport/io/client.rb +89 -0
- data/lib/datadog/tracing/transport/io/response.rb +27 -0
- data/lib/datadog/tracing/transport/io/traces.rb +101 -0
- data/lib/datadog/tracing/transport/io.rb +30 -0
- data/lib/datadog/tracing/transport/serializable_trace.rb +126 -0
- data/lib/datadog/tracing/transport/statistics.rb +77 -0
- data/lib/datadog/tracing/transport/trace_formatter.rb +209 -0
- data/lib/datadog/tracing/transport/traces.rb +224 -0
- data/lib/datadog/tracing/workers/trace_writer.rb +5 -3
- data/lib/datadog/tracing/workers.rb +3 -2
- data/lib/datadog/tracing/writer.rb +5 -2
- data/lib/ddtrace/transport/ext.rb +17 -15
- data/lib/ddtrace/version.rb +1 -1
- data/lib/ddtrace.rb +1 -1
- metadata +72 -96
- data/lib/datadog/ci/configuration/components.rb +0 -32
- data/lib/datadog/ci/configuration/settings.rb +0 -51
- data/lib/datadog/ci/contrib/cucumber/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/cucumber/ext.rb +0 -22
- data/lib/datadog/ci/contrib/cucumber/formatter.rb +0 -94
- data/lib/datadog/ci/contrib/cucumber/instrumentation.rb +0 -28
- data/lib/datadog/ci/contrib/cucumber/integration.rb +0 -47
- data/lib/datadog/ci/contrib/cucumber/patcher.rb +0 -27
- data/lib/datadog/ci/contrib/minitest/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/minitest/ext.rb +0 -21
- data/lib/datadog/ci/contrib/minitest/integration.rb +0 -49
- data/lib/datadog/ci/contrib/minitest/patcher.rb +0 -27
- data/lib/datadog/ci/contrib/minitest/test_helper.rb +0 -68
- data/lib/datadog/ci/contrib/rspec/configuration/settings.rb +0 -35
- data/lib/datadog/ci/contrib/rspec/example.rb +0 -68
- data/lib/datadog/ci/contrib/rspec/ext.rb +0 -21
- data/lib/datadog/ci/contrib/rspec/integration.rb +0 -48
- data/lib/datadog/ci/contrib/rspec/patcher.rb +0 -27
- data/lib/datadog/ci/ext/app_types.rb +0 -9
- data/lib/datadog/ci/ext/environment.rb +0 -575
- data/lib/datadog/ci/ext/settings.rb +0 -10
- data/lib/datadog/ci/ext/test.rb +0 -35
- data/lib/datadog/ci/extensions.rb +0 -19
- data/lib/datadog/ci/flush.rb +0 -38
- data/lib/datadog/ci/test.rb +0 -81
- data/lib/datadog/ci.rb +0 -21
- data/lib/datadog/core/configuration/dependency_resolver.rb +0 -28
- data/lib/datadog/core/configuration/option_definition_set.rb +0 -22
- data/lib/datadog/core/configuration/option_set.rb +0 -10
- data/lib/datadog/core/transport/config.rb +0 -58
- data/lib/datadog/core/transport/http/api.rb +0 -57
- data/lib/datadog/core/transport/http/client.rb +0 -45
- data/lib/datadog/core/transport/http/config.rb +0 -278
- data/lib/datadog/core/transport/http/negotiation.rb +0 -144
- data/lib/datadog/core/transport/http.rb +0 -169
- data/lib/datadog/core/utils/object_set.rb +0 -43
- data/lib/datadog/core/utils/string_table.rb +0 -47
- data/lib/datadog/profiling/backtrace_location.rb +0 -34
- data/lib/datadog/profiling/buffer.rb +0 -43
- data/lib/datadog/profiling/collectors/old_stack.rb +0 -301
- data/lib/datadog/profiling/encoding/profile.rb +0 -41
- data/lib/datadog/profiling/event.rb +0 -15
- data/lib/datadog/profiling/events/stack.rb +0 -82
- data/lib/datadog/profiling/old_recorder.rb +0 -107
- data/lib/datadog/profiling/pprof/builder.rb +0 -125
- data/lib/datadog/profiling/pprof/converter.rb +0 -102
- data/lib/datadog/profiling/pprof/message_set.rb +0 -16
- data/lib/datadog/profiling/pprof/payload.rb +0 -20
- data/lib/datadog/profiling/pprof/pprof.proto +0 -212
- data/lib/datadog/profiling/pprof/pprof_pb.rb +0 -81
- data/lib/datadog/profiling/pprof/stack_sample.rb +0 -139
- data/lib/datadog/profiling/pprof/string_table.rb +0 -12
- data/lib/datadog/profiling/pprof/template.rb +0 -118
- data/lib/datadog/profiling/trace_identifiers/ddtrace.rb +0 -43
- data/lib/datadog/profiling/trace_identifiers/helper.rb +0 -45
- data/lib/ddtrace/transport/http/adapters/net.rb +0 -168
- data/lib/ddtrace/transport/http/adapters/registry.rb +0 -27
- data/lib/ddtrace/transport/http/adapters/test.rb +0 -85
- data/lib/ddtrace/transport/http/adapters/unix_socket.rb +0 -77
- data/lib/ddtrace/transport/http/api/endpoint.rb +0 -29
- data/lib/ddtrace/transport/http/api/fallbacks.rb +0 -24
- data/lib/ddtrace/transport/http/api/instance.rb +0 -35
- data/lib/ddtrace/transport/http/api/map.rb +0 -16
- data/lib/ddtrace/transport/http/api/spec.rb +0 -17
- data/lib/ddtrace/transport/http/api.rb +0 -39
- data/lib/ddtrace/transport/http/builder.rb +0 -176
- data/lib/ddtrace/transport/http/client.rb +0 -52
- data/lib/ddtrace/transport/http/env.rb +0 -58
- data/lib/ddtrace/transport/http/response.rb +0 -58
- data/lib/ddtrace/transport/http/statistics.rb +0 -43
- data/lib/ddtrace/transport/http/traces.rb +0 -144
- data/lib/ddtrace/transport/http.rb +0 -117
- data/lib/ddtrace/transport/io/client.rb +0 -85
- data/lib/ddtrace/transport/io/response.rb +0 -25
- data/lib/ddtrace/transport/io/traces.rb +0 -99
- data/lib/ddtrace/transport/io.rb +0 -28
- data/lib/ddtrace/transport/parcel.rb +0 -20
- data/lib/ddtrace/transport/request.rb +0 -15
- data/lib/ddtrace/transport/response.rb +0 -60
- data/lib/ddtrace/transport/serializable_trace.rb +0 -122
- data/lib/ddtrace/transport/statistics.rb +0 -75
- data/lib/ddtrace/transport/trace_formatter.rb +0 -207
- data/lib/ddtrace/transport/traces.rb +0 -216
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../tracing/contrib/patcher'
|
4
|
-
require_relative 'instrumentation'
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module CI
|
8
|
-
module Contrib
|
9
|
-
module Cucumber
|
10
|
-
# Patcher enables patching of 'cucumber' module.
|
11
|
-
module Patcher
|
12
|
-
include Datadog::Tracing::Contrib::Patcher
|
13
|
-
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def target_version
|
17
|
-
Integration.version
|
18
|
-
end
|
19
|
-
|
20
|
-
def patch
|
21
|
-
::Cucumber::Runtime.include(Instrumentation)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../../tracing/contrib/configuration/settings'
|
4
|
-
require_relative '../ext'
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module CI
|
8
|
-
module Contrib
|
9
|
-
module Minitest
|
10
|
-
module Configuration
|
11
|
-
# Custom settings for the Minitest integration
|
12
|
-
# TODO: mark as `@public_api` when GA
|
13
|
-
class Settings < Datadog::Tracing::Contrib::Configuration::Settings
|
14
|
-
option :enabled do |o|
|
15
|
-
o.type :bool
|
16
|
-
o.env Ext::ENV_ENABLED
|
17
|
-
o.default true
|
18
|
-
end
|
19
|
-
|
20
|
-
option :service_name do |o|
|
21
|
-
o.type :string
|
22
|
-
o.default { Datadog.configuration.service_without_fallback || Ext::SERVICE_NAME }
|
23
|
-
end
|
24
|
-
|
25
|
-
option :operation_name do |o|
|
26
|
-
o.type :string
|
27
|
-
o.env Ext::ENV_OPERATION_NAME
|
28
|
-
o.default Ext::OPERATION_NAME
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module CI
|
5
|
-
module Contrib
|
6
|
-
module Minitest
|
7
|
-
# Minitest integration constants
|
8
|
-
# TODO: mark as `@public_api` when GA, to protect from resource and tag name changes.
|
9
|
-
module Ext
|
10
|
-
APP = 'minitest'
|
11
|
-
ENV_ENABLED = 'DD_TRACE_MINITEST_ENABLED'
|
12
|
-
ENV_OPERATION_NAME = 'DD_TRACE_MINITEST_OPERATION_NAME'
|
13
|
-
FRAMEWORK = 'minitest'
|
14
|
-
OPERATION_NAME = 'minitest.test'
|
15
|
-
SERVICE_NAME = 'minitest'
|
16
|
-
TEST_TYPE = 'test'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../tracing/contrib/integration'
|
4
|
-
|
5
|
-
require_relative 'configuration/settings'
|
6
|
-
require_relative 'patcher'
|
7
|
-
|
8
|
-
module Datadog
|
9
|
-
module CI
|
10
|
-
module Contrib
|
11
|
-
module Minitest
|
12
|
-
# Description of Minitest integration
|
13
|
-
class Integration
|
14
|
-
include Datadog::Tracing::Contrib::Integration
|
15
|
-
|
16
|
-
MINIMUM_VERSION = Gem::Version.new('5.0.0')
|
17
|
-
|
18
|
-
register_as :minitest, auto_patch: true
|
19
|
-
|
20
|
-
def self.version
|
21
|
-
Gem.loaded_specs['minitest'] \
|
22
|
-
&& Gem.loaded_specs['minitest'].version
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.loaded?
|
26
|
-
!defined?(::Minitest).nil?
|
27
|
-
end
|
28
|
-
|
29
|
-
def self.compatible?
|
30
|
-
super && version >= MINIMUM_VERSION
|
31
|
-
end
|
32
|
-
|
33
|
-
# test environments should not auto instrument test libraries
|
34
|
-
def auto_instrument?
|
35
|
-
false
|
36
|
-
end
|
37
|
-
|
38
|
-
def new_configuration
|
39
|
-
Configuration::Settings.new
|
40
|
-
end
|
41
|
-
|
42
|
-
def patcher
|
43
|
-
Patcher
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../tracing/contrib/patcher'
|
4
|
-
require_relative 'test_helper'
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module CI
|
8
|
-
module Contrib
|
9
|
-
module Minitest
|
10
|
-
# Patcher enables patching of 'minitest' module.
|
11
|
-
module Patcher
|
12
|
-
include Datadog::Tracing::Contrib::Patcher
|
13
|
-
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def target_version
|
17
|
-
Integration.version
|
18
|
-
end
|
19
|
-
|
20
|
-
def patch
|
21
|
-
::Minitest::Test.include(TestHelper)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'ext'
|
4
|
-
|
5
|
-
module Datadog
|
6
|
-
module CI
|
7
|
-
module Contrib
|
8
|
-
module Minitest
|
9
|
-
# Instrument Minitest::Test
|
10
|
-
module TestHelper
|
11
|
-
def before_setup
|
12
|
-
super
|
13
|
-
return unless configuration[:enabled]
|
14
|
-
|
15
|
-
test_name = "#{class_name}##{name}"
|
16
|
-
|
17
|
-
path, = method(name).source_location
|
18
|
-
test_suite = Pathname.new(path).relative_path_from(Pathname.pwd).to_s
|
19
|
-
|
20
|
-
span = CI::Test.trace(
|
21
|
-
configuration[:operation_name],
|
22
|
-
{
|
23
|
-
span_options: {
|
24
|
-
resource: test_name,
|
25
|
-
service: configuration[:service_name],
|
26
|
-
},
|
27
|
-
framework: Ext::FRAMEWORK,
|
28
|
-
framework_version: CI::Contrib::Minitest::Integration.version.to_s,
|
29
|
-
test_name: test_name,
|
30
|
-
test_suite: test_suite,
|
31
|
-
test_type: Ext::TEST_TYPE,
|
32
|
-
},
|
33
|
-
)
|
34
|
-
|
35
|
-
Thread.current[:_datadog_test_span] = span
|
36
|
-
end
|
37
|
-
|
38
|
-
def after_teardown
|
39
|
-
span = Thread.current[:_datadog_test_span]
|
40
|
-
return super unless span
|
41
|
-
|
42
|
-
Thread.current[:_datadog_test_span] = nil
|
43
|
-
|
44
|
-
case result_code
|
45
|
-
when '.'
|
46
|
-
CI::Test.passed!(span)
|
47
|
-
when 'E', 'F'
|
48
|
-
CI::Test.failed!(span, failure)
|
49
|
-
when 'S'
|
50
|
-
CI::Test.skipped!(span)
|
51
|
-
span.set_tag(CI::Ext::Test::TAG_SKIP_REASON, failure.message)
|
52
|
-
end
|
53
|
-
|
54
|
-
span.finish
|
55
|
-
|
56
|
-
super
|
57
|
-
end
|
58
|
-
|
59
|
-
private
|
60
|
-
|
61
|
-
def configuration
|
62
|
-
::Datadog.configuration.ci[:minitest]
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../../tracing/contrib/configuration/settings'
|
4
|
-
require_relative '../ext'
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module CI
|
8
|
-
module Contrib
|
9
|
-
module RSpec
|
10
|
-
module Configuration
|
11
|
-
# Custom settings for the RSpec integration
|
12
|
-
# TODO: mark as `@public_api` when GA
|
13
|
-
class Settings < Datadog::Tracing::Contrib::Configuration::Settings
|
14
|
-
option :enabled do |o|
|
15
|
-
o.type :bool
|
16
|
-
o.env Ext::ENV_ENABLED
|
17
|
-
o.default true
|
18
|
-
end
|
19
|
-
|
20
|
-
option :service_name do |o|
|
21
|
-
o.type :string
|
22
|
-
o.default { Datadog.configuration.service_without_fallback || Ext::SERVICE_NAME }
|
23
|
-
end
|
24
|
-
|
25
|
-
option :operation_name do |o|
|
26
|
-
o.type :string
|
27
|
-
o.env Ext::ENV_OPERATION_NAME
|
28
|
-
o.default Ext::OPERATION_NAME
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
require_relative '../../test'
|
2
|
-
|
3
|
-
require_relative '../../ext/app_types'
|
4
|
-
require_relative '../../ext/environment'
|
5
|
-
require_relative '../../ext/test'
|
6
|
-
require_relative 'ext'
|
7
|
-
|
8
|
-
module Datadog
|
9
|
-
module CI
|
10
|
-
module Contrib
|
11
|
-
module RSpec
|
12
|
-
# Instrument RSpec::Core::Example
|
13
|
-
module Example
|
14
|
-
def self.included(base)
|
15
|
-
base.prepend(InstanceMethods)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Instance methods for configuration
|
19
|
-
module InstanceMethods
|
20
|
-
def run(example_group_instance, reporter)
|
21
|
-
return super unless configuration[:enabled]
|
22
|
-
|
23
|
-
test_name = full_description.strip
|
24
|
-
if metadata[:description].empty?
|
25
|
-
# for unnamed it blocks this appends something like "example at ./spec/some_spec.rb:10"
|
26
|
-
test_name += " #{description}"
|
27
|
-
end
|
28
|
-
|
29
|
-
CI::Test.trace(
|
30
|
-
configuration[:operation_name],
|
31
|
-
{
|
32
|
-
span_options: {
|
33
|
-
resource: test_name,
|
34
|
-
service: configuration[:service_name]
|
35
|
-
},
|
36
|
-
framework: Ext::FRAMEWORK,
|
37
|
-
framework_version: CI::Contrib::RSpec::Integration.version.to_s,
|
38
|
-
test_name: test_name,
|
39
|
-
test_suite: metadata[:example_group][:file_path],
|
40
|
-
test_type: Ext::TEST_TYPE
|
41
|
-
}
|
42
|
-
) do |span|
|
43
|
-
result = super
|
44
|
-
|
45
|
-
case execution_result.status
|
46
|
-
when :passed
|
47
|
-
CI::Test.passed!(span)
|
48
|
-
when :failed
|
49
|
-
CI::Test.failed!(span, execution_result.exception)
|
50
|
-
else
|
51
|
-
CI::Test.skipped!(span, execution_result.exception) if execution_result.example_skipped?
|
52
|
-
end
|
53
|
-
|
54
|
-
result
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def configuration
|
61
|
-
Datadog.configuration.ci[:rspec]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module CI
|
5
|
-
module Contrib
|
6
|
-
module RSpec
|
7
|
-
# RSpec integration constants
|
8
|
-
# TODO: mark as `@public_api` when GA, to protect from resource and tag name changes.
|
9
|
-
module Ext
|
10
|
-
APP = 'rspec'
|
11
|
-
ENV_ENABLED = 'DD_TRACE_RSPEC_ENABLED'
|
12
|
-
ENV_OPERATION_NAME = 'DD_TRACE_RSPEC_OPERATION_NAME'
|
13
|
-
FRAMEWORK = 'rspec'
|
14
|
-
OPERATION_NAME = 'rspec.example'
|
15
|
-
SERVICE_NAME = 'rspec'
|
16
|
-
TEST_TYPE = 'test'
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require_relative '../../../tracing/contrib/integration'
|
2
|
-
|
3
|
-
require_relative 'configuration/settings'
|
4
|
-
require_relative 'patcher'
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module CI
|
8
|
-
module Contrib
|
9
|
-
module RSpec
|
10
|
-
# Description of RSpec integration
|
11
|
-
class Integration
|
12
|
-
include Datadog::Tracing::Contrib::Integration
|
13
|
-
|
14
|
-
MINIMUM_VERSION = Gem::Version.new('3.0.0')
|
15
|
-
|
16
|
-
register_as :rspec, auto_patch: true
|
17
|
-
|
18
|
-
def self.version
|
19
|
-
Gem.loaded_specs['rspec-core'] \
|
20
|
-
&& Gem.loaded_specs['rspec-core'].version
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.loaded?
|
24
|
-
!defined?(::RSpec).nil? && !defined?(::RSpec::Core).nil? && \
|
25
|
-
!defined?(::RSpec::Core::Example).nil?
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.compatible?
|
29
|
-
super && version >= MINIMUM_VERSION
|
30
|
-
end
|
31
|
-
|
32
|
-
# test environments should not auto instrument test libraries
|
33
|
-
def auto_instrument?
|
34
|
-
false
|
35
|
-
end
|
36
|
-
|
37
|
-
def new_configuration
|
38
|
-
Configuration::Settings.new
|
39
|
-
end
|
40
|
-
|
41
|
-
def patcher
|
42
|
-
Patcher
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../../tracing/contrib/patcher'
|
4
|
-
require_relative 'example'
|
5
|
-
|
6
|
-
module Datadog
|
7
|
-
module CI
|
8
|
-
module Contrib
|
9
|
-
module RSpec
|
10
|
-
# Patcher enables patching of 'rspec' module.
|
11
|
-
module Patcher
|
12
|
-
include Datadog::Tracing::Contrib::Patcher
|
13
|
-
|
14
|
-
module_function
|
15
|
-
|
16
|
-
def target_version
|
17
|
-
Integration.version
|
18
|
-
end
|
19
|
-
|
20
|
-
def patch
|
21
|
-
::RSpec::Core::Example.include(Example)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|