Module: Datadog::Core::Utils

Extended by:
Forking
Defined in:
lib/datadog/core/utils.rb,
lib/datadog/core/utils/time.rb,
lib/datadog/core/utils/forking.rb,
lib/datadog/core/utils/network.rb,
lib/datadog/core/utils/safe_dup.rb,
lib/datadog/core/utils/sequence.rb,
lib/datadog/core/utils/only_once.rb,
lib/datadog/core/utils/object_set.rb,
lib/datadog/core/utils/compression.rb,
lib/datadog/core/utils/string_table.rb

Overview

Utils contains low-level utilities, typically to provide pseudo-random trace IDs.

Defined Under Namespace

Modules: Compression, Forking, Network, SafeDup, Time Classes: ObjectSet, OnlyOnce, Sequence, StringTable

Constant Summary collapse

EMPTY_STRING =
''.encode(::Encoding::UTF_8).freeze

Class Method Summary collapse

Methods included from Forking

after_fork!, extended, fork_pid, forked?, included, update_fork_pid!

Class Method Details

.extract_host_port(host_port) ⇒ String, ...

Extracts hostname and port from a string that contains both, separated by ‘:’.

Returns:

  • hostname and port

  • if format did not match



84
85
86
87
88
89
# File 'lib/datadog/core/utils.rb', line 84

def self.extract_host_port(host_port)
  match = /^([^:]+):(\d+)$/.match(host_port)
  return unless match

  [match[1], match[2].to_i]
end