datadog 2.40.0 → 2.41.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 (117) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +85 -58
  3. data/ext/datadog_profiling_native_extension/collectors_stack.c +2 -2
  4. data/ext/datadog_profiling_native_extension/native_extension_helpers.rb +3 -3
  5. data/ext/datadog_profiling_native_extension/private_vm_api_access.c +26 -12
  6. data/ext/libdatadog_api/trace_exporter.c +409 -71
  7. data/ext/libdatadog_extconf_helpers.rb +1 -1
  8. data/lib/datadog/ai_guard/api_client.rb +1 -1
  9. data/lib/datadog/ai_guard/evaluation/request.rb +8 -8
  10. data/lib/datadog/ai_guard/evaluation.rb +10 -3
  11. data/lib/datadog/ai_guard/ext.rb +1 -1
  12. data/lib/datadog/appsec/actions_handler/serializable_backtrace.rb +21 -42
  13. data/lib/datadog/appsec/api_security/endpoint_collection/grape_route_serializer.rb +1 -1
  14. data/lib/datadog/appsec/api_security/endpoint_collection/rails_route_serializer.rb +1 -1
  15. data/lib/datadog/appsec/api_security/endpoint_collection/sinatra_route_serializer.rb +1 -1
  16. data/lib/datadog/appsec/configuration.rb +2 -2
  17. data/lib/datadog/appsec/context.rb +1 -1
  18. data/lib/datadog/appsec/contrib/active_record/instrumentation.rb +1 -1
  19. data/lib/datadog/appsec/contrib/aws_lambda/waf_addresses.rb +2 -2
  20. data/lib/datadog/appsec/contrib/devise/configuration.rb +1 -1
  21. data/lib/datadog/appsec/contrib/excon/ssrf_detection_middleware.rb +2 -2
  22. data/lib/datadog/appsec/contrib/faraday/ssrf_detection_middleware.rb +2 -2
  23. data/lib/datadog/appsec/contrib/graphql/gateway/watcher.rb +1 -1
  24. data/lib/datadog/appsec/contrib/rack/ext.rb +2 -2
  25. data/lib/datadog/appsec/contrib/rack/gateway/watcher.rb +2 -2
  26. data/lib/datadog/appsec/contrib/rails/gateway/watcher.rb +2 -2
  27. data/lib/datadog/appsec/contrib/rest_client/request_ssrf_detection_patch.rb +2 -2
  28. data/lib/datadog/appsec/contrib/sinatra/gateway/watcher.rb +2 -2
  29. data/lib/datadog/appsec/processor/rule_loader.rb +12 -12
  30. data/lib/datadog/appsec/response.rb +1 -1
  31. data/lib/datadog/appsec/route_normalizer/route_pattern.rb +3 -3
  32. data/lib/datadog/appsec/security_engine/engine.rb +3 -3
  33. data/lib/datadog/core/configuration/components.rb +2 -2
  34. data/lib/datadog/core/configuration/option_definition.rb +1 -1
  35. data/lib/datadog/core/configuration/options.rb +1 -1
  36. data/lib/datadog/core/diagnostics/environment_logger.rb +36 -1
  37. data/lib/datadog/core/metrics/helpers.rb +1 -1
  38. data/lib/datadog/core/metrics/options.rb +2 -2
  39. data/lib/datadog/core/process_discovery.rb +1 -1
  40. data/lib/datadog/core/remote/client.rb +1 -1
  41. data/lib/datadog/core/remote/configuration/repository.rb +2 -2
  42. data/lib/datadog/core/telemetry/configuration_value.rb +38 -0
  43. data/lib/datadog/core/telemetry/event/app_client_configuration_change.rb +3 -1
  44. data/lib/datadog/core/telemetry/event/app_endpoints_loaded.rb +1 -1
  45. data/lib/datadog/core/telemetry/event/app_started.rb +5 -24
  46. data/lib/datadog/core/telemetry/event/generate_metrics.rb +1 -1
  47. data/lib/datadog/core/telemetry/event/log.rb +2 -2
  48. data/lib/datadog/core/telemetry/metric.rb +2 -2
  49. data/lib/datadog/core/telemetry/request.rb +2 -2
  50. data/lib/datadog/core/transport/http.rb +1 -1
  51. data/lib/datadog/core/transport/transport.rb +1 -1
  52. data/lib/datadog/core/utils/at_fork_monkey_patch.rb +127 -43
  53. data/lib/datadog/data_streams/processor.rb +14 -14
  54. data/lib/datadog/di/el/compiler.rb +23 -0
  55. data/lib/datadog/di/el/expression.rb +8 -5
  56. data/lib/datadog/di/instrumenter.rb +5 -4
  57. data/lib/datadog/di/probe_builder.rb +5 -4
  58. data/lib/datadog/di/probe_notification_builder.rb +2 -2
  59. data/lib/datadog/di/serializer.rb +29 -4
  60. data/lib/datadog/error_tracking/component.rb +1 -1
  61. data/lib/datadog/kit/appsec/events/v2.rb +2 -2
  62. data/lib/datadog/open_feature/exposures/batch_builder.rb +1 -1
  63. data/lib/datadog/open_feature/exposures/event.rb +5 -5
  64. data/lib/datadog/profiling/collectors/info.rb +1 -1
  65. data/lib/datadog/profiling/tasks/exec.rb +1 -1
  66. data/lib/datadog/symbol_database/extractor.rb +6 -6
  67. data/lib/datadog/tracing/configuration/dynamic/option.rb +4 -0
  68. data/lib/datadog/tracing/configuration/dynamic.rb +5 -3
  69. data/lib/datadog/tracing/contrib/action_cable/events.rb +1 -1
  70. data/lib/datadog/tracing/contrib/action_mailer/events.rb +1 -1
  71. data/lib/datadog/tracing/contrib/action_pack/action_controller/instrumentation.rb +2 -2
  72. data/lib/datadog/tracing/contrib/action_view/events.rb +1 -1
  73. data/lib/datadog/tracing/contrib/active_model_serializers/events.rb +1 -1
  74. data/lib/datadog/tracing/contrib/active_record/configuration/resolver.rb +1 -1
  75. data/lib/datadog/tracing/contrib/active_record/events.rb +1 -1
  76. data/lib/datadog/tracing/contrib/active_support/cache/events/cache.rb +2 -2
  77. data/lib/datadog/tracing/contrib/aws/ext.rb +1 -1
  78. data/lib/datadog/tracing/contrib/aws/services.rb +1 -1
  79. data/lib/datadog/tracing/contrib/elasticsearch/quantize.rb +1 -1
  80. data/lib/datadog/tracing/contrib/ext.rb +3 -3
  81. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/client.rb +1 -1
  82. data/lib/datadog/tracing/contrib/grpc/datadog_interceptor/server.rb +1 -1
  83. data/lib/datadog/tracing/contrib/grpc/distributed/propagation.rb +1 -1
  84. data/lib/datadog/tracing/contrib/kafka/events.rb +1 -1
  85. data/lib/datadog/tracing/contrib/karafka/distributed/propagation.rb +1 -1
  86. data/lib/datadog/tracing/contrib/mongodb/parsers.rb +1 -1
  87. data/lib/datadog/tracing/contrib/opensearch/ext.rb +1 -1
  88. data/lib/datadog/tracing/contrib/opensearch/quantize.rb +1 -1
  89. data/lib/datadog/tracing/contrib/patchable.rb +1 -1
  90. data/lib/datadog/tracing/contrib/patcher.rb +1 -1
  91. data/lib/datadog/tracing/contrib/que/tracer.rb +1 -1
  92. data/lib/datadog/tracing/contrib/racecar/events.rb +1 -1
  93. data/lib/datadog/tracing/contrib/rack/configuration/settings.rb +1 -1
  94. data/lib/datadog/tracing/contrib/rack/header_tagging.rb +1 -1
  95. data/lib/datadog/tracing/contrib/rack/patcher.rb +1 -1
  96. data/lib/datadog/tracing/contrib/rack/trace_proxy_middleware.rb +1 -1
  97. data/lib/datadog/tracing/contrib/redis/configuration/resolver.rb +1 -1
  98. data/lib/datadog/tracing/contrib/redis/quantize.rb +36 -2
  99. data/lib/datadog/tracing/contrib/redis/trace_middleware.rb +9 -3
  100. data/lib/datadog/tracing/contrib/sequel/utils.rb +1 -1
  101. data/lib/datadog/tracing/contrib/sidekiq/distributed/propagation.rb +1 -1
  102. data/lib/datadog/tracing/contrib/sinatra/configuration/settings.rb +1 -1
  103. data/lib/datadog/tracing/contrib/sneakers/tracer.rb +1 -1
  104. data/lib/datadog/tracing/contrib/utils/quantization/hash_formatter.rb +1 -1
  105. data/lib/datadog/tracing/contrib/waterdrop/distributed/propagation.rb +1 -1
  106. data/lib/datadog/tracing/correlation.rb +2 -2
  107. data/lib/datadog/tracing/diagnostics/environment_logger.rb +2 -2
  108. data/lib/datadog/tracing/distributed/baggage.rb +1 -2
  109. data/lib/datadog/tracing/metadata/tagging.rb +1 -1
  110. data/lib/datadog/tracing/remote.rb +2 -2
  111. data/lib/datadog/tracing/span.rb +1 -1
  112. data/lib/datadog/tracing/span_operation.rb +1 -1
  113. data/lib/datadog/tracing/transport/io/traces.rb +1 -1
  114. data/lib/datadog/tracing/transport/native.rb +78 -54
  115. data/lib/datadog/tracing/writer.rb +1 -1
  116. data/lib/datadog/version.rb +1 -1
  117. metadata +6 -5
