Module: Datadog::Profiling::TagBuilder Private

Includes:
Ext::Transport::HTTP
Defined in:
lib/datadog/profiling/tag_builder.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.

Builds a hash of default plus user tags to be included in a profile

Constant Summary collapse

ALLOWED_TAGS =

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.

When changing or adding profiling-related tags, make sure they are kept in sync with docs.google.com/spreadsheets/d/1LOGMf4c4Avbtn36uZ2SWvhIGKRPLM1BoWkUP4JYj7hA/ (Datadog internal link).

For consistency between the different profilers, every tag should be vetted before it gets reported with a profile, as otherwise it’s too easy to end up with different tags in different languages.

Set.new(
  [
    'env',
    'service',
    'version',
    'git.commit.sha',
    'git.repository_url',
    'host',
    'language',
    'runtime',
    'runtime_engine',
    'runtime_platform',
    'runtime_version',
    'runtime-id',
    'process_id',
    'profiler_version',
    'profile_seq',
  ]
).freeze

Constants included from Ext::Transport::HTTP

Ext::Transport::HTTP::CODE_PROVENANCE_FILENAME, Ext::Transport::HTTP::FORM_FIELD_TAG_PROFILER_VERSION

Class Method Summary collapse

Class Method Details

.call(settings:, profile_seq:, profiler_version: Core::Environment::Identity.gem_datadog_version) ⇒ 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.



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/datadog/profiling/tag_builder.rb', line 44

def self.call(
  settings:,
  profile_seq:,
  profiler_version: Core::Environment::Identity.gem_datadog_version
)
  hash = Core::TagBuilder.tags(settings).merge(
    FORM_FIELD_TAG_PROFILER_VERSION => profiler_version,
    'profile_seq' => profile_seq.to_s,
  )
  user_tag_keys = settings.tags.keys
  hash.keep_if { |tag| user_tag_keys.include?(tag) || ALLOWED_TAGS.include?(tag) }
  Core::Utils.encode_tags(hash)
end