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
|
# File 'lib/jaeger/thrift_tag_builder.rb', line 13
def self.build(key, value)
if value.is_a?(Integer)
Jaeger::Thrift::Tag.new(
KEY => key.to_s,
VTYPE => Jaeger::Thrift::TagType::LONG,
VLONG => value
)
elsif value.is_a?(Float)
Jaeger::Thrift::Tag.new(
KEY => key.to_s,
VTYPE => Jaeger::Thrift::TagType::DOUBLE,
VDOUBLE => value
)
elsif value.is_a?(TrueClass) || value.is_a?(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
|