datadog 2.0.0.beta1 → 2.0.0.rc1
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 +181 -1
- data/ext/datadog_profiling_native_extension/NativeExtensionDesign.md +1 -1
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +40 -32
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +23 -12
- data/ext/datadog_profiling_native_extension/crashtracker.c +108 -0
- data/ext/datadog_profiling_native_extension/extconf.rb +9 -23
- data/ext/datadog_profiling_native_extension/heap_recorder.c +81 -4
- data/ext/datadog_profiling_native_extension/heap_recorder.h +12 -1
- data/ext/datadog_profiling_native_extension/http_transport.c +1 -94
- data/ext/datadog_profiling_native_extension/libdatadog_helpers.c +86 -0
- data/ext/datadog_profiling_native_extension/libdatadog_helpers.h +4 -0
- data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +2 -12
- data/ext/datadog_profiling_native_extension/private_vm_api_access.c +25 -86
- data/ext/datadog_profiling_native_extension/profiling.c +2 -0
- data/ext/datadog_profiling_native_extension/ruby_helpers.h +3 -5
- data/ext/datadog_profiling_native_extension/stack_recorder.c +161 -62
- data/lib/datadog/appsec/contrib/devise/tracking.rb +8 -0
- data/lib/datadog/appsec/contrib/rack/request_middleware.rb +43 -13
- data/lib/datadog/appsec/event.rb +2 -2
- data/lib/datadog/core/configuration/components.rb +2 -1
- data/lib/datadog/core/configuration/option.rb +7 -5
- data/lib/datadog/core/configuration/settings.rb +34 -79
- data/lib/datadog/core/configuration.rb +20 -4
- data/lib/datadog/core/environment/platform.rb +7 -1
- data/lib/datadog/core/remote/client/capabilities.rb +2 -1
- data/lib/datadog/core/remote/client.rb +1 -5
- data/lib/datadog/core/remote/configuration/repository.rb +1 -1
- data/lib/datadog/core/remote/dispatcher.rb +3 -3
- data/lib/datadog/core/remote/transport/http/config.rb +5 -5
- data/lib/datadog/core/telemetry/client.rb +18 -10
- data/lib/datadog/core/telemetry/emitter.rb +9 -13
- data/lib/datadog/core/telemetry/event.rb +247 -57
- data/lib/datadog/core/telemetry/ext.rb +1 -0
- data/lib/datadog/core/telemetry/heartbeat.rb +1 -3
- data/lib/datadog/core/telemetry/http/ext.rb +4 -1
- data/lib/datadog/core/telemetry/http/response.rb +4 -0
- data/lib/datadog/core/telemetry/http/transport.rb +9 -4
- data/lib/datadog/core/telemetry/request.rb +59 -0
- data/lib/datadog/core/utils/base64.rb +22 -0
- data/lib/datadog/opentelemetry/sdk/span_processor.rb +19 -2
- data/lib/datadog/opentelemetry/sdk/trace/span.rb +3 -17
- data/lib/datadog/profiling/collectors/code_provenance.rb +10 -4
- data/lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb +25 -0
- data/lib/datadog/profiling/component.rb +49 -17
- data/lib/datadog/profiling/crashtracker.rb +91 -0
- data/lib/datadog/profiling/exporter.rb +6 -3
- data/lib/datadog/profiling/http_transport.rb +7 -11
- data/lib/datadog/profiling/load_native_extension.rb +14 -1
- data/lib/datadog/profiling/profiler.rb +9 -2
- data/lib/datadog/profiling/stack_recorder.rb +6 -2
- data/lib/datadog/profiling.rb +12 -0
- data/lib/datadog/tracing/component.rb +5 -1
- data/lib/datadog/tracing/configuration/dynamic.rb +39 -1
- data/lib/datadog/tracing/configuration/settings.rb +1 -0
- data/lib/datadog/tracing/contrib/action_pack/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/action_view/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +1 -0
- data/lib/datadog/tracing/contrib/active_record/integration.rb +11 -1
- data/lib/datadog/tracing/contrib/active_support/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/configuration/resolver.rb +43 -0
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +43 -5
- data/lib/datadog/tracing/contrib/trilogy/instrumentation.rb +1 -1
- data/lib/datadog/tracing/correlation.rb +3 -4
- data/lib/datadog/tracing/remote.rb +5 -1
- data/lib/datadog/tracing/sampling/ext.rb +5 -1
- data/lib/datadog/tracing/sampling/matcher.rb +75 -26
- data/lib/datadog/tracing/sampling/rule.rb +27 -4
- data/lib/datadog/tracing/sampling/rule_sampler.rb +19 -1
- data/lib/datadog/tracing/sampling/span/matcher.rb +13 -41
- data/lib/datadog/tracing/span.rb +7 -2
- data/lib/datadog/tracing/span_link.rb +92 -0
- data/lib/datadog/tracing/span_operation.rb +6 -4
- data/lib/datadog/tracing/trace_operation.rb +12 -0
- data/lib/datadog/tracing/tracer.rb +4 -3
- data/lib/datadog/tracing/transport/serializable_trace.rb +3 -1
- data/lib/datadog/tracing/utils.rb +16 -0
- data/lib/datadog/version.rb +1 -1
- metadata +10 -31
- data/lib/datadog/core/telemetry/collector.rb +0 -248
- data/lib/datadog/core/telemetry/v1/app_event.rb +0 -59
- data/lib/datadog/core/telemetry/v1/application.rb +0 -94
- data/lib/datadog/core/telemetry/v1/configuration.rb +0 -27
- data/lib/datadog/core/telemetry/v1/dependency.rb +0 -45
- data/lib/datadog/core/telemetry/v1/host.rb +0 -59
- data/lib/datadog/core/telemetry/v1/install_signature.rb +0 -38
- data/lib/datadog/core/telemetry/v1/integration.rb +0 -66
- data/lib/datadog/core/telemetry/v1/product.rb +0 -36
- data/lib/datadog/core/telemetry/v1/telemetry_request.rb +0 -108
- data/lib/datadog/core/telemetry/v2/app_client_configuration_change.rb +0 -41
- data/lib/datadog/core/telemetry/v2/request.rb +0 -29
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datadog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Datadog, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: base64
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: debase-ruby_core_source
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +58,14 @@ dependencies:
|
|
72
58
|
requirements:
|
73
59
|
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: 9.0.0.1.0
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: 9.0.0.1.0
|
83
69
|
description: |
|
84
70
|
datadog is Datadog's client library for Ruby. It includes a suite of tools
|
85
71
|
which provide visibility into the performance and security of Ruby applications,
|
@@ -120,6 +106,7 @@ files:
|
|
120
106
|
- ext/datadog_profiling_native_extension/collectors_stack.h
|
121
107
|
- ext/datadog_profiling_native_extension/collectors_thread_context.c
|
122
108
|
- ext/datadog_profiling_native_extension/collectors_thread_context.h
|
109
|
+
- ext/datadog_profiling_native_extension/crashtracker.c
|
123
110
|
- ext/datadog_profiling_native_extension/extconf.rb
|
124
111
|
- ext/datadog_profiling_native_extension/heap_recorder.c
|
125
112
|
- ext/datadog_profiling_native_extension/heap_recorder.h
|
@@ -295,7 +282,6 @@ files:
|
|
295
282
|
- lib/datadog/core/runtime/ext.rb
|
296
283
|
- lib/datadog/core/runtime/metrics.rb
|
297
284
|
- lib/datadog/core/telemetry/client.rb
|
298
|
-
- lib/datadog/core/telemetry/collector.rb
|
299
285
|
- lib/datadog/core/telemetry/emitter.rb
|
300
286
|
- lib/datadog/core/telemetry/event.rb
|
301
287
|
- lib/datadog/core/telemetry/ext.rb
|
@@ -305,17 +291,7 @@ files:
|
|
305
291
|
- lib/datadog/core/telemetry/http/ext.rb
|
306
292
|
- lib/datadog/core/telemetry/http/response.rb
|
307
293
|
- lib/datadog/core/telemetry/http/transport.rb
|
308
|
-
- lib/datadog/core/telemetry/
|
309
|
-
- lib/datadog/core/telemetry/v1/application.rb
|
310
|
-
- lib/datadog/core/telemetry/v1/configuration.rb
|
311
|
-
- lib/datadog/core/telemetry/v1/dependency.rb
|
312
|
-
- lib/datadog/core/telemetry/v1/host.rb
|
313
|
-
- lib/datadog/core/telemetry/v1/install_signature.rb
|
314
|
-
- lib/datadog/core/telemetry/v1/integration.rb
|
315
|
-
- lib/datadog/core/telemetry/v1/product.rb
|
316
|
-
- lib/datadog/core/telemetry/v1/telemetry_request.rb
|
317
|
-
- lib/datadog/core/telemetry/v2/app_client_configuration_change.rb
|
318
|
-
- lib/datadog/core/telemetry/v2/request.rb
|
294
|
+
- lib/datadog/core/telemetry/request.rb
|
319
295
|
- lib/datadog/core/transport/ext.rb
|
320
296
|
- lib/datadog/core/transport/http/adapters/net.rb
|
321
297
|
- lib/datadog/core/transport/http/adapters/registry.rb
|
@@ -330,6 +306,7 @@ files:
|
|
330
306
|
- lib/datadog/core/transport/request.rb
|
331
307
|
- lib/datadog/core/transport/response.rb
|
332
308
|
- lib/datadog/core/utils.rb
|
309
|
+
- lib/datadog/core/utils/base64.rb
|
333
310
|
- lib/datadog/core/utils/duration.rb
|
334
311
|
- lib/datadog/core/utils/forking.rb
|
335
312
|
- lib/datadog/core/utils/hash.rb
|
@@ -375,6 +352,7 @@ files:
|
|
375
352
|
- lib/datadog/profiling/collectors/stack.rb
|
376
353
|
- lib/datadog/profiling/collectors/thread_context.rb
|
377
354
|
- lib/datadog/profiling/component.rb
|
355
|
+
- lib/datadog/profiling/crashtracker.rb
|
378
356
|
- lib/datadog/profiling/exporter.rb
|
379
357
|
- lib/datadog/profiling/ext.rb
|
380
358
|
- lib/datadog/profiling/ext/forking.rb
|
@@ -828,6 +806,7 @@ files:
|
|
828
806
|
- lib/datadog/tracing/sampling/span/rule_parser.rb
|
829
807
|
- lib/datadog/tracing/sampling/span/sampler.rb
|
830
808
|
- lib/datadog/tracing/span.rb
|
809
|
+
- lib/datadog/tracing/span_link.rb
|
831
810
|
- lib/datadog/tracing/span_operation.rb
|
832
811
|
- lib/datadog/tracing/sync_writer.rb
|
833
812
|
- lib/datadog/tracing/trace_digest.rb
|
@@ -879,7 +858,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
879
858
|
- !ruby/object:Gem::Version
|
880
859
|
version: 2.0.0
|
881
860
|
requirements: []
|
882
|
-
rubygems_version: 3.4.
|
861
|
+
rubygems_version: 3.4.10
|
883
862
|
signing_key:
|
884
863
|
specification_version: 4
|
885
864
|
summary: Datadog tracing code for your Ruby applications
|
@@ -1,248 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'etc'
|
4
|
-
|
5
|
-
require_relative '../configuration/agent_settings_resolver'
|
6
|
-
require_relative '../environment/ext'
|
7
|
-
require_relative '../environment/platform'
|
8
|
-
require_relative '../utils/hash'
|
9
|
-
require_relative 'v1/application'
|
10
|
-
require_relative 'v1/dependency'
|
11
|
-
require_relative 'v1/host'
|
12
|
-
require_relative 'v1/install_signature'
|
13
|
-
require_relative 'v1/integration'
|
14
|
-
require_relative 'v1/product'
|
15
|
-
require_relative '../transport/ext'
|
16
|
-
|
17
|
-
module Datadog
|
18
|
-
module Core
|
19
|
-
module Telemetry
|
20
|
-
# Module defining methods for collecting metadata for telemetry
|
21
|
-
module Collector
|
22
|
-
include Datadog::Core::Configuration
|
23
|
-
using Core::Utils::Hash::Refinement
|
24
|
-
|
25
|
-
# Forms a hash of configuration key value pairs to be sent in the additional payload
|
26
|
-
def additional_payload
|
27
|
-
additional_payload_variables
|
28
|
-
end
|
29
|
-
|
30
|
-
# Forms a telemetry application object
|
31
|
-
def application
|
32
|
-
Telemetry::V1::Application.new(
|
33
|
-
env: env,
|
34
|
-
language_name: Datadog::Core::Environment::Ext::LANG,
|
35
|
-
language_version: Datadog::Core::Environment::Ext::LANG_VERSION,
|
36
|
-
products: products,
|
37
|
-
runtime_name: Datadog::Core::Environment::Ext::RUBY_ENGINE,
|
38
|
-
runtime_version: Datadog::Core::Environment::Ext::ENGINE_VERSION,
|
39
|
-
service_name: service_name,
|
40
|
-
service_version: service_version,
|
41
|
-
tracer_version: library_version
|
42
|
-
)
|
43
|
-
end
|
44
|
-
|
45
|
-
# Forms a hash of standard key value pairs to be sent in the app-started event configuration
|
46
|
-
def configurations
|
47
|
-
config = Datadog.configuration
|
48
|
-
hash = {
|
49
|
-
DD_AGENT_HOST: config.agent.host,
|
50
|
-
DD_AGENT_TRANSPORT: agent_transport,
|
51
|
-
DD_TRACE_SAMPLE_RATE: format_configuration_value(config.tracing.sampling.default_rate),
|
52
|
-
DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED: config.tracing.contrib.global_default_service_name.enabled
|
53
|
-
}
|
54
|
-
peer_service_mapping_str = ''
|
55
|
-
unless config.tracing.contrib.peer_service_mapping.empty?
|
56
|
-
peer_service_mapping = config.tracing.contrib.peer_service_mapping
|
57
|
-
peer_service_mapping_str = peer_service_mapping.map { |key, value| "#{key}:#{value}" }.join(',')
|
58
|
-
end
|
59
|
-
hash[:DD_TRACE_PEER_SERVICE_MAPPING] = peer_service_mapping_str
|
60
|
-
hash.compact!
|
61
|
-
hash
|
62
|
-
end
|
63
|
-
|
64
|
-
# Forms a telemetry app-started dependencies object
|
65
|
-
def dependencies
|
66
|
-
Gem.loaded_specs.collect do |name, loaded_gem|
|
67
|
-
Datadog::Core::Telemetry::V1::Dependency.new(
|
68
|
-
# `hash` should be used when `version` is not available
|
69
|
-
name: name, version: loaded_gem.version.to_s, hash: nil
|
70
|
-
)
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Forms a telemetry host object
|
75
|
-
def host
|
76
|
-
Telemetry::V1::Host.new(
|
77
|
-
container_id: Core::Environment::Container.container_id,
|
78
|
-
hostname: Core::Environment::Platform.hostname,
|
79
|
-
kernel_name: Core::Environment::Platform.kernel_name,
|
80
|
-
kernel_release: Core::Environment::Platform.kernel_release,
|
81
|
-
kernel_version: Core::Environment::Platform.kernel_version
|
82
|
-
)
|
83
|
-
end
|
84
|
-
|
85
|
-
# Forms a telemetry app-started install_signature object
|
86
|
-
def install_signature
|
87
|
-
Telemetry::V1::InstallSignature.new(
|
88
|
-
install_id: Datadog.configuration.dig('telemetry', 'install_id'),
|
89
|
-
install_type: Datadog.configuration.dig('telemetry', 'install_type'),
|
90
|
-
install_time: Datadog.configuration.dig('telemetry', 'install_time'),
|
91
|
-
)
|
92
|
-
end
|
93
|
-
|
94
|
-
# Forms a telemetry app-started integrations object
|
95
|
-
def integrations
|
96
|
-
Datadog.registry.map do |integration|
|
97
|
-
is_instrumented = instrumented?(integration)
|
98
|
-
is_enabled = is_instrumented && patched?(integration)
|
99
|
-
Telemetry::V1::Integration.new(
|
100
|
-
name: integration.name.to_s,
|
101
|
-
enabled: is_enabled,
|
102
|
-
version: integration_version(integration),
|
103
|
-
compatible: integration_compatible?(integration),
|
104
|
-
error: (patch_error(integration) if is_instrumented && !is_enabled),
|
105
|
-
auto_enabled: is_enabled ? integration_auto_instrument?(integration) : nil
|
106
|
-
)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
# Returns the runtime ID of the current process
|
111
|
-
def runtime_id
|
112
|
-
Datadog::Core::Environment::Identity.id
|
113
|
-
end
|
114
|
-
|
115
|
-
# Returns the current as a UNIX timestamp in seconds
|
116
|
-
def tracer_time
|
117
|
-
Time.now.to_i
|
118
|
-
end
|
119
|
-
|
120
|
-
private
|
121
|
-
|
122
|
-
TARGET_OPTIONS = [
|
123
|
-
'logger.level',
|
124
|
-
'profiling.advanced.code_provenance_enabled',
|
125
|
-
'profiling.advanced.endpoint.collection.enabled',
|
126
|
-
'profiling.enabled',
|
127
|
-
'runtime_metrics.enabled',
|
128
|
-
'tracing.analytics.enabled',
|
129
|
-
'tracing.propagation_style_inject',
|
130
|
-
'tracing.propagation_style_extract',
|
131
|
-
'tracing.enabled',
|
132
|
-
'tracing.log_injection',
|
133
|
-
'tracing.partial_flush.enabled',
|
134
|
-
'tracing.partial_flush.min_spans_threshold',
|
135
|
-
'tracing.report_hostname',
|
136
|
-
'tracing.sampling.default_rate',
|
137
|
-
'tracing.sampling.rate_limit'
|
138
|
-
].freeze
|
139
|
-
|
140
|
-
def additional_payload_variables
|
141
|
-
# Whitelist of configuration options to send in additional payload object
|
142
|
-
configuration = Datadog.configuration
|
143
|
-
options = TARGET_OPTIONS.each_with_object({}) do |option, hash|
|
144
|
-
split_option = option.split('.')
|
145
|
-
hash[option] = format_configuration_value(configuration.dig(*split_option))
|
146
|
-
end
|
147
|
-
|
148
|
-
# Add some more custom additional payload values here
|
149
|
-
options['tracing.auto_instrument.enabled'] = !defined?(Datadog::AutoInstrument::LOADED).nil?
|
150
|
-
options['tracing.writer_options.buffer_size'] =
|
151
|
-
format_configuration_value(configuration.tracing.writer_options[:buffer_size])
|
152
|
-
options['tracing.writer_options.flush_interval'] =
|
153
|
-
format_configuration_value(configuration.tracing.writer_options[:flush_interval])
|
154
|
-
options['logger.instance'] = configuration.logger.instance.class.to_s
|
155
|
-
options['appsec.enabled'] = configuration.dig('appsec', 'enabled') if configuration.respond_to?('appsec')
|
156
|
-
options['ci.enabled'] = configuration.dig('ci', 'enabled') if configuration.respond_to?('ci')
|
157
|
-
options['tracing.opentelemetry.enabled'] = !defined?(Datadog::OpenTelemetry::LOADED).nil?
|
158
|
-
options.compact!
|
159
|
-
options
|
160
|
-
end
|
161
|
-
|
162
|
-
def format_configuration_value(value)
|
163
|
-
# TODO: Add float if telemetry starts accepting it
|
164
|
-
case value
|
165
|
-
when Integer, String, true, false, nil
|
166
|
-
value
|
167
|
-
else
|
168
|
-
value.to_s
|
169
|
-
end
|
170
|
-
end
|
171
|
-
|
172
|
-
def env
|
173
|
-
Datadog.configuration.env
|
174
|
-
end
|
175
|
-
|
176
|
-
def service_name
|
177
|
-
Datadog.configuration.service
|
178
|
-
end
|
179
|
-
|
180
|
-
def service_version
|
181
|
-
Datadog.configuration.version
|
182
|
-
end
|
183
|
-
|
184
|
-
def library_version
|
185
|
-
Core::Environment::Identity.gem_datadog_version
|
186
|
-
end
|
187
|
-
|
188
|
-
def products
|
189
|
-
Telemetry::V1::Product.new(profiler: profiler, appsec: appsec)
|
190
|
-
end
|
191
|
-
|
192
|
-
def profiler
|
193
|
-
{ version: library_version }
|
194
|
-
end
|
195
|
-
|
196
|
-
def appsec
|
197
|
-
{ version: library_version }
|
198
|
-
end
|
199
|
-
|
200
|
-
def agent_transport
|
201
|
-
adapter = Core::Configuration::AgentSettingsResolver.call(Datadog.configuration).adapter
|
202
|
-
if adapter == Datadog::Core::Transport::Ext::UnixSocket::ADAPTER
|
203
|
-
'UDS'
|
204
|
-
else
|
205
|
-
'TCP'
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
def instrumented_integrations
|
210
|
-
Datadog.configuration.tracing.instrumented_integrations
|
211
|
-
end
|
212
|
-
|
213
|
-
def instrumented?(integration)
|
214
|
-
instrumented_integrations.include?(integration.name)
|
215
|
-
end
|
216
|
-
|
217
|
-
def patched?(integration)
|
218
|
-
!!integration.klass.patcher.patch_successful
|
219
|
-
end
|
220
|
-
|
221
|
-
def integration_auto_instrument?(integration)
|
222
|
-
integration.klass.auto_instrument?
|
223
|
-
end
|
224
|
-
|
225
|
-
def integration_compatible?(integration)
|
226
|
-
integration.klass.class.compatible?
|
227
|
-
end
|
228
|
-
|
229
|
-
def integration_version(integration)
|
230
|
-
integration.klass.class.version ? integration.klass.class.version.to_s : nil
|
231
|
-
end
|
232
|
-
|
233
|
-
def patch_error(integration)
|
234
|
-
patch_error_result = integration.klass.patcher.patch_error_result
|
235
|
-
if patch_error_result.nil? # if no error occurred during patching, but integration is still not instrumented
|
236
|
-
desc = "Available?: #{integration.klass.class.available?}"
|
237
|
-
desc += ", Loaded? #{integration.klass.class.loaded?}"
|
238
|
-
desc += ", Compatible? #{integration.klass.class.compatible?}"
|
239
|
-
desc += ", Patchable? #{integration.klass.class.patchable?}"
|
240
|
-
desc
|
241
|
-
else
|
242
|
-
patch_error_result.compact.to_s
|
243
|
-
end
|
244
|
-
end
|
245
|
-
end
|
246
|
-
end
|
247
|
-
end
|
248
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module Core
|
5
|
-
module Telemetry
|
6
|
-
module V1
|
7
|
-
# Describes payload for telemetry V1 API app-integrations-change event
|
8
|
-
class AppEvent
|
9
|
-
attr_reader \
|
10
|
-
:additional_payload,
|
11
|
-
:configuration,
|
12
|
-
:dependencies,
|
13
|
-
:install_signature,
|
14
|
-
:integrations
|
15
|
-
|
16
|
-
# @param additional_payload [Array<Telemetry::V1::Configuration>] List of Additional payload to track (any key
|
17
|
-
# value not mentioned and doesn't fit under a metric)
|
18
|
-
# @param configuration [Array<Telemetry::V1::Configuration>] List of Tracer related configuration data
|
19
|
-
# @param dependencies [Array<Telemetry::V1::Dependency>] List of all loaded modules requested by the app
|
20
|
-
# @param install_signature [Telemetry::V1::InstallSignature] Install signature data
|
21
|
-
# @param integrations [Array<Telemetry::V1::Integration>] List of integrations that are available within the app
|
22
|
-
# and applicable to be traced
|
23
|
-
def initialize(
|
24
|
-
additional_payload: nil, configuration: nil, dependencies: nil, install_signature: nil,
|
25
|
-
integrations: nil
|
26
|
-
)
|
27
|
-
@additional_payload = additional_payload
|
28
|
-
@configuration = configuration
|
29
|
-
@dependencies = dependencies
|
30
|
-
@install_signature = install_signature
|
31
|
-
@integrations = integrations
|
32
|
-
end
|
33
|
-
|
34
|
-
def to_h
|
35
|
-
{}.tap do |hash|
|
36
|
-
hash[:additional_payload] = map_hash(@additional_payload) if @additional_payload
|
37
|
-
hash[:configuration] = map_hash(@configuration) if @configuration
|
38
|
-
hash[:dependencies] = map_array(@dependencies) if @dependencies
|
39
|
-
hash[:install_signature] = @install_signature.to_h if @install_signature
|
40
|
-
hash[:integrations] = map_array(@integrations) if @integrations
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
def map_hash(hash)
|
47
|
-
hash.map do |k, v|
|
48
|
-
{ name: k.to_s, value: v }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def map_array(arr)
|
53
|
-
arr.map(&:to_h)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,94 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../utils/hash'
|
4
|
-
|
5
|
-
module Datadog
|
6
|
-
module Core
|
7
|
-
module Telemetry
|
8
|
-
module V1
|
9
|
-
# Describes attributes for application environment object
|
10
|
-
class Application
|
11
|
-
using Core::Utils::Hash::Refinement
|
12
|
-
|
13
|
-
ERROR_NIL_LANGUAGE_NAME_MESSAGE = ':language_name must not be nil'
|
14
|
-
ERROR_NIL_LANGUAGE_VERSION_MESSAGE = ':language_version must not be nil'
|
15
|
-
ERROR_NIL_SERVICE_NAME_MESSAGE = ':service_name must not be nil'
|
16
|
-
ERROR_NIL_TRACER_VERSION_MESSAGE = ':tracer_version must not be nil'
|
17
|
-
|
18
|
-
attr_reader \
|
19
|
-
:env,
|
20
|
-
:language_name,
|
21
|
-
:language_version,
|
22
|
-
:products,
|
23
|
-
:runtime_name,
|
24
|
-
:runtime_patches,
|
25
|
-
:runtime_version,
|
26
|
-
:service_name,
|
27
|
-
:service_version,
|
28
|
-
:tracer_version
|
29
|
-
|
30
|
-
# @param env [String] Service's environment
|
31
|
-
# @param language_name [String] 'ruby'
|
32
|
-
# @param language_version [String] Version of language used
|
33
|
-
# @param products [Telemetry::V1::Product] Contains information about specific products added to the environment
|
34
|
-
# @param runtime_name [String] Runtime being used
|
35
|
-
# @param runtime_patches [String] String of patches applied to the runtime
|
36
|
-
# @param runtime_version [String] Runtime version; potentially the same as :language_version
|
37
|
-
# @param service_name [String] Service’s name (DD_SERVICE)
|
38
|
-
# @param service_version [String] Service’s version (DD_VERSION)
|
39
|
-
# @param tracer_version [String] Version of the used tracer
|
40
|
-
def initialize(
|
41
|
-
language_name:, language_version:, service_name:, tracer_version:, env: nil, products: nil,
|
42
|
-
runtime_name: nil, runtime_patches: nil, runtime_version: nil, service_version: nil
|
43
|
-
)
|
44
|
-
validate(
|
45
|
-
language_name: language_name,
|
46
|
-
language_version: language_version,
|
47
|
-
service_name: service_name,
|
48
|
-
tracer_version: tracer_version
|
49
|
-
)
|
50
|
-
@env = env
|
51
|
-
@language_name = language_name
|
52
|
-
@language_version = language_version
|
53
|
-
@products = products
|
54
|
-
@runtime_name = runtime_name
|
55
|
-
@runtime_patches = runtime_patches
|
56
|
-
@runtime_version = runtime_version
|
57
|
-
@service_name = service_name
|
58
|
-
@service_version = service_version
|
59
|
-
@tracer_version = tracer_version
|
60
|
-
end
|
61
|
-
|
62
|
-
def to_h
|
63
|
-
hash = {
|
64
|
-
env: @env,
|
65
|
-
language_name: @language_name,
|
66
|
-
language_version: @language_version,
|
67
|
-
products: @products.to_h,
|
68
|
-
runtime_name: @runtime_name,
|
69
|
-
runtime_patches: @runtime_patches,
|
70
|
-
runtime_version: @runtime_version,
|
71
|
-
service_name: @service_name,
|
72
|
-
service_version: @service_version,
|
73
|
-
tracer_version: @tracer_version
|
74
|
-
}
|
75
|
-
hash.compact!
|
76
|
-
hash
|
77
|
-
end
|
78
|
-
|
79
|
-
private
|
80
|
-
|
81
|
-
# Validates required arguments passed to the class on initialization are not nil
|
82
|
-
#
|
83
|
-
# @!visibility private
|
84
|
-
def validate(language_name:, language_version:, service_name:, tracer_version:)
|
85
|
-
raise ArgumentError, ERROR_NIL_LANGUAGE_NAME_MESSAGE if language_name.nil?
|
86
|
-
raise ArgumentError, ERROR_NIL_LANGUAGE_VERSION_MESSAGE if language_version.nil?
|
87
|
-
raise ArgumentError, ERROR_NIL_SERVICE_NAME_MESSAGE if service_name.nil?
|
88
|
-
raise ArgumentError, ERROR_NIL_TRACER_VERSION_MESSAGE if tracer_version.nil?
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module Core
|
5
|
-
module Telemetry
|
6
|
-
module V1
|
7
|
-
# Describes attributes for additional payload or configuration object
|
8
|
-
class Configuration
|
9
|
-
ERROR_NIL_NAME_MESSAGE = ':name must not be nil'
|
10
|
-
|
11
|
-
attr_reader \
|
12
|
-
:name,
|
13
|
-
:value
|
14
|
-
|
15
|
-
# @param name [String] Configuration/additional payload attribute name
|
16
|
-
# @param value [String, Integer, Boolean] Corresponding value
|
17
|
-
def initialize(name:, value: nil)
|
18
|
-
raise ArgumentError, ERROR_NIL_NAME_MESSAGE if name.nil?
|
19
|
-
|
20
|
-
@name = name
|
21
|
-
@value = value
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../utils/hash'
|
4
|
-
|
5
|
-
module Datadog
|
6
|
-
module Core
|
7
|
-
module Telemetry
|
8
|
-
module V1
|
9
|
-
# Describes attributes for dependency object
|
10
|
-
class Dependency
|
11
|
-
using Core::Utils::Hash::Refinement
|
12
|
-
|
13
|
-
ERROR_NIL_NAME_MESSAGE = ':name must not be nil'
|
14
|
-
|
15
|
-
attr_reader \
|
16
|
-
:hash,
|
17
|
-
:name,
|
18
|
-
:version
|
19
|
-
|
20
|
-
# @param name [String] Module name
|
21
|
-
# @param version [String] Version of resolved module
|
22
|
-
# @param hash [String] Dependency hash, in case `version` is not available
|
23
|
-
def initialize(name:, version: nil, hash: nil)
|
24
|
-
raise ArgumentError, ERROR_NIL_NAME_MESSAGE if name.nil?
|
25
|
-
raise ArgumentError, 'if both :version and :hash exist, use :version only' if version && hash
|
26
|
-
|
27
|
-
@hash = hash
|
28
|
-
@name = name
|
29
|
-
@version = version
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_h
|
33
|
-
hash = {
|
34
|
-
hash: @hash,
|
35
|
-
name: @name,
|
36
|
-
version: @version
|
37
|
-
}
|
38
|
-
hash.compact!
|
39
|
-
hash
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative '../../utils/hash'
|
4
|
-
|
5
|
-
module Datadog
|
6
|
-
module Core
|
7
|
-
module Telemetry
|
8
|
-
module V1
|
9
|
-
# Describes attributes for host object
|
10
|
-
class Host
|
11
|
-
using Core::Utils::Hash::Refinement
|
12
|
-
|
13
|
-
attr_reader \
|
14
|
-
:container_id,
|
15
|
-
:hostname,
|
16
|
-
:kernel_name,
|
17
|
-
:kernel_release,
|
18
|
-
:kernel_version,
|
19
|
-
:os_version,
|
20
|
-
:os
|
21
|
-
|
22
|
-
# @param container_id [String] Docker container ID
|
23
|
-
# @param hostname [String] uname -n
|
24
|
-
# @param kernel_name [String] uname -s
|
25
|
-
# @param kernel_release [String] uname -r
|
26
|
-
# @param kernel_version [String] uname -v
|
27
|
-
# @param os [String] uname -o
|
28
|
-
# @param os_version [String] Version of OS running
|
29
|
-
def initialize(
|
30
|
-
container_id: nil, hostname: nil, kernel_name: nil, kernel_release: nil, kernel_version: nil,
|
31
|
-
os_version: nil, os: nil
|
32
|
-
)
|
33
|
-
@container_id = container_id
|
34
|
-
@hostname = hostname
|
35
|
-
@kernel_name = kernel_name
|
36
|
-
@kernel_release = kernel_release
|
37
|
-
@kernel_version = kernel_version
|
38
|
-
@os = os
|
39
|
-
@os_version = os_version
|
40
|
-
end
|
41
|
-
|
42
|
-
def to_h
|
43
|
-
hash = {
|
44
|
-
container_id: @container_id,
|
45
|
-
hostname: @hostname,
|
46
|
-
kernel_name: @kernel_name,
|
47
|
-
kernel_release: @kernel_release,
|
48
|
-
kernel_version: @kernel_version,
|
49
|
-
os: @os,
|
50
|
-
os_version: @os_version,
|
51
|
-
}
|
52
|
-
hash.compact!
|
53
|
-
hash
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Datadog
|
4
|
-
module Core
|
5
|
-
module Telemetry
|
6
|
-
module V1
|
7
|
-
# Describes attributes for install signature
|
8
|
-
class InstallSignature
|
9
|
-
using Core::Utils::Hash::Refinement
|
10
|
-
|
11
|
-
attr_reader \
|
12
|
-
:install_id,
|
13
|
-
:install_type,
|
14
|
-
:install_time
|
15
|
-
|
16
|
-
# @param id [String,nil] Install ID
|
17
|
-
# @param type [String,nil] Install type
|
18
|
-
# @param type [String,nil] Install time
|
19
|
-
def initialize(install_id:, install_type:, install_time:)
|
20
|
-
@install_id = install_id
|
21
|
-
@install_type = install_type
|
22
|
-
@install_time = install_time
|
23
|
-
end
|
24
|
-
|
25
|
-
def to_h
|
26
|
-
hash = {
|
27
|
-
install_id: @install_id,
|
28
|
-
install_type: @install_type,
|
29
|
-
install_time: @install_time
|
30
|
-
}
|
31
|
-
hash.compact!
|
32
|
-
hash
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|