datadog 2.1.0 → 2.2.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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +53 -2
  3. data/ext/datadog_profiling_native_extension/collectors_cpu_and_wall_time_worker.c +19 -1
  4. data/ext/datadog_profiling_native_extension/collectors_stack.c +41 -0
  5. data/ext/datadog_profiling_native_extension/collectors_thread_context.c +1 -1
  6. data/ext/datadog_profiling_native_extension/crashtracker.c +1 -1
  7. data/ext/datadog_profiling_native_extension/extconf.rb +6 -4
  8. data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +47 -1
  9. data/ext/datadog_profiling_native_extension/setup_signal_handler.c +1 -1
  10. data/ext/datadog_profiling_native_extension/stack_recorder.c +13 -6
  11. data/ext/datadog_profiling_native_extension/stack_recorder.h +1 -0
  12. data/lib/datadog/appsec/contrib/sinatra/patcher.rb +1 -1
  13. data/lib/datadog/appsec/extensions.rb +1 -0
  14. data/lib/datadog/core/configuration/components.rb +6 -3
  15. data/lib/datadog/core/configuration/settings.rb +39 -0
  16. data/lib/datadog/core/configuration.rb +3 -17
  17. data/lib/datadog/core/deprecations.rb +58 -0
  18. data/lib/datadog/core/environment/yjit.rb +5 -0
  19. data/lib/datadog/core/runtime/ext.rb +1 -0
  20. data/lib/datadog/core/runtime/metrics.rb +6 -0
  21. data/lib/datadog/core/telemetry/component.rb +107 -0
  22. data/lib/datadog/core/telemetry/event.rb +100 -25
  23. data/lib/datadog/core/telemetry/ext.rb +2 -0
  24. data/lib/datadog/core/telemetry/http/adapters/net.rb +1 -1
  25. data/lib/datadog/core/telemetry/metric.rb +167 -0
  26. data/lib/datadog/core/telemetry/metrics_collection.rb +81 -0
  27. data/lib/datadog/core/telemetry/metrics_manager.rb +81 -0
  28. data/lib/datadog/core/telemetry/request.rb +1 -1
  29. data/lib/datadog/core/telemetry/worker.rb +173 -0
  30. data/lib/datadog/core/utils/only_once_successful.rb +76 -0
  31. data/lib/datadog/core.rb +2 -19
  32. data/lib/datadog/opentelemetry/sdk/propagator.rb +5 -10
  33. data/lib/datadog/opentelemetry/sdk/span_processor.rb +5 -2
  34. data/lib/datadog/profiling/collectors/code_provenance.rb +18 -5
  35. data/lib/datadog/profiling/component.rb +18 -1
  36. data/lib/datadog/profiling/ext/dir_monkey_patches.rb +410 -0
  37. data/lib/datadog/profiling.rb +1 -0
  38. data/lib/datadog/tracing/contrib/action_cable/event.rb +1 -1
  39. data/lib/datadog/tracing/contrib/action_cable/events/broadcast.rb +1 -1
  40. data/lib/datadog/tracing/contrib/action_cable/events/perform_action.rb +1 -1
  41. data/lib/datadog/tracing/contrib/action_cable/events/transmit.rb +1 -1
  42. data/lib/datadog/tracing/contrib/action_mailer/event.rb +4 -6
  43. data/lib/datadog/tracing/contrib/action_mailer/events/deliver.rb +9 -4
  44. data/lib/datadog/tracing/contrib/action_mailer/events/process.rb +3 -2
  45. data/lib/datadog/tracing/contrib/action_view/events/render_partial.rb +1 -5
  46. data/lib/datadog/tracing/contrib/action_view/events/render_template.rb +1 -1
  47. data/lib/datadog/tracing/contrib/active_job/events/discard.rb +1 -1
  48. data/lib/datadog/tracing/contrib/active_job/events/enqueue.rb +1 -1
  49. data/lib/datadog/tracing/contrib/active_job/events/enqueue_at.rb +1 -1
  50. data/lib/datadog/tracing/contrib/active_job/events/enqueue_retry.rb +1 -1
  51. data/lib/datadog/tracing/contrib/active_job/events/perform.rb +1 -1
  52. data/lib/datadog/tracing/contrib/active_job/events/retry_stopped.rb +1 -1
  53. data/lib/datadog/tracing/contrib/active_model_serializers/events/render.rb +1 -1
  54. data/lib/datadog/tracing/contrib/active_model_serializers/events/serialize.rb +1 -1
  55. data/lib/datadog/tracing/contrib/active_record/events/instantiation.rb +1 -1
  56. data/lib/datadog/tracing/contrib/active_record/events/sql.rb +1 -1
  57. data/lib/datadog/tracing/contrib/active_support/cache/event.rb +32 -0
  58. data/lib/datadog/tracing/contrib/active_support/cache/events/cache.rb +156 -0
  59. data/lib/datadog/tracing/contrib/active_support/cache/events.rb +34 -0
  60. data/lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb +45 -41
  61. data/lib/datadog/tracing/contrib/active_support/cache/patcher.rb +17 -40
  62. data/lib/datadog/tracing/contrib/active_support/cache/redis.rb +4 -1
  63. data/lib/datadog/tracing/contrib/active_support/notifications/event.rb +29 -6
  64. data/lib/datadog/tracing/contrib/active_support/notifications/subscriber.rb +16 -4
  65. data/lib/datadog/tracing/contrib/active_support/notifications/subscription.rb +33 -29
  66. data/lib/datadog/tracing/contrib/analytics.rb +5 -0
  67. data/lib/datadog/tracing/contrib/graphql/configuration/settings.rb +5 -0
  68. data/lib/datadog/tracing/contrib/graphql/patcher.rb +8 -2
  69. data/lib/datadog/tracing/contrib/graphql/unified_trace.rb +166 -0
  70. data/lib/datadog/tracing/contrib/graphql/unified_trace_patcher.rb +25 -0
  71. data/lib/datadog/tracing/contrib/kafka/consumer_event.rb +1 -1
  72. data/lib/datadog/tracing/contrib/kafka/consumer_group_event.rb +1 -1
  73. data/lib/datadog/tracing/contrib/kafka/event.rb +1 -1
  74. data/lib/datadog/tracing/contrib/kafka/events/connection/request.rb +3 -3
  75. data/lib/datadog/tracing/contrib/kafka/events/consumer/process_batch.rb +3 -3
  76. data/lib/datadog/tracing/contrib/kafka/events/consumer/process_message.rb +3 -3
  77. data/lib/datadog/tracing/contrib/kafka/events/consumer_group/heartbeat.rb +3 -3
  78. data/lib/datadog/tracing/contrib/kafka/events/produce_operation/send_messages.rb +3 -3
  79. data/lib/datadog/tracing/contrib/kafka/events/producer/deliver_messages.rb +3 -3
  80. data/lib/datadog/tracing/contrib/racecar/event.rb +2 -2
  81. data/lib/datadog/tracing/contrib/rails/ext.rb +9 -0
  82. data/lib/datadog/tracing/contrib/rails/patcher.rb +7 -0
  83. data/lib/datadog/tracing/contrib/rails/runner.rb +95 -0
  84. data/lib/datadog/tracing/distributed/b3_multi.rb +1 -1
  85. data/lib/datadog/tracing/distributed/b3_single.rb +3 -1
  86. data/lib/datadog/tracing/distributed/datadog.rb +2 -2
  87. data/lib/datadog/tracing/distributed/propagation.rb +9 -2
  88. data/lib/datadog/tracing/distributed/trace_context.rb +3 -2
  89. data/lib/datadog/tracing/span_operation.rb +3 -2
  90. data/lib/datadog/tracing/trace_operation.rb +7 -3
  91. data/lib/datadog/tracing/trace_segment.rb +4 -1
  92. data/lib/datadog/tracing/tracer.rb +9 -2
  93. data/lib/datadog/tracing.rb +5 -1
  94. data/lib/datadog/version.rb +2 -2
  95. metadata +22 -9
  96. data/lib/datadog/core/telemetry/client.rb +0 -95
  97. data/lib/datadog/core/telemetry/heartbeat.rb +0 -33
