]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/jaeger-client-cpp/src/jaegertracing/Reference.cpp
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / jaeger-client-cpp / src / jaegertracing / Reference.cpp
1 /*
2 * Copyright (c) 2017 Uber Technologies, Inc.
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17 #include "jaegertracing/Reference.h"
18 #include "jaegertracing/thrift-gen/jaeger_types.h"
19
20 namespace jaegertracing {
21 void Reference::thrift(thrift::SpanRef& spanRef) const
22 {
23 switch (_type) {
24 case Type::ChildOfRef: {
25 spanRef.__set_refType(thrift::SpanRefType::CHILD_OF);
26 } break;
27 case Type::FollowsFromRef: {
28 spanRef.__set_refType(thrift::SpanRefType::FOLLOWS_FROM);
29 } break;
30 default: {
31 std::ostringstream oss;
32 oss << "Invalid span reference type " << static_cast<int>(_type)
33 << ", context " << _spanContext;
34 throw std::invalid_argument(oss.str());
35 } break;
36 }
37 spanRef.__set_traceIdHigh(_spanContext.traceID().high());
38 spanRef.__set_traceIdLow(_spanContext.traceID().low());
39 spanRef.__set_spanId(_spanContext.spanID());
40 }
41 } // namespace jaegertracing