Module: Datadog::Profiling::Remote Private
- Defined in:
- lib/datadog/profiling/remote.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Applies profiling configuration delivered through Remote Configuration, following the APM_PROFILING schema: domains/remote-config/shared/libs/config-validator/schemas/APM_PROFILING/root.json in dd-source. Every omitted field keeps the local value.
Constant Summary collapse
- PRODUCTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
["APM_PROFILING"].freeze
- BOOLEAN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
->(value) { value == true || value == false }
- INTEGER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
->(value) { value.is_a?(Integer) }
- PROFILER_FIELDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Ruby has no separate CPU and wall time toggles, as the CpuAndWallTimeWorker always collects both, so they only count towards enablement. Other profilers in the schema (locks, exceptions) have no Ruby equivalent and are ignored.
{ "cpuTime" => BOOLEAN, "wallTime" => BOOLEAN, "heapObjects" => BOOLEAN, "heapSize" => BOOLEAN, "allocations" => BOOLEAN, }.freeze
- SETTING_FIELDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ "maxStackDepth" => INTEGER, "rubySignalWorkaround" => BOOLEAN, }.freeze
- START_TIMEOUT_SECONDS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
How long the remote-config worker thread waits for the profiler to start. It normally starts within milliseconds, and failing to start ends the wait right away.
1- OTHER_TAGS_LEVEL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Target specificity levels, from the least to the most specific: other tags, env, service, then the infrastructure tags the Datadog agent assigns, from deployments to containers.
1- ENV_LEVEL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
2- SERVICE_LEVEL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
3- LEVEL_BY_TAG_NAME =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 4 => [ "kube_deployment", "kube_replica_set", "kube_stateful_set", "kube_daemon_set", "kube_job", "kube_cronjob", "kube_argo_rollout", "oshift_deployment", "task_family", ], 5 => ["kube_container_name", "container_name", "ecs_container_name"], 6 => ["pod_name", "task_arn"], 7 => ["container_id"], }.flat_map { |level, names| names.map { |name| [name, level] } }.to_h.freeze
- CONDITIONS_PER_LEVEL =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
A target's level outranks any number of conditions, which only break ties within a level.
1000
Class Method Summary collapse
-
.apply_configs(repository, telemetry) ⇒ Object
private
The RC repository prunes deleted configs, so this recomputes the result from all of its current contents on each dispatch.
- .products ⇒ Object private
- .receivers(telemetry) ⇒ Object private
Class Method Details
.apply_configs(repository, telemetry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The RC repository prunes deleted configs, so this recomputes the result from all of its current contents on each dispatch.
Runs on the remote-config worker thread; never raises.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/datadog/profiling/remote.rb', line 76 def apply_configs(repository, telemetry) settings = Datadog.configuration # @type var parsed: Array[[Core::Remote::Configuration::Content, Array[String], config?]] parsed = Core::Utils::EnumerableCompat.filter_map(repository.contents) do |content| parse_content(content) if PRODUCTS.include?(content.path.product) end configs = Core::Utils::EnumerableCompat.filter_map(parsed) { |_content, _problems, config| config } profilers, remote_settings = merge(configs, settings) values = to_values(profilers, remote_settings, local_profilers(settings)) apply_values(settings, values, telemetry) error = profiler_error(settings) unless parsed.empty? # Only once applied: RC does not dispatch unchanged content again, so acknowledging it # earlier would hide a failure to apply it. parsed.each do |content, problems, _config| if error content.errored(error) else acknowledge(content, problems) end end nil rescue => e Datadog.logger.debug { "Profiling RC: failed to apply configs: #{e.class}: #{e.}" } telemetry&.report(e, description: "Failed to apply profiling remote configs") parsed&.each do |content, _problems, _config| content.errored("#{e.class}: #{e.}: #{Array(e.backtrace).join("\n")}") end nil end |
.products ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 |
# File 'lib/datadog/profiling/remote.rb', line 60 def products PRODUCTS end |
.receivers(telemetry) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
64 65 66 67 68 69 70 |
# File 'lib/datadog/profiling/remote.rb', line 64 def receivers(telemetry) matcher = Core::Remote::Dispatcher::Matcher::Product.new(products) receiver = Core::Remote::Dispatcher::Receiver.new(matcher, initial_reconcile: true) do |repository, _changes| apply_configs(repository, telemetry) end [receiver] end |