@@ -160,6 +160,7 @@ module Datadog
160
160
  end
161
161
 
162
162
  loc = target_method&.source_location
163
+ # @type var instrumenter: Instrumenter
163
164
  instrumenter = self
164
165
 
165
166
  mod = Module.new do
@@ -193,7 +194,7 @@ module Datadog
193
194
  # user probe on Proc#call cannot intercept the trampoline, and no
194
195
  # Proc is allocated for the block.
195
196
  if RubyVersion.is?(">= 3")
196
- define_method(method_name) do |*args, **kwargs, &target_block| # steep:ignore NoMethod
197
+ define_method(method_name) do |*args, **kwargs, &target_block|
197
198
  # steep:ignore FallbackAny below: Steep cannot narrow the
198
199
  # **kwargs parameter inside this define_method block, so it
199
200
  # falls back to untyped at the super and run_method_probe sites.
@@ -211,7 +212,7 @@ module Datadog
211
212
  end
212
213
  end
213
214
  else
214
- define_method(method_name) do |*args, &target_block| # steep:ignore NoMethod
215
+ define_method(method_name) do |*args, &target_block|
215
216
  if DI.in_probe?
216
217
  return super(*args, &target_block)
217
218
  end
@@ -230,7 +231,7 @@ module Datadog
230
231
  super(*args, &target_block)
