datadog 2.0.0.beta1 → 2.0.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +125 -1
- data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +32 -12
- data/ext/datadog_profiling_native_extension/collectors_thread_context.c +5 -2
- data/ext/datadog_profiling_native_extension/heap_recorder.c +45 -3
- data/ext/datadog_profiling_native_extension/heap_recorder.h +7 -1
- data/ext/datadog_profiling_native_extension/http_transport.c +5 -5
- data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +1 -1
- data/ext/datadog_profiling_native_extension/stack_recorder.c +7 -9
- 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 +38 -14
- 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/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/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 +1 -1
- 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 +23 -15
- data/lib/datadog/profiling/load_native_extension.rb +14 -1
- data/lib/datadog/profiling.rb +11 -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/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/active_support/integration.rb +1 -1
- data/lib/datadog/tracing/contrib/grape/endpoint.rb +43 -5
- data/lib/datadog/tracing/correlation.rb +3 -4
- data/lib/datadog/tracing/sampling/matcher.rb +23 -3
- data/lib/datadog/tracing/sampling/rule.rb +18 -2
- data/lib/datadog/tracing/sampling/rule_sampler.rb +2 -0
- data/lib/datadog/tracing/span.rb +7 -2
- data/lib/datadog/tracing/span_link.rb +86 -0
- 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 +7 -30
- 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
@@ -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
|
@@ -1,66 +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 integration object
|
10
|
-
class Integration
|
11
|
-
using Core::Utils::Hash::Refinement
|
12
|
-
|
13
|
-
ERROR_NIL_ENABLED_MESSAGE = ':enabled must not be nil'
|
14
|
-
ERROR_NIL_NAME_MESSAGE = ':name must not be nil'
|
15
|
-
|
16
|
-
attr_reader \
|
17
|
-
:auto_enabled,
|
18
|
-
:compatible,
|
19
|
-
:enabled,
|
20
|
-
:error,
|
21
|
-
:name,
|
22
|
-
:version
|
23
|
-
|
24
|
-
# @param enabled [Boolean] Whether integration is enabled at time of request
|
25
|
-
# @param name [String] Integration name
|
26
|
-
# @param auto_enabled [Boolean] If integration is not enabled by default, but by user choice
|
27
|
-
# @param compatible [Boolean] If integration is available, but incompatible
|
28
|
-
# @param error [String] Error message if integration fails to load
|
29
|
-
# @param version [String] Integration version (if specified in app-started, it should be for other events too)
|
30
|
-
def initialize(enabled:, name:, auto_enabled: nil, compatible: nil, error: nil, version: nil)
|
31
|
-
validate(enabled: enabled, name: name)
|
32
|
-
@auto_enabled = auto_enabled
|
33
|
-
@compatible = compatible
|
34
|
-
@enabled = enabled
|
35
|
-
@error = error
|
36
|
-
@name = name
|
37
|
-
@version = version
|
38
|
-
end
|
39
|
-
|
40
|
-
def to_h
|
41
|
-
hash = {
|
42
|
-
auto_enabled: @auto_enabled,
|
43
|
-
compatible: @compatible,
|
44
|
-
enabled: @enabled,
|
45
|
-
error: @error,
|
46
|
-
name: @name,
|
47
|
-
version: @version
|
48
|
-
}
|
49
|
-
hash.compact!
|
50
|
-
hash
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
# Validates all required arguments passed to the class on initialization are not nil
|
56
|
-
#
|
57
|
-
# @!visibility private
|
58
|
-
def validate(enabled:, name:)
|
59
|
-
raise ArgumentError, ERROR_NIL_ENABLED_MESSAGE if enabled.nil?
|
60
|
-
raise ArgumentError, ERROR_NIL_NAME_MESSAGE if name.nil?
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -1,36 +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 products object
|
10
|
-
class Product
|
11
|
-
using Core::Utils::Hash::Refinement
|
12
|
-
|
13
|
-
attr_reader \
|
14
|
-
:appsec,
|
15
|
-
:profiler
|
16
|
-
|
17
|
-
# @param appsec [Telemetry::V1::AppSec] Holds custom information about the appsec product
|
18
|
-
# @param profiler [Telemetry::V1::Profiler] Holds custom information about the profiler product
|
19
|
-
def initialize(appsec: nil, profiler: nil)
|
20
|
-
@appsec = appsec
|
21
|
-
@profiler = profiler
|
22
|
-
end
|
23
|
-
|
24
|
-
def to_h
|
25
|
-
hash = {
|
26
|
-
appsec: @appsec,
|
27
|
-
profiler: @profiler
|
28
|
-
}
|
29
|
-
hash.compact!
|
30
|
-
hash
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|