/proc/self/cwd/opencensus/trace/internal/span_context.cc
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright 2017, OpenCensus Authors |
2 | | // |
3 | | // Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | // you may not use this file except in compliance with the License. |
5 | | // You may obtain a copy of the License at |
6 | | // |
7 | | // http://www.apache.org/licenses/LICENSE-2.0 |
8 | | // |
9 | | // Unless required by applicable law or agreed to in writing, software |
10 | | // distributed under the License is distributed on an "AS IS" BASIS, |
11 | | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | // See the License for the specific language governing permissions and |
13 | | // limitations under the License. |
14 | | |
15 | | #include "opencensus/trace/span_context.h" |
16 | | |
17 | | #include "absl/strings/str_cat.h" |
18 | | |
19 | | namespace opencensus { |
20 | | namespace trace { |
21 | | |
22 | 0 | bool SpanContext::operator==(const SpanContext& that) const { |
23 | 0 | return trace_id_ == that.trace_id() && span_id_ == that.span_id(); |
24 | 0 | } |
25 | | |
26 | 0 | bool SpanContext::operator!=(const SpanContext& that) const { |
27 | 0 | return !(*this == that); |
28 | 0 | } |
29 | | |
30 | 1.56k | bool SpanContext::IsValid() const { |
31 | 1.56k | return trace_id_.IsValid() && span_id_.IsValid(); |
32 | 1.56k | } |
33 | | |
34 | 219 | std::string SpanContext::ToString() const { |
35 | 219 | return absl::StrCat(trace_id_.ToHex(), "-", span_id_.ToHex(), "-", |
36 | 219 | trace_options_.ToHex()); |
37 | 219 | } |
38 | | |
39 | | } // namespace trace |
40 | | } // namespace opencensus |