231
232
  end
232
233
  end
233
- ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true) # steep:ignore NoMethod
234
+ ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true)
234
235
  end
235
236
  end
236
237
 
@@ -461,7 +462,7 @@ module Datadog
461
462
  # @param args [Array] positional arguments passed to the probed method
462
463
  # @param kwargs [Hash{Symbol => Object}] keyword arguments passed to the probed method
463
464
  # @param target_block [Proc, nil] block argument passed to the probed method
464
- # @param target_self [Object] the receiver of the probed method invocation
465
+ # @param target_self [any] the receiver of the probed method invocation
465
466
  # @param probe [Datadog::DI::Probe] the probe whose callback this invocation runs
466
467
  # @param responder [#probe_executed_callback, #probe_condition_evaluation_failed_callback] callback target invoked with the built Context
467
468
  # @param loc [Array(String, Integer), nil] source location of the probed method, or nil for virtual/lazily-defined methods
@@ -46,7 +46,7 @@ module Datadog
46
46
  raise ArgumentError, "Malformed condition specification for probe: #{config}"
47
47
  end
48
48
  compiled, regexps = EL::Compiler.new.compile(cond_spec["json"])
49
- EL::Expression.new(cond_spec["dsl"], compiled, regexps)
49
+ EL::Expression.new(cond_spec["dsl"], compiled, regexps: regexps)
50
50
  end
51
51
  capture_expressions = build_capture_expressions(config["captureExpressions"])
52
52
  capture_expressions = dedup_capture_expressions(capture_expressions, config["id"], logger)
@@ -101,7 +101,7 @@ module Datadog
101
101
  raise ArgumentError, "captureExpressions entry #{name}: missing or malformed expr"
102
102
  end
103
103
  compiled, regexps = EL::Compiler.new.compile(expr_spec["json"])
104
- expr = EL::Expression.new(expr_spec["dsl"], compiled, regexps)
104
+ expr = EL::Expression.new(expr_spec["dsl"], compiled, regexps: regexps)
105
105
  limits = build_capture_limits(entry["capture"])
106
106
  CaptureExpression.new(name: name, expr: expr, limits: limits)
107
107
  end
@@ -152,8 +152,9 @@ module Datadog
152
152
  unless dsl = segment["dsl"]
153
153
  raise ArgumentError, "Missing dsl for json in segment: #{segment}"
154
154
  end
155
- compiled, regexps = EL::Compiler.new.compile(ast)
156
- EL::Expression.new(dsl, compiled, regexps)
155
+ compiler = EL::Compiler.new
156
+ compiled, regexps = compiler.compile(ast)
157
+ EL::Expression.new(dsl, compiled, regexps: regexps, redaction_identifier: compiler.redaction_identifier(ast))
157
158
  else
158
159
  # TODO report to telemetry?
159
160
  end
@@ -179,7 +179,7 @@ module Datadog
179
179
  if status == "ERROR"
180
180
  diagnostics[:exception] = { # steep:ignore
181
181
  type: exception ? exception.class.name : "Error",
182
- message: exception ? exception.message : message
182
+ message: exception ? exception.message : message,
183
183
  }
