Class: Datadog::Core::Configuration::Settings::DSL::Profiling::Advanced

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog/core/configuration/settings.rb

Defined Under Namespace

Classes: Endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allocation_counting_enabledObject

Can be used to enable/disable the Datadog::Profiling.allocation_count feature.

This feature is safe and enabled by default on Ruby 2.x, but has a few caveats on Ruby 3.x.

Caveat 1 (severe): On Ruby versions 3.0 (all), 3.1.0 to 3.1.3, and 3.2.0 to 3.2.2 this is disabled by default because it can trigger a VM bug that causes a segmentation fault during garbage collection of Ractors (https://bugs.ruby-lang.org/issues/18464). We don't recommend using this feature on such Rubies. This bug is fixed on Ruby versions 3.1.4, 3.2.3 and 3.3.0.

Caveat 2 (annoyance): On all known versions of Ruby 3.x, due to https://bugs.ruby-lang.org/issues/19112, when a ractor gets garbage collected, Ruby will disable all active tracepoints, which this feature internally relies on. Thus this feature is only usable if you're not using Ractors.

Defaults to:

  • true on Ruby 2.x and 3.1.4+, 3.2.3+ and 3.3.0+; false for Ruby 3.0 and unpatched Rubies.



331
332
333
# File 'lib/datadog/core/configuration/settings.rb', line 331

def allocation_counting_enabled
  @allocation_counting_enabled
end

#code_provenance_enabledObject

Can be used to disable the gathering of names and versions of gems in use by the service, used to power grouping and categorization of stack traces.



251
252
253
# File 'lib/datadog/core/configuration/settings.rb', line 251

def code_provenance_enabled
  @code_provenance_enabled
end

#experimental_timeline_enabledObject

Enables data collection for the timeline feature. This is still experimental and not recommended yet.

Defaults to:

  • DD_PROFILING_EXPERIMENTAL_TIMELINE_ENABLED environment variable as a boolean, otherwise false



354
355
356
# File 'lib/datadog/core/configuration/settings.rb', line 354

def experimental_timeline_enabled
  @experimental_timeline_enabled
end

#force_enable_gc_profilingObject

Forces enabling of profiling of time/resources spent in Garbage Collection.

Note that setting this to "false" (or not setting it) will not prevent the feature from being being automatically enabled in the future.

This feature defaults to off for two reasons:

  1. Currently this feature can add a lot of overhead for GC-heavy workloads.
  2. Although this feature is safe on Ruby 2.x, on Ruby 3.x it can break in applications that make use of Ractors due to two Ruby VM bugs: https://bugs.ruby-lang.org/issues/19112 AND https://bugs.ruby-lang.org/issues/18464. If you use Ruby 3.x and your application does not use Ractors (or if your Ruby has been patched), the feature is fully safe to enable and this toggle can be used to do so.

We expect the once the above issues are overcome, we'll automatically enable the feature on fixed Ruby versions.

Defaults to:

  • DD_PROFILING_FORCE_ENABLE_GC environment variable, otherwise false



309
310
311
# File 'lib/datadog/core/configuration/settings.rb', line 309

def force_enable_gc_profiling
  @force_enable_gc_profiling
end

#force_enable_legacy_profilerObject

Deprecated.

No longer does anything, and will be removed on dd-trace-rb 2.0.

This was used prior to the GA of the new CPU Profiling 2.0 profiler. Using CPU Profiling 2.0 is now the default and this doesn't do anything.



283
284
285
# File 'lib/datadog/core/configuration/settings.rb', line 283

def force_enable_legacy_profiler
  @force_enable_legacy_profiler
end

#force_enable_new_profilerObject

Deprecated.

No longer does anything, and will be removed on dd-trace-rb 2.0.

This was used prior to the GA of the new CPU Profiling 2.0 profiler. Using CPU Profiling 2.0 is now the default and this doesn't do anything.



270
271
272
# File 'lib/datadog/core/configuration/settings.rb', line 270

def force_enable_new_profiler
  @force_enable_new_profiler
end

#legacy_transport_enabledObject

Deprecated.

No longer does anything, and will be removed on dd-trace-rb 2.0.

This was added as a temporary support option in case of issues with the new Profiling::HttpTransport class but we're now confident it's working nicely so we've removed the old code path.



257
258
259
# File 'lib/datadog/core/configuration/settings.rb', line 257

def legacy_transport_enabled
  @legacy_transport_enabled
end

#max_eventsObject

Deprecated.

No longer does anything, and will be removed on dd-trace-rb 2.0.

This was used prior to the GA of the new CPU Profiling 2.0 profiler. The CPU Profiling 2.0 profiler does not use or need this setting and thus it doesn't do anything.



214
215
216
# File 'lib/datadog/core/configuration/settings.rb', line 214

def max_events
  @max_events
end

#max_framesObject

Controls the maximum number of frames for each thread sampled. Can be tuned to avoid omitted frames in the produced profiles. Increasing this may increase the overhead of profiling.

Defaults to:

  • DD_PROFILING_MAX_FRAMES environment variable, otherwise 400



227
228
229
# File 'lib/datadog/core/configuration/settings.rb', line 227

def max_frames
  @max_frames
end

#no_signals_workaround_enabledObject

The profiler gathers data by sending SIGPROF unix signals to Ruby application threads.

Sending SIGPROF is a common profiling approach, and may cause system calls from native extensions/libraries to be interrupted with a system EINTR error code. Rarely, native extensions or libraries called by them may have missing or incorrect error handling for the EINTR error code.

The "no signals" workaround, when enabled, enables an alternative mode for the profiler where it does not send SIGPROF unix signals. The downside of this approach is that the profiler data will have lower quality.

This workaround is automatically enabled when gems that are known to have issues handling EINTR error codes are detected. If you suspect you may be seeing an issue due to the profiler's use of signals, you can try manually enabling this mode as a fallback. Please also report these issues to us on https://github.com/DataDog/dd-trace-rb/issues/new, so we can work with the gem authors to fix them!

Defaults to:

  • DD_PROFILING_NO_SIGNALS_WORKAROUND_ENABLED environment variable as a boolean, otherwise :auto



379
380
381
# File 'lib/datadog/core/configuration/settings.rb', line 379

def no_signals_workaround_enabled
  @no_signals_workaround_enabled
end

#skip_mysql2_checkObject

Can be used to disable checking which version of libmysqlclient is being used by the mysql2 gem.

This setting is only used when the mysql2 gem is installed.

Defaults to:

  • DD_PROFILING_SKIP_MYSQL2_CHECK environment variable, otherwise false



345
346
347
# File 'lib/datadog/core/configuration/settings.rb', line 345

def skip_mysql2_check
  @skip_mysql2_check
end

Instance Method Details

#endpointDatadog::Core::Configuration::Settings::DSL::Profiling::Advanced::Endpoint

Returns a configuration object.



234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/datadog/core/configuration/settings.rb', line 234

settings :endpoint do
  settings :collection do
    # When using profiling together with tracing, this controls if endpoint names
    # are gathered and reported together with profiles.
    #
    # @default `DD_PROFILING_ENDPOINT_COLLECTION_ENABLED` environment variable, otherwise `true`
    # @return [Boolean]
    option :enabled do |o|
      o.env Profiling::Ext::ENV_ENDPOINT_COLLECTION_ENABLED
      o.default true
      o.type :bool
    end
  end
end