Class: Jaeger::ThriftTagBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/jaeger/thrift_tag_builder.rb

Constant Summary collapse

FIELDS =
Jaeger::Thrift::Tag::FIELDS
KEY =
FIELDS[Jaeger::Thrift::Tag::KEY].fetch(:name)
VTYPE =
FIELDS[Jaeger::Thrift::Tag::VTYPE].fetch(:name)
VLONG =
FIELDS[Jaeger::Thrift::Tag::VLONG].fetch(:name)
VDOUBLE =
FIELDS[Jaeger::Thrift::Tag::VDOUBLE].fetch(:name)
VBOOL =
FIELDS[Jaeger::Thrift::Tag::VBOOL].fetch(:name)
VSTR =
FIELDS[Jaeger::Thrift::Tag::VSTR].fetch(:name)

Class Method Summary collapse

Class Method Details

.build(key, value) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/jaeger/thrift_tag_builder.rb', line 13

def self.build(key, value)
  case value
  when Integer
    Jaeger::Thrift::Tag.new(
      KEY => key.to_s,
      VTYPE => Jaeger::Thrift::TagType::LONG,
      VLONG => value
    )
  when Float
    Jaeger::Thrift::Tag.new(
      KEY => key.to_s,
      VTYPE => Jaeger::Thrift::TagType::DOUBLE,
      VDOUBLE => value
    )
  when TrueClass, FalseClass
    Jaeger::Thrift::Tag.new(
      KEY => key.to_s,
      VTYPE => Jaeger::Thrift::TagType::BOOL,
      VBOOL => value
    )
  else
    Jaeger::Thrift::Tag.new(
      KEY => key.to_s,
      VTYPE => Jaeger::Thrift::TagType::STRING,
      VSTR => value.to_s
    )
  end
end