184
184
  end
185
185
 
@@ -405,7 +405,7 @@ module Datadog
405
405
  when String
406
406
  segment
407
407
  when EL::Expression
408
- serializer.serialize_value_for_message(segment.evaluate(context))
408
+ serializer.serialize_value_for_message(segment.evaluate(context), name: segment.redaction_identifier)
409
409
  else
410
410
  raise ArgumentError, "Invalid template segment type: #{segment}"
411
411
  end
@@ -50,6 +50,13 @@ module Datadog
50
50
  # return a safe stub rather than tear the process down.
51
51
  SERIALIZABLE_FATAL_EXCEPTION_CLASSES = [SystemExit, SignalException].freeze
52
52
 
53
+ # Placeholder emitted by #serialize_value_for_message in place of a value
54
+ # whose identifier or type matches the redaction configuration. This
55
+ # mirrors, for the human-readable log-probe message path, the
56
+ # notCapturedReason: "redactedIdent"/"redactedType" gating that
57
+ # #serialize_value applies on the snapshot path.
58
+ REDACTED_VALUE_FOR_MESSAGE = "[redacted]"
59
+
53
60
  # Third-party library integration / custom serializers.
54
61
  #
55
62
  # Dynamic instrumentation has limited payload sizes, and for efficiency
@@ -375,9 +382,17 @@ module Datadog
375
382
  #
376
383
  # We also use the Ruby-like syntax for symbols, which don't exist
377
384
  # in other languages.
378
- def serialize_value_for_message(value, depth = 1)
385
+ #
386
+ # +name+, when given, is the identifier the template expression
387
+ # references at its top level; a redacted identifier yields the
388
+ # redaction placeholder, mirroring #serialize_value on the snapshot path.
389
+ def serialize_value_for_message(value, depth: 1, name: nil)
379
390
  # This method is more verbose than "normal" Ruby code to avoid
380
391
  # array allocations.
392
+
393
+ return REDACTED_VALUE_FOR_MESSAGE if redactor.redact_type?(value)
394
+ return REDACTED_VALUE_FOR_MESSAGE if name && redactor.redact_identifier?(name)
395
+
381
396
  case value
382
397
  when NilClass
383
398
  "nil"
@@ -398,7 +413,7 @@ module Datadog
398
413
  value = value_
399
414
  end
400
415
  "[" + value.map do |item|
401
- serialize_value_for_message(item, depth - 1)
416
+ serialize_value_for_message(item, depth: depth - 1)
402
417
  end.join(", ") + "]"
403
418
  when Hash
404
419
  return "..." if depth <= 0
@@ -413,7 +428,12 @@ module Datadog
413
428
  truncated = true
414
429
  end
415
430
  serialized = keys.map do |key|
416
- "#{serialize_value_for_message(key, depth - 1)} => #{serialize_value_for_message(value[key], depth - 1)}"
431
+ serialized_value = if (String === key || Symbol === key) && redactor.redact_identifier?(key)
432
+ REDACTED_VALUE_FOR_MESSAGE
433
+ else
434
+ serialize_value_for_message(value[key], depth: depth - 1)
435
+ end
436
+ "#{serialize_value_for_message(key, depth: depth - 1)} => #{serialized_value}"
417
437
  end
418
438
  if truncated
419
439
  serialized[serialized.length] = serialized[serialized.length - 1]
@@ -435,7 +455,12 @@ module Datadog
435
455
  serialized = vars.map do |var|
436
456
  # +var+ here is always the instance variable name which is a
437
457
  # symbol, we do not need to run it through our serializer.
438
- "#{var}=#{serialize_value_for_message(value.send(:instance_variable_get, var), depth - 1)}"
458
+ serialized_value = if redactor.redact_identifier?(var)
459
+ REDACTED_VALUE_FOR_MESSAGE
460
+ else
461
+ serialize_value_for_message(value.send(:instance_variable_get, var), depth: depth - 1)
462
+ end
463
+ "#{var}=#{serialized_value}"
439
464
  end
440
465
  if truncated
441
466
  serialized << serialized.last
@@ -154,7 +154,7 @@ module Datadog
154
154
  attributes = {
155
155
  "exception.type" => formatted_exception.type,
156
156
  "exception.message" => formatted_exception.message,
157
- "exception.stacktrace" => formatted_exception.backtrace
157
+ "exception.stacktrace" => formatted_exception.backtrace,
158
158
  }
159
159
  Datadog::Tracing::SpanEvent.new("exception", attributes: attributes)
160
160
  end