@@ -181,6 +181,7 @@ module Datadog
181
181
  start_time: nil,
182
182
  tags: nil,
183
183
  type: nil,
184
+ id: nil,
184
185
  &block
185
186
  )
186
187
  # Don't allow more span measurements if the
@@ -197,7 +198,8 @@ module Datadog
197
198
  service: service,
198
199
  start_time: start_time,
199
200
  tags: tags,
200
- type: type
201
+ type: type,
202
+ id: id
201
203
  )
202
204
 
203
205
  # Start span measurement
@@ -212,7 +214,8 @@ module Datadog
212
214
  service: nil,
213
215
  start_time: nil,
214
216
  tags: nil,
215
- type: nil
217
+ type: nil,
218
+ id: nil
216
219
  )
217
220
  begin
218
221
  # Resolve span options:
@@ -249,7 +252,8 @@ module Datadog
249
252
  start_time: start_time,
250
253
  tags: tags,
251
254
  trace_id: trace_id,
252
- type: type
255
+ type: type,
256
+ id: id
253
257
  )
254
258
  rescue StandardError => e
255
259
  Datadog.logger.debug { "Failed to build new span: #{e}" }
@@ -132,10 +132,13 @@ module Datadog
132
132
  || sampling_priority == Sampling::Ext::Priority::USER_KEEP
