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

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

Overview

Datadog Profiler-specific configurations.

Defined Under Namespace

Classes: Advanced, Exporter, Upload

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#enabledBoolean

Enable profiling.

Returns:

  • (Boolean)

Defaults to:

  • DD_PROFILING_ENABLED environment variable, otherwise false



198
199
200
# File 'lib/datadog/core/configuration/settings.rb', line 198

def enabled
  @enabled
end

Instance Method Details

#advancedDatadog::Core::Configuration::Settings::DSL::Profiling::Advanced

Returns a configuration object.



209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/datadog/core/configuration/settings.rb', line 209

settings :advanced do
  # This should never be reduced, as it can cause the resulting profiles to become biased.
  # The current default should be enough for most services, allowing 16 threads to be sampled around 30 times
  # per second for a 60 second period.
  option :max_events, default: 32768

  # 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.
  option :max_frames do |o|
    o.default { env_to_int(Profiling::Ext::ENV_MAX_FRAMES, 400) }
    o.lazy
  end

  # @public_api
  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.default { env_to_bool(Profiling::Ext::ENV_ENDPOINT_COLLECTION_ENABLED, true) }
        o.lazy
      end
    end
  end

  # Disable gathering of names and versions of gems in use by the service, used to power grouping and
  # categorization of stack traces.
  option :code_provenance_enabled, default: true

  # 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.
  option :legacy_transport_enabled do |o|
    o.on_set do
      Datadog.logger.warn(
        'The profiling.advanced.legacy_transport_enabled setting has been deprecated for removal and no ' \
        'longer does anything. Please remove it from your Datadog.configure block.'
      )
    end
  end

  # Forces enabling the new profiler. We do not yet recommend turning on this option.
  #
  # Note that setting this to "false" (or not setting it) will not prevent the new profiler from
  # being automatically used in the future.
  # This option will be deprecated for removal once the new profiler gets enabled by default for all customers.
  option :force_enable_new_profiler do |o|
    o.default { env_to_bool('DD_PROFILING_FORCE_ENABLE_NEW', false) }
    o.lazy
  end

  # 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 toggle was added because, although this feature is safe and enabled by default 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.
  #
  # Furthermore, currently this feature can add a lot of overhead for GC-heavy workloads.
  #
  # We expect the once the above issues are overcome, we'll automatically enable the feature on fixed Ruby
  # versions.
  option :force_enable_gc_profiling do |o|
    o.default { env_to_bool('DD_PROFILING_FORCE_ENABLE_GC', false) }
    o.lazy
  end
end

#exporterDatadog::Core::Configuration::Settings::DSL::Profiling::Exporter

Returns a configuration object.



204
205
206
# File 'lib/datadog/core/configuration/settings.rb', line 204

settings :exporter do
  option :transport
end

#uploadDatadog::Core::Configuration::Settings::DSL::Profiling::Upload

Returns a configuration object.



287
288
289
290
291
292
293
# File 'lib/datadog/core/configuration/settings.rb', line 287

settings :upload do
  option :timeout_seconds do |o|
    o.setter { |value| value.nil? ? 30.0 : value.to_f }
    o.default { env_to_float(Profiling::Ext::ENV_UPLOAD_TIMEOUT, 30.0) }
    o.lazy
  end
end