]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/jaeger-client-cpp/src/jaegertracing/Tag.cpp
2 * Copyright (c) 2017 Uber Technologies, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "jaegertracing/Tag.h"
18 #include "jaegertracing/thrift-gen/jaeger_types.h"
20 namespace jaegertracing
{
23 using result_type
= void;
25 explicit ThriftVisitor(thrift::Tag
& tag
)
30 void operator()(const std::string
& value
) const { setString(value
); }
32 void operator()(const char* value
) const { setString(value
); }
34 void operator()(double value
) const
36 _tag
.__set_vType(thrift::TagType::DOUBLE
);
37 _tag
.__set_vDouble(value
);
40 void operator()(bool value
) const
42 _tag
.__set_vType(thrift::TagType::BOOL
);
43 _tag
.__set_vBool(value
);
46 void operator()(int64_t value
) const { setLong(value
); }
48 void operator()(uint64_t value
) const { setLong(value
); }
50 template <typename Arg
>
51 void operator()(Arg
&& value
) const
57 void setString(opentracing::string_view value
) const
59 _tag
.__set_vType(thrift::TagType::STRING
);
60 _tag
.__set_vStr(value
);
63 void setLong(int64_t value
) const
65 _tag
.__set_vType(thrift::TagType::LONG
);
66 _tag
.__set_vLong(value
);
72 void Tag::thrift(thrift::Tag
& tag
) const
75 ThriftVisitor
visitor(tag
);
76 opentracing::util::apply_visitor(visitor
, _value
);
79 } // namespace jaegertracing