@@ -19,7 +19,7 @@ module Datadog
19
19
  TELEMETRY_METRICS_EVENTS_INTO_TYPES = {
20
20
  LOGIN_SUCCESS_EVENT => "login_success",
21
21
  LOGIN_FAILURE_EVENT => "login_failure",
22
- SIGNUP_EVENT => "signup"
22
+ SIGNUP_EVENT => "signup",
23
23
  }.freeze
24
24
 
25
25
  class << self
@@ -241,7 +241,7 @@ module Datadog
241
241
 
242
242
  tags = {
243
243
  event_type: TELEMETRY_METRICS_EVENTS_INTO_TYPES[event],
244
- sdk_version: TELEMETRY_METRICS_SDK_VERSION
244
+ sdk_version: TELEMETRY_METRICS_SDK_VERSION,
245
245
  }
246
246
  telemetry.inc(TELEMETRY_METRICS_NAMESPACE, TELEMETRY_METRICS_SDK_EVENT, 1, tags: tags)
247
247
  end
@@ -12,7 +12,7 @@ module Datadog
12
12
  def payload_for(events)
13
13
  {
14
14
  context: @context,
15
- exposures: events
15
+ exposures: events,
16
16
  }
17
17
  end
18
18
 
@@ -23,18 +23,18 @@ module Datadog
23
23
  {
24
24
  timestamp: current_timestamp_ms,
25
25
  allocation: {
26
- key: result.allocation_key
26
+ key: result.allocation_key,
27
27
  },
28
28
  flag: {
29
- key: flag_key
29
+ key: flag_key,
30
30
  },
31
31
  variant: {
32
- key: result.variant
32
+ key: result.variant,
33
33
  },
34
34
  subject: {
35
35
  id: context.targeting_key,
36
- attributes: extract_attributes(context)
37
- }
36
+ attributes: extract_attributes(context),
37
+ },
38
38
  }.freeze
39
39
  end
40
40
 
@@ -83,7 +83,7 @@ module Datadog
83
83
  hostname: Datadog::Core::Environment::Platform.hostname,
84
84
  kernel_name: Datadog::Core::Environment::Platform.kernel_name,
85
85
  kernel_release: Datadog::Core::Environment::Platform.kernel_release,
86
- kernel_version: Datadog::Core::Environment::Platform.kernel_version
86
+ kernel_version: Datadog::Core::Environment::Platform.kernel_version,
87
87
  }.freeze
88
88
  end
89
89
 
@@ -21,7 +21,7 @@ module Datadog
21
21
  #: () -> ::Array["-rdatadog/profiling/preload"]
22
22
  def rubyopts
23
23
  [
24
- "-rdatadog/profiling/preload"
24
+ "-rdatadog/profiling/preload",
25
25
  ]
26
26
  end
27
27
 
@@ -616,7 +616,7 @@ module Datadog
616
616
  language_specifics: {
617
617
  visibility: method_visibility(klass, method_name),
618
618
  method_type: method_type.to_s,
619
- arity: method.arity
619
+ arity: method.arity,
620
620
  },
621
621
  symbols: extract_method_parameters(method)
622
622
  )
@@ -647,7 +647,7 @@ module Datadog
647
647
  # @param start_line [Integer] Fallback end_line if iseq unavailable
648
648
  # @return [Array(Array<Hash>, Integer), Array(nil, Integer)]
649
649
  def extract_targetable_lines(method, start_line)
650
- iseq = RubyVM::InstructionSequence.of(method) # steep:ignore
650
+ iseq = RubyVM::InstructionSequence.of(method)
651
651
  unless iseq
652
652
  @logger.debug { "symdb: no iseq for #{method.name} (C extension or native), skipping targetable lines" }
653
653
  return [nil, start_line]
@@ -801,7 +801,7 @@ module Datadog
801
801
  # objects allocated to read `source_location` are not retained between
802
802
  # passes, so they can be GC'd as soon as the inner loop ends.
803
803
  def collect_method_names_by_file(mod)
804
- result = Hash.new { |h, k| h[k] = [] } # steep:ignore
804
+ result = Hash.new { |h, k| h[k] = [] }
805
805
 
806
806
  # Module#instance_methods(false) already returns both public and protected
807
807
  # methods, so iterating it plus private_instance_methods covers all three
@@ -905,7 +905,7 @@ module Datadog
905
905
  current[:children][part] ||= {
906
906
  name: fqn, type: resolve_scope_type(fqn),
907
907
  children: {}, methods: [], mod: nil,
908
- source_file: file_path, fqn: fqn
908
+ source_file: file_path, fqn: fqn,
909
909
  }
910
910
  current = current[:children][part]
911
911
  end
@@ -924,7 +924,7 @@ module Datadog
924
924
  type: (Class === mod) ? "CLASS" : "MODULE",
925
925
  children: {}, methods: [],