133
133
  end
134
134
 
135
+ # Returns the high order part of the trace id as a hexadecimal string; the most significant 64 bits.
136
+ # The String returned is padded with zeros, having a fixed length of 16 characters.
137
+ # If the high order part is zero, it returns nil.
135
138
  def high_order_tid
136
139
  high_order = Tracing::Utils::TraceId.to_high_order(@id)
137
140
 
138
- high_order.to_s(16) if high_order != 0
141
+ format('%016x', high_order) if high_order != 0
139
142
  end
140
143
 
141
144
  protected
@@ -114,6 +114,7 @@ module Datadog
114
114
  # @param [Time] start_time time which the span should have started.
115
115
  # @param [Hash<String,String>] tags extra tags which should be added to the span.
116
116
  # @param [String] type the type of the span. See {Datadog::Tracing::Metadata::Ext::AppTypes}.
117
+ # @param [Integer] the id of the new span.
117
118
  # @return [Object] If a block is provided, returns the result of the block execution.
118
119
  # @return [Datadog::Tracing::SpanOperation] If no block is provided, returns the active,
119
120
  # unfinished {Datadog::Tracing::SpanOperation}.
@@ -130,6 +131,7 @@ module Datadog
130
131
  start_time: nil,
131
132
  tags: nil,
132
133
  type: nil,
134
+ id: nil,
133
135
  &block
134
136
  )
135
137
  return skip_trace(name, &block) unless enabled
@@ -162,6 +164,7 @@ module Datadog
162
164
  tags: tags,
163
165
  type: type,
164
166
  _trace: trace,
167
+ id: id,
165
168
  &block
166
169
  )
167
170
  end
@@ -178,7 +181,8 @@ module Datadog
178
181
  start_time: start_time,
179
182
  tags: tags,
180
183
  type: type,
181
- _trace: trace
184
+ _trace: trace,
185
+ id: id
182
186
  )
183
187
  end
184
188
  end
@@ -375,6 +379,7 @@ module Datadog
375
379
  tags: nil,
376
380
  type: nil,
377
381
  _trace: nil,
382
+ id: nil,
378
383
  &block
379
384
  )
380
385
  trace = _trace || start_trace(continue_from: continue_from)
@@ -391,6 +396,7 @@ module Datadog
391
396
  service: service,
392
397
  tags: resolve_tags(tags),
393
398
  type: type,
399
+ id: id,
394
400
  &block
395
401
  )
396
402
  else
@@ -403,7 +409,8 @@ module Datadog
403
409
  service: service,
404
410
  start_time: start_time,
405
411
  tags: resolve_tags(tags),
406
- type: type
412
+ type: type,
413
+ id: id
407
414
  )
408
415
 
409
416
  span.start(start_time)
@@ -23,6 +23,7 @@ module Datadog
23
23
  start_time: nil,
