Class: OpenTelemetry::DistributedContext::Entry::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/opentelemetry/distributed_context/entry.rb

Overview

Entry::Key is the name of the Entry. Entry::Key along with Entry::Value can be used to aggregate and group stats, annotate traces and logs, etc.

Restrictions

  • Must contain only printable ASCII (codes between 32 and 126 inclusive)

  • Must have length greater than zero and less than 256.

  • Must not be empty.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Key

Returns a new instance of Key.

Raises:

  • (ArgumentError)


23
24
25
26
27
# File 'lib/opentelemetry/distributed_context/entry.rb', line 23

def initialize(name)
  raise ArgumentError unless Internal.printable_ascii?(name) && (1..255).include?(name.length)

  @name = -name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



21
22
23
# File 'lib/opentelemetry/distributed_context/entry.rb', line 21

def name
  @name
end