926
926
  mod: mod, source_file: file_path,
927
- fqn: mod_name
927
+ fqn: mod_name,
928
928
  }
929
929
  current[:children][leaf_name] = leaf
930
930
  end
@@ -1043,7 +1043,7 @@ module Datadog
1043
1043
  language_specifics: {
1044
1044
  visibility: klass ? method_visibility(klass, method_name) : "public", # steep:ignore
1045
1045
  method_type: "instance",
1046
- arity: method.arity
1046
+ arity: method.arity,
1047
1047
  },
1048
1048
  symbols: extract_method_parameters(method)
1049
1049
  )
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../../core/telemetry/configuration_value"
4
+
3
5
  module Datadog
4
6
  module Tracing
5
7
  module Configuration
@@ -56,6 +58,8 @@ module Datadog
56
58
  precedence: Core::Configuration::Option::Precedence::REMOTE_CONFIGURATION
57
59
  )
58
60
  end
61
+
62
+ Core::Telemetry::ConfigurationValue.convert(value)
59
63
  end
60
64
 
61
65
  protected
@@ -24,11 +24,11 @@ module Datadog
24
24
  def call(tracing_header_tags)
25
25
  # Modify the remote configuration value that it matches the
26
26
  # environment variable it configures.
27
- tracing_header_tags&.map! do |hash|
27
+ parsed_header_tags = tracing_header_tags&.map do |hash|
28
28
  "#{hash["header"]}:#{hash["tag_name"]}"
29
29
  end
30
30
 
31
- super
31
+ super(parsed_header_tags)
32
32
  end
33
33
  end
34
34
 
@@ -42,6 +42,7 @@ module Datadog
42
42
  def call(tracing_sampling_rate)
43
43
  super
44
44
  Datadog.send(:components).reconfigure_sampler
45
+ tracing_sampling_rate
45
46
  end
46
47
 
47
48
  protected
@@ -78,8 +79,9 @@ module Datadog
78
79
  tracing_sampling_rules = tracing_sampling_rules.to_json
79
80
  end
80
81
 
81
- super
82
+ telemetry_value = super
82
83
  Datadog.send(:components).reconfigure_sampler
84
+ telemetry_value
83
85
  end
84
86
 
85
87
  protected
@@ -14,7 +14,7 @@ module Datadog
14
14
  ALL = [
15
15
  Events::Broadcast,
16
16
  Events::PerformAction,
17
- Events::Transmit
17
+ Events::Transmit,
18
18
  ].freeze
19
19
 
20
20
  module_function
@@ -11,7 +11,7 @@ module Datadog
11
11
  module Events
12
12
  ALL = [
13
13
  Events::Process,
14
- Events::Deliver
14
+ Events::Deliver,
15
15
  ].freeze
16
16
 
17
17
  module_function
@@ -108,9 +108,9 @@ module Datadog
108
108
  headers: {
109
109
  # The exception this controller was given in the request,
110
110
  # which is typical if the controller is configured to handle exceptions.
111
- request_exception: request.headers["action_dispatch.exception"]
111
+ request_exception: request.headers["action_dispatch.exception"],
112
112
  },
113
- tracing_context: {}
113
+ tracing_context: {},
114
114
  }
115
115
 
116
116
  begin
@@ -11,7 +11,7 @@ module Datadog
11
11
  module Events
12
12
  ALL = [
13
13
  Events::RenderPartial,
14
- Events::RenderTemplate
14
+ Events::RenderTemplate,
15
15
  ].freeze
16
16
 
17
17
  module_function
@@ -11,7 +11,7 @@ module Datadog
11
11
  module Events
12
12
  ALL = [
13
13
  Events::Render,
14
- Events::Serialize
14
+ Events::Serialize,
15
15
  ].freeze
16
16
 
17
17
  module_function
@@ -138,7 +138,7 @@ module Datadog
138
138
  host: active_record_config[:host],
139
139
  port: active_record_config[:port],
140
140
  database: active_record_config[:database],
141
- username: active_record_config[:username]
141
+ username: active_record_config[:username],
142
142
  }
143
143
  end
144
144
 
@@ -11,7 +11,7 @@ module Datadog
11
11
  module Events
12
12
  ALL = [
13
13
  Events::Instantiation,
14
- Events::SQL
14
+ Events::SQL,
15
15
  ].freeze
16
16
 
17
17
  module_function
@@ -32,7 +32,7 @@ module Datadog
32
32
 
33
33
  def span_options
34
34
  {
35
- type: Ext::SPAN_TYPE_CACHE
35
+ type: Ext::SPAN_TYPE_CACHE,
36
36
  }
37
37
  end
38
38
 
@@ -42,7 +42,7 @@ module Datadog
42
42
  "cache_read.active_support" => {resource: Ext::RESOURCE_CACHE_GET},