24
24
  tags: nil,
25
25
  type: nil,
26
+ id: nil,
26
27
  &block
27
28
  )
28
29
 
@@ -35,6 +36,7 @@ module Datadog
35
36
  start_time: start_time,
36
37
  tags: tags,
37
38
  type: type,
39
+ id: id,
38
40
  &block
39
41
  )
40
42
  end
@@ -117,9 +119,11 @@ module Datadog
117
119
  # # dd.env=prod dd.service=auth dd.version=13.8 dd.trace_id=5458478252992251 dd.span_id=7117552347370098 My message
118
120
  # ```
119
121
  #
120
- # @return [String] correlation information
122
+ # @return [String] correlation information; or an empty String if Tracing is disabled (`!enabled?`)
121
123
  # @public_api
122
124
  def log_correlation
125
+ return '' unless enabled?
126
+
123
127
  correlation.to_log_format
124
128
  end
125
129
 
@@ -3,7 +3,7 @@
3
3
  module Datadog
4
4
  module VERSION
5
5
  MAJOR = 2
6
- MINOR = 1
6
+ MINOR = 2
7
7
  PATCH = 0
8
8
  PRE = nil
9
9
  BUILD = nil
@@ -21,6 +21,6 @@ module Datadog
21
21
  # To allow testing with the next unreleased version of Ruby, the version check is performed
22
22
  # as `< #{MAXIMUM_RUBY_VERSION}`, meaning prereleases of MAXIMUM_RUBY_VERSION are allowed
23
23
  # but not stable MAXIMUM_RUBY_VERSION releases.
24
- MAXIMUM_RUBY_VERSION = '3.4'
24
+ MAXIMUM_RUBY_VERSION = '3.5'
25
25
  end
26
26
  end
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.1.0
4
+ version: 2.2.0
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-06-10 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 9.0.0.1.0
61
+ version: 10.0.0.1.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 9.0.0.1.0
68
+ version: 10.0.0.1.0
69
69
  description: |
70
70
  datadog is Datadog's client library for Ruby. It includes a suite of tools
71
71
  which provide visibility into the performance and security of Ruby applications,
@@ -223,6 +223,7 @@ files:
223
223
  - lib/datadog/core/configuration/option_definition.rb
224
224
  - lib/datadog/core/configuration/options.rb
225
225
  - lib/datadog/core/configuration/settings.rb
226
+ - lib/datadog/core/deprecations.rb
226
227
  - lib/datadog/core/diagnostics/environment_logger.rb
227
228
  - lib/datadog/core/diagnostics/health.rb
228
229
  - lib/datadog/core/encoding.rb
@@ -281,17 +282,20 @@ files:
281
282
  - lib/datadog/core/remote/worker.rb
282
283
  - lib/datadog/core/runtime/ext.rb
283
284
  - lib/datadog/core/runtime/metrics.rb
284
- - lib/datadog/core/telemetry/client.rb
285
+ - lib/datadog/core/telemetry/component.rb
285
286
  - lib/datadog/core/telemetry/emitter.rb
286
287
  - lib/datadog/core/telemetry/event.rb
287
288
  - lib/datadog/core/telemetry/ext.rb
288
- - lib/datadog/core/telemetry/heartbeat.rb
289
289
  - lib/datadog/core/telemetry/http/adapters/net.rb
290
290
  - lib/datadog/core/telemetry/http/env.rb
291
291
  - lib/datadog/core/telemetry/http/ext.rb
292
292
  - lib/datadog/core/telemetry/http/response.rb
293
293
  - lib/datadog/core/telemetry/http/transport.rb
294
+ - lib/datadog/core/telemetry/metric.rb
295
+ - lib/datadog/core/telemetry/metrics_collection.rb
296
+ - lib/datadog/core/telemetry/metrics_manager.rb
294
297
  - lib/datadog/core/telemetry/request.rb
298
+ - lib/datadog/core/telemetry/worker.rb
295
299
  - lib/datadog/core/transport/ext.rb
296
300
  - lib/datadog/core/transport/http/adapters/net.rb
297
301
  - lib/datadog/core/transport/http/adapters/registry.rb
