Class: Datadog::Profiling::Collectors::Info
- Inherits:
-
Object
- Object
- Datadog::Profiling::Collectors::Info
- Defined in:
- lib/datadog/profiling/collectors/info.rb
Overview
Collects information of relevance for profiler. This will get sent alongside the profile and show up in the UI or potentially influence processing in some way.
Most information is static: collected and frozen at construction time. The exception is
what collect_dynamic_info collects, which can change during the process lifetime.
Instance Method Summary collapse
-
#info ⇒ Object
: () -> ::Hash[::Symbol, ::Hash[::Symbol, untyped]].
-
#info_json ⇒ Object
Serializing the same info on every flush would be wasteful, so the latest result is cached and reused for as long as the dynamic info is unchanged.
-
#initialize(settings) ⇒ Info
constructor
: (untyped) -> void.
Constructor Details
#initialize(settings) ⇒ Info
: (untyped) -> void
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/datadog/profiling/collectors/info.rb', line 25 def initialize(settings) @profiler_info = nil @static_info = { platform: collect_platform_info, runtime: collect_runtime_info, application: collect_application_info(settings), profiler: collect_profiler_info(settings), }.freeze @info_json_cache = nil end |
Instance Method Details
#info ⇒ Object
: () -> ::Hash[::Symbol, ::Hash[::Symbol, untyped]]
38 39 40 |
# File 'lib/datadog/profiling/collectors/info.rb', line 38 def info build_info(collect_dynamic_info) end |
#info_json ⇒ Object
Serializing the same info on every flush would be wasteful, so the latest result is cached and reused for as long as the dynamic info is unchanged. : () -> ::String
45 46 47 48 49 50 51 52 53 |
# File 'lib/datadog/profiling/collectors/info.rb', line 45 def info_json dynamic_info = collect_dynamic_info cached_dynamic_info, cached_json = @info_json_cache return cached_json if cached_json && cached_dynamic_info == dynamic_info json = JSON.generate(build_info(dynamic_info)).freeze @info_json_cache = [dynamic_info, json].freeze #: [::Hash[::Symbol, bool], ::String] json end |