43
43
  "cache_read_multi.active_support" => {resource: Ext::RESOURCE_CACHE_MGET, multi_key: true},
44
44
  "cache_write.active_support" => {resource: Ext::RESOURCE_CACHE_SET},
45
- "cache_write_multi.active_support" => {resource: Ext::RESOURCE_CACHE_MSET, multi_key: true}
45
+ "cache_write_multi.active_support" => {resource: Ext::RESOURCE_CACHE_MSET, multi_key: true},
46
46
  }.freeze
47
47
 
48
48
  def trace?(event, payload)
@@ -42,7 +42,7 @@ module Datadog
42
42
  TAG_STATE_MACHINE_NAME,
43
43
  Tracing::Metadata::Ext::TAG_PEER_HOSTNAME,
44
44
  Tracing::Metadata::Ext::NET::TAG_DESTINATION_NAME,
45
- Tracing::Metadata::Ext::NET::TAG_TARGET_HOST,].freeze
45
+ Tracing::Metadata::Ext::NET::TAG_TARGET_HOST].freeze
46
46
  end
47
47
  end
48
48
  end
@@ -131,7 +131,7 @@ module Datadog
131
131
  "kinesis" => Service::Kinesis.new,
132
132
  "eventbridge" => Service::EventBridge.new,
133
133
  "states" => Service::States.new,
134
- "s3" => Service::S3.new
134
+ "s3" => Service::S3.new,
135
135
  }.freeze
136
136
  end
137
137
  end
@@ -15,7 +15,7 @@ module Datadog
15
15
  DEFAULT_OPTIONS = {
16
16
  exclude: EXCLUDE_KEYS,
17
17
  show: SHOW_KEYS,
18
- placeholder: PLACEHOLDER
18
+ placeholder: PLACEHOLDER,
19
19
  }.freeze
20
20
 
21
21
  module_function
@@ -31,7 +31,7 @@ module Datadog
31
31
  PEER_SERVICE_SOURCES = [TAG_INSTANCE,
32
32
  Tracing::Metadata::Ext::NET::TAG_DESTINATION_NAME,
33
33
  Tracing::Metadata::Ext::TAG_PEER_HOSTNAME,
34
- Tracing::Metadata::Ext::NET::TAG_TARGET_HOST,].freeze
34
+ Tracing::Metadata::Ext::NET::TAG_TARGET_HOST].freeze
35
35
  end
36
36
 
37
37
  module RPC
@@ -41,7 +41,7 @@ module Datadog
41
41
  PEER_SERVICE_SOURCES = [TAG_SERVICE,
42
42
  Tracing::Metadata::Ext::NET::TAG_DESTINATION_NAME,
43
43
  Tracing::Metadata::Ext::TAG_PEER_HOSTNAME,
44
- Tracing::Metadata::Ext::NET::TAG_TARGET_HOST,].freeze
44
+ Tracing::Metadata::Ext::NET::TAG_TARGET_HOST].freeze
45
45
  module GRPC
46
46
  TAG_STATUS_CODE = "rpc.grpc.status_code"
47
47
  TAG_FULL_METHOD = "rpc.grpc.full_method"
@@ -53,7 +53,7 @@ module Datadog
53
53
  TAG_DESTINATION = "messaging.destination"
54
54
  PEER_SERVICE_SOURCES = [Tracing::Metadata::Ext::NET::TAG_DESTINATION_NAME,
55
55
  Tracing::Metadata::Ext::TAG_PEER_HOSTNAME,
56
- Tracing::Metadata::Ext::NET::TAG_TARGET_HOST,].freeze
56
+ Tracing::Metadata::Ext::NET::TAG_TARGET_HOST].freeze
57
57
  end
58
58
 
59
59
  module Metadata
@@ -25,7 +25,7 @@ module Datadog
25
25
  type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,
26
26
  service: service_name, # Maintain client-side service name configuration
27
27
  resource: formatter.resource_name,
28
- on_error: on_error
28
+ on_error: on_error,
29
29
  }
30
30
 
31
31
  Tracing.trace(Ext::SPAN_CLIENT, **options) do |span, trace|
@@ -26,7 +26,7 @@ module Datadog
26
26
  type: Tracing::Metadata::Ext::HTTP::TYPE_INBOUND,
27
27
  service: service_name, # TODO: Remove server-side service name configuration
28
28
  resource: formatter.resource_name,
29
- on_error: on_error
29
+ on_error: on_error,
30
30
  }
31
31
  metadata = keywords[:call].metadata
32
32
 
@@ -35,7 +35,7 @@ module Datadog
35
35
  Tracing::Distributed::TraceContext.new(fetcher: Fetcher),
36
36
  Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_BAGGAGE =>
37
37
  Tracing::Distributed::Baggage.new(fetcher: Fetcher),
38
- Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_NONE => Tracing::Distributed::None.new
38
+ Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_NONE => Tracing::Distributed::None.new,
39
39
  },
40
40
  propagation_style_inject: propagation_style_inject,
41
41
  propagation_style_extract: propagation_style_extract,
@@ -25,7 +25,7 @@ module Datadog
25
25
  Events::ConsumerGroup::LeaveGroup,
26
26
  Events::ConsumerGroup::SyncGroup,
27
27
  Events::ProduceOperation::SendMessages,
28
- Events::Producer::DeliverMessages
28
+ Events::Producer::DeliverMessages,
29
29
  ].freeze
30
30
 
31
31
  module_function
@@ -34,7 +34,7 @@ module Datadog
34
34
  Tracing::Distributed::TraceContext.new(fetcher: Tracing::Distributed::Fetcher),
35
35
  Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_BAGGAGE =>
36
36
  Tracing::Distributed::Baggage.new(fetcher: Tracing::Distributed::Fetcher),
37
- Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_NONE => Tracing::Distributed::None.new
37
+ Tracing::Configuration::Ext::Distributed::PROPAGATION_STYLE_NONE => Tracing::Distributed::None.new,
38
38
  },
39
39
  propagation_style_inject: propagation_style_inject,
40
40
  propagation_style_extract: propagation_style_extract,
@@ -28,7 +28,7 @@ module Datadog
28
28
  {
29
29
  "operation" => command_name,
30
30
  "database" => database_name,
31
- "collection" => command.values.first
31
+ "collection" => command.values.first,
32
32
  },
33
33
  options
34
34
  )
@@ -18,7 +18,7 @@ module Datadog
18
18
  RELATIVE_RESOURCE_PATTERN = "relative"
19
19
  VALID_RESOURCE_PATTERNS = [
20
20
  ABSOLUTE_RESOURCE_PATTERN,
21
- RELATIVE_RESOURCE_PATTERN
21
+ RELATIVE_RESOURCE_PATTERN,
22
22
  ].freeze
23
23
  # Default should be changed to RELATIVE in 3.0 to match the Elasticsearch integration
24
24
  DEFAULT_RESOURCE_PATTERN = ABSOLUTE_RESOURCE_PATTERN
@@ -15,7 +15,7 @@ module Datadog
15
15
  DEFAULT_OPTIONS = {
16
16
  exclude: EXCLUDE_KEYS,
17
17
  show: SHOW_KEYS,
18
- placeholder: PLACEHOLDER
18
+ placeholder: PLACEHOLDER,
19
19
  }.freeze
20
20
 
21
21
  module_function
@@ -84,7 +84,7 @@ module Datadog
84
84
  available: self.class.available?,
85
85
  loaded: self.class.loaded?,
86
86
  compatible: self.class.compatible?,
87
- patchable: self.class.patchable?
87
+ patchable: self.class.patchable?,
88
88
  }
89
89
  end
90
90
 
@@ -57,7 +57,7 @@ module Datadog
57
57
  @patch_error_result = {
58
58
  type: e.class.name,
59
59
  message: e.message,
60
- line: Array(e.backtrace).first
60
+ line: Array(e.backtrace).first,
61
61
  }
62
62
 
63
63
  # Emit a metric
@@ -12,7 +12,7 @@ module Datadog
12
12
  trace_options = {
13
13
  service: configuration[:service_name],
14
14
  type: Tracing::Metadata::Ext::AppTypes::TYPE_WORKER,
15
- on_error: configuration[:on_error]
15
+ on_error: configuration[:on_error],
16
16
  }
17
17
 
18
18
  Tracing.trace(Ext::SPAN_JOB, **trace_options) do |request_span|
@@ -13,7 +13,7 @@ module Datadog
13
13
  ALL = [
14
14
  Events::Consume,
15
15
  Events::Batch,
16
- Events::Message
16
+ Events::Message,
17
17
  ].freeze
18
18
 
19
19
  module_function
@@ -15,7 +15,7 @@ module Datadog
15
15
  response: %w[
16
16
  Content-Type
17
17
  X-Request-ID
18
- ]
18
+ ],
19
19
  }.freeze
20
20
 
21
21
  option :enabled do |o|
@@ -10,7 +10,7 @@ module Datadog
10
10
  module HeaderTagging
11
11
  DATADOG_REQUEST_ATTRIBUTION_HEADERS = [
12
12
  "x-datadog-endpoint-scan",
13
- "x-datadog-security-test"
13
+ "x-datadog-security-test",
14
14
  ].freeze
15
15
 
16
16
  def self.tag_request_headers(span, env, configuration)