@@ -312,6 +316,7 @@ files:
312
316
  - lib/datadog/core/utils/hash.rb
313
317
  - lib/datadog/core/utils/network.rb
314
318
  - lib/datadog/core/utils/only_once.rb
319
+ - lib/datadog/core/utils/only_once_successful.rb
315
320
  - lib/datadog/core/utils/safe_dup.rb
316
321
  - lib/datadog/core/utils/sequence.rb
317
322
  - lib/datadog/core/utils/time.rb
@@ -355,6 +360,7 @@ files:
355
360
  - lib/datadog/profiling/crashtracker.rb
356
361
  - lib/datadog/profiling/exporter.rb
357
362
  - lib/datadog/profiling/ext.rb
363
+ - lib/datadog/profiling/ext/dir_monkey_patches.rb
358
364
  - lib/datadog/profiling/ext/forking.rb
359
365
  - lib/datadog/profiling/flush.rb
360
366
  - lib/datadog/profiling/http_transport.rb
@@ -447,6 +453,9 @@ files:
447
453
  - lib/datadog/tracing/contrib/active_record/integration.rb
448
454
  - lib/datadog/tracing/contrib/active_record/patcher.rb
449
455
  - lib/datadog/tracing/contrib/active_record/utils.rb
456
+ - lib/datadog/tracing/contrib/active_support/cache/event.rb
457
+ - lib/datadog/tracing/contrib/active_support/cache/events.rb
458
+ - lib/datadog/tracing/contrib/active_support/cache/events/cache.rb
450
459
  - lib/datadog/tracing/contrib/active_support/cache/instrumentation.rb
451
460
  - lib/datadog/tracing/contrib/active_support/cache/patcher.rb
452
461
  - lib/datadog/tracing/contrib/active_support/cache/redis.rb
@@ -536,6 +545,8 @@ files:
536
545
  - lib/datadog/tracing/contrib/graphql/patcher.rb
537
546
  - lib/datadog/tracing/contrib/graphql/trace_patcher.rb
538
547
  - lib/datadog/tracing/contrib/graphql/tracing_patcher.rb
548
+ - lib/datadog/tracing/contrib/graphql/unified_trace.rb
549
+ - lib/datadog/tracing/contrib/graphql/unified_trace_patcher.rb
539
550
  - lib/datadog/tracing/contrib/grpc.rb
540
551
  - lib/datadog/tracing/contrib/grpc/configuration/settings.rb
541
552
  - lib/datadog/tracing/contrib/grpc/datadog_interceptor.rb
@@ -664,6 +675,7 @@ files:
664
675
  - lib/datadog/tracing/contrib/rails/middlewares.rb
665
676
  - lib/datadog/tracing/contrib/rails/patcher.rb
666
677
  - lib/datadog/tracing/contrib/rails/railtie.rb
678
+ - lib/datadog/tracing/contrib/rails/runner.rb
667
679
  - lib/datadog/tracing/contrib/rails/utils.rb
668
680
  - lib/datadog/tracing/contrib/rake/configuration/settings.rb
669
681
  - lib/datadog/tracing/contrib/rake/ext.rb
@@ -840,7 +852,8 @@ licenses:
840
852
  - Apache-2.0
841
853
  metadata:
842
854
  allowed_push_host: https://rubygems.org
843
- changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/master/CHANGELOG.md
855
+ changelog_uri: https://github.com/DataDog/dd-trace-rb/blob/v2.2.0/CHANGELOG.md
856
+ source_code_uri: https://github.com/DataDog/dd-trace-rb/tree/v2.2.0
844
857
  post_install_message:
845
858
  rdoc_options: []
846
859
  require_paths:
@@ -852,14 +865,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
852
865
  version: 2.5.0
853
866
  - - "<"
854
867
  - !ruby/object:Gem::Version
855
- version: '3.4'
868
+ version: '3.5'
856
869
  required_rubygems_version: !ruby/object:Gem::Requirement
857
870
  requirements:
858
871
  - - ">="
859
872
  - !ruby/object:Gem::Version
860
873
  version: 2.0.0
861
874
  requirements: []
862
- rubygems_version: 3.4.10
875
+ rubygems_version: 3.4.21
863
876
  signing_key:
864
877
  specification_version: 4
865
878
  summary: Datadog tracing code for your Ruby applications
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'emitter'
4
- require_relative 'event'
5
- require_relative 'heartbeat'
6
- require_relative '../utils/forking'
7
-
8
- module Datadog
9
- module Core
10
- module Telemetry
11
- # Telemetry entrypoint, coordinates sending telemetry events at various points in app lifecycle.
12
- class Client
13
- attr_reader \
14
- :enabled,
15
- :unsupported
16
-
17
- include Core::Utils::Forking
18
-
19
- # @param enabled [Boolean] Determines whether telemetry events should be sent to the API
20
- # @param heartbeat_interval_seconds [Float] How frequently heartbeats will be reported, in seconds.
21
- # @param [Boolean] dependency_collection Whether to send the `app-dependencies-loaded` event
22
- def initialize(heartbeat_interval_seconds:, dependency_collection:, enabled: true)
23
- @enabled = enabled
24
- @emitter = Emitter.new
25
- @stopped = false
26
- @unsupported = false
27
- @started = false
28
- @dependency_collection = dependency_collection
29
-
30
- @worker = Telemetry::Heartbeat.new(enabled: @enabled, heartbeat_interval_seconds: heartbeat_interval_seconds) do
31
- next unless @started # `started!` should be the first event, thus ensure that `heartbeat!` is not sent first.
32
-
33
- heartbeat!
34
- end
35
- end
36
-
37
- def disable!
38
- @enabled = false
39
- @worker.enabled = false
40
- end
41
-
42
- def started!
43
- return if !@enabled || forked?
44
-
45
- res = @emitter.request(Event::AppStarted.new)
46
-
47
- if res.not_found? # Telemetry is only supported by agent versions 7.34 and up
48
- Datadog.logger.debug('Agent does not support telemetry; disabling future telemetry events.')
49
- disable!
50
- @unsupported = true # Prevent telemetry from getting re-enabled
51
- return res
52
- end
53
-
54
- @emitter.request(Event::AppDependenciesLoaded.new) if @dependency_collection
55
-
56
- @started = true
57
- end
58
-
59
- def emit_closing!
60
- return if !@enabled || forked?
61
-
62
- @emitter.request(Event::AppClosing.new)
63
- end
64
-
65
- def stop!
66
- return if @stopped
67
-
68
- @worker.stop(true, 0)
69
- @stopped = true
70
- end
71
-
72
- def integrations_change!
73
- return if !@enabled || forked?
74
-
75
- @emitter.request(Event::AppIntegrationsChange.new)
76
- end
77
-
78
- # Report configuration changes caused by Remote Configuration.
79
- def client_configuration_change!(changes)
80
- return if !@enabled || forked?
81
-
82
- @emitter.request(Event::AppClientConfigurationChange.new(changes, 'remote_config'))
83
- end
84
-
85
- private
86
-
87
- def heartbeat!
88
- return if !@enabled || forked?
89
-
90
- @emitter.request(Event::AppHeartbeat.new)
91
- end
92
- end
93
- end
94
- end
95
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../worker'
4
- require_relative '../workers/polling'
5
-
6
- module Datadog
7
- module Core
8
- module Telemetry
9
- # Periodically (every DEFAULT_INTERVAL_SECONDS) sends a heartbeat event to the telemetry API.
10
- class Heartbeat < Core::Worker
11
- include Core::Workers::Polling
12
-
13
- def initialize(heartbeat_interval_seconds:, enabled: true, &block)
14
- # Workers::Polling settings
15
- self.enabled = enabled
16
- # Workers::IntervalLoop settings
17
- self.loop_base_interval = heartbeat_interval_seconds
18
- self.fork_policy = Core::Workers::Async::Thread::FORK_POLICY_STOP
19
- super(&block)
20
- start
21
- end
22
-
23
- def loop_wait_before_first_iteration?; end
24
-
25
- private
26
-
27
- def start
28
- perform
29
- end
30
- end
31
- end
32
- end
33
- end