Module: Datadog::Profiling
- Defined in:
- lib/datadog/profiling.rb,
lib/datadog/profiling/ext.rb,
lib/datadog/profiling/flush.rb,
lib/datadog/profiling/exporter.rb,
lib/datadog/profiling/profiler.rb,
lib/datadog/profiling/component.rb,
lib/datadog/profiling/scheduler.rb,
lib/datadog/profiling/tasks/exec.rb,
lib/datadog/profiling/tasks/help.rb,
lib/datadog/profiling/ext/forking.rb,
lib/datadog/profiling/tag_builder.rb,
lib/datadog/profiling/tasks/setup.rb,
lib/datadog/profiling/http_transport.rb,
lib/datadog/profiling/stack_recorder.rb,
lib/datadog/profiling/collectors/info.rb,
lib/datadog/profiling/collectors/stack.rb,
lib/datadog/profiling/native_extension.rb,
lib/datadog/profiling/collectors/thread_context.rb,
lib/datadog/profiling/collectors/code_provenance.rb,
lib/datadog/profiling/collectors/idle_sampling_helper.rb,
lib/datadog/profiling/collectors/dynamic_sampling_rate.rb,
lib/datadog/profiling/collectors/cpu_and_wall_time_worker.rb,
ext/datadog_profiling_native_extension/profiling.c,
ext/datadog_profiling_loader/datadog_profiling_loader.c,
ext/datadog_profiling_native_extension/native_extension_helpers.rb
Overview
Datadog Continuous Profiler implementation: docs.datadoghq.com/profiler/
Defined Under Namespace
Modules: Collectors, Component, Ext, Loader, NativeExtension, NativeExtensionHelpers, TagBuilder, Tasks Classes: Exporter, Flush, HttpTransport, Profiler, Scheduler, StackRecorder
Class Method Summary collapse
-
.allocation_count ⇒ Object
rubocop:disable Lint/NestedMethodDefinition (On purpose!).
- .enabled? ⇒ Boolean
-
.start_if_enabled ⇒ Boolean
Starts the profiler, if the profiler is supported by in this runtime environment and if the profiler has been enabled in configuration.
- .supported? ⇒ Boolean
- .unsupported_reason ⇒ Object
- .wait_until_running(timeout_seconds: 5) ⇒ Object
Class Method Details
.allocation_count ⇒ Object
rubocop:disable Lint/NestedMethodDefinition (On purpose!)
54 55 56 57 58 |
# File 'lib/datadog/profiling.rb', line 54 def self.allocation_count # This no-op implementation is used when profiling failed to load. # It gets replaced inside #replace_noop_allocation_count. nil end |
.enabled? ⇒ Boolean
60 61 62 63 64 |
# File 'lib/datadog/profiling.rb', line 60 def self.enabled? profiler = Datadog.send(:components).profiler # Use .send(...) to avoid exposing the attr_reader as an API to the outside !!(profiler.send(:scheduler).running? if profiler) end |
.start_if_enabled ⇒ Boolean
Starts the profiler, if the profiler is supported by in this runtime environment and if the profiler has been enabled in configuration.
25 26 27 28 29 30 31 32 33 |
# File 'lib/datadog/profiling.rb', line 25 def self.start_if_enabled # If the profiler was not previously touched, getting the profiler instance triggers start as a side-effect # otherwise we get nil profiler = Datadog.send(:components).profiler # ...but we still try to start it BECAUSE if the process forks, the profiler will exist but may # not yet have been started in the fork profiler.start if profiler !!profiler end |
.supported? ⇒ Boolean
8 9 10 |
# File 'lib/datadog/profiling.rb', line 8 def self.supported? unsupported_reason.nil? end |
.unsupported_reason ⇒ Object
12 13 14 15 16 17 |
# File 'lib/datadog/profiling.rb', line 12 def self.unsupported_reason # NOTE: Only the first matching reason is returned, so try to keep a nice order on reasons -- e.g. tell users # first that they can't use this on JRuby before telling them that something else failed native_library_compilation_skipped? || native_library_failed_to_load? end |
.wait_until_running(timeout_seconds: 5) ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/datadog/profiling.rb', line 66 def self.wait_until_running(timeout_seconds: 5) profiler = Datadog.send(:components).profiler if profiler # Use .send(...) to avoid exposing the attr_reader as an API to the outside worker = profiler.send(:worker) worker.wait_until_running(timeout_seconds: timeout_seconds) else raise 'Profiler not enabled or available' end end |