Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Http Trace Context #143

Merged
merged 944 commits into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
944 commits
Select commit Hold shift + click to select a range
d0e637d
tracer workaround
Tianlin-Zhao Jul 30, 2020
555e05c
tracer workaround
Tianlin-Zhao Jul 30, 2020
8245e6a
tracer workaround
Tianlin-Zhao Jul 30, 2020
0442a52
tracer workaround
Tianlin-Zhao Jul 30, 2020
29e89de
tracer workaround
Tianlin-Zhao Jul 30, 2020
fb29a2b
tracer workaround
Tianlin-Zhao Jul 30, 2020
6cff40e
tracer workaround
Tianlin-Zhao Jul 30, 2020
f614fb9
tracer workaround
Tianlin-Zhao Jul 30, 2020
838c94e
Merge branch 'origin/propagation' into origin/propagators
Tianlin-Zhao Jul 30, 2020
b09a788
Merge pull request #9 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Jul 30, 2020
2e2f9df
tracer workaround
Tianlin-Zhao Jul 30, 2020
4476a31
Merge remote-tracking branch 'origin/origin/propagators' into origin/…
Tianlin-Zhao Jul 30, 2020
c88cc14
tracer workaround
Tianlin-Zhao Jul 30, 2020
2f081d8
Merge pull request #10 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Jul 30, 2020
dd2d515
tracer workaround
Tianlin-Zhao Jul 30, 2020
a4e1cbd
tracer workaround
Tianlin-Zhao Jul 30, 2020
974d1bd
tracer workaround
Tianlin-Zhao Jul 30, 2020
c1314cb
tracer workaround
Tianlin-Zhao Jul 30, 2020
c5f1f2d
tracer workaround
Tianlin-Zhao Jul 30, 2020
77abce8
tracer workaround
Tianlin-Zhao Jul 30, 2020
d3a1931
tracer workaround
Tianlin-Zhao Jul 30, 2020
ed44b0a
tracer workaround
Tianlin-Zhao Jul 30, 2020
1462b48
tracer workaround
Tianlin-Zhao Jul 30, 2020
5d13af0
tracer workaround
Tianlin-Zhao Jul 30, 2020
49200ac
tracer workaround
Tianlin-Zhao Jul 30, 2020
d2c3ebf
tracer workaround
Tianlin-Zhao Jul 30, 2020
aacecd5
tracer workaround
Tianlin-Zhao Jul 30, 2020
bf134b8
tracer workaround
Tianlin-Zhao Jul 30, 2020
3647d6a
tracer workaround
Tianlin-Zhao Jul 30, 2020
956055b
tracer workaround
Tianlin-Zhao Jul 30, 2020
374d7c4
tracer workaround
Tianlin-Zhao Jul 30, 2020
2873ef0
tracer workaround
Tianlin-Zhao Jul 30, 2020
692967b
tracer workaround
Tianlin-Zhao Jul 30, 2020
b8df0b1
tracer
Tianlin-Zhao Jul 30, 2020
26da008
tracer
Tianlin-Zhao Jul 30, 2020
98ca4e0
tracer
Tianlin-Zhao Jul 30, 2020
6826a41
tracer
Tianlin-Zhao Jul 30, 2020
1f47c39
tracer
Tianlin-Zhao Jul 30, 2020
2ded3e1
tracer
Tianlin-Zhao Jul 30, 2020
fc1ef96
tracer
Tianlin-Zhao Jul 30, 2020
94831ab
tracer
Tianlin-Zhao Jul 30, 2020
23d78d1
tracer
Tianlin-Zhao Jul 30, 2020
24ab44b
tracer
Tianlin-Zhao Jul 30, 2020
b64427e
tracer
Tianlin-Zhao Jul 30, 2020
78c4158
tracer
Tianlin-Zhao Jul 30, 2020
77ca5ca
tracer
Tianlin-Zhao Jul 30, 2020
3f0173c
tracer
Tianlin-Zhao Jul 30, 2020
f0db27e
tracer
Tianlin-Zhao Jul 30, 2020
a58b4ee
tracer
Tianlin-Zhao Jul 30, 2020
76d6f29
tracer
Tianlin-Zhao Jul 30, 2020
93e0e66
tracer
Tianlin-Zhao Jul 30, 2020
7a2d5f2
tracer
Tianlin-Zhao Jul 30, 2020
69fc0d6
tracer
Tianlin-Zhao Jul 30, 2020
818865f
tracer
Tianlin-Zhao Jul 30, 2020
6dccadf
tracer
Tianlin-Zhao Jul 30, 2020
8b84e55
tracer
Tianlin-Zhao Jul 30, 2020
3290a17
tracer
Tianlin-Zhao Jul 30, 2020
0eb2e77
tracer
Tianlin-Zhao Jul 30, 2020
1f0b6e1
tracer
Tianlin-Zhao Jul 30, 2020
e0c8d5f
tracer
Tianlin-Zhao Jul 30, 2020
e602890
tracer
Tianlin-Zhao Jul 30, 2020
1a5d792
tracer
Tianlin-Zhao Jul 31, 2020
c2952e8
tracer
Tianlin-Zhao Jul 31, 2020
1f0d5e7
tracer
Tianlin-Zhao Jul 31, 2020
acdf179
tracer
Tianlin-Zhao Jul 31, 2020
a6c150b
tracer
Tianlin-Zhao Jul 31, 2020
19a4cd5
tracer
Tianlin-Zhao Jul 31, 2020
28e4d0a
Merge pull request #12 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Aug 1, 2020
d22b43e
tracer
Tianlin-Zhao Aug 1, 2020
5429141
Merge pull request #13 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Aug 1, 2020
8c3d6fd
tracer
Tianlin-Zhao Aug 1, 2020
81a0640
Merge pull request #14 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Aug 1, 2020
513b0e0
tracer
Tianlin-Zhao Aug 1, 2020
f388ac1
Merge pull request #15 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Aug 1, 2020
94834dd
tracer
Tianlin-Zhao Aug 1, 2020
5026789
Merge pull request #16 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Aug 1, 2020
fe62212
tracer
Tianlin-Zhao Aug 1, 2020
92f0e0f
Merge pull request #17 from Tianlin-Zhao/origin/propagators
Tianlin-Zhao Aug 1, 2020
6d90293
tracer
Tianlin-Zhao Aug 1, 2020
25e549d
tracer
Tianlin-Zhao Aug 1, 2020
5a71b43
tracer
Tianlin-Zhao Aug 1, 2020
01d8cec
tracer
Tianlin-Zhao Aug 1, 2020
427030a
tracer
Tianlin-Zhao Aug 1, 2020
d8bbd52
tracer
Tianlin-Zhao Aug 1, 2020
7580adb
tracer
Tianlin-Zhao Aug 1, 2020
544855b
tracer
Tianlin-Zhao Aug 1, 2020
349fbb9
tracer
Tianlin-Zhao Aug 1, 2020
4104e91
tracer
Tianlin-Zhao Aug 1, 2020
bbdfed1
tracer
Tianlin-Zhao Aug 1, 2020
d67c502
tracer
Tianlin-Zhao Aug 1, 2020
cf25139
tracer
Tianlin-Zhao Aug 1, 2020
10463c0
comply to noexcept requirements
Tianlin-Zhao Aug 1, 2020
c0ac15e
comply to noexcept requirements
Tianlin-Zhao Aug 1, 2020
36b3241
comply to noexcept requirements
Tianlin-Zhao Aug 1, 2020
6b6b533
comply to noexcept requirements
Tianlin-Zhao Aug 1, 2020
c706b4c
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
053d92e
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
458d4aa
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
20f747b
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
5e2ee69
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
bc3fb98
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
38a94a5
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
fa070d4
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
0e0d344
comply to noexcept requirements
Tianlin-Zhao Aug 2, 2020
e0c63d3
new span context constructor
Tianlin-Zhao Aug 2, 2020
886d893
format
Tianlin-Zhao Aug 4, 2020
bcfb751
format, txt manuel adjustment due to the failure of importing of cmak…
Tianlin-Zhao Aug 4, 2020
d2fc434
format, txt manuel adjustment due to the failure of importing of cmak…
Tianlin-Zhao Aug 4, 2020
3ebe9e6
format, txt manuel adjustment due to the failure of importing of cmak…
Tianlin-Zhao Aug 4, 2020
6d0cd8b
Merge branch 'master' of https://github.com/Tianlin-Zhao/opentelemetr…
Tianlin-Zhao Aug 4, 2020
20259a9
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
Tianlin-Zhao Aug 5, 2020
11efe1f
Merge remote-tracking branch 'upstream/master' into origin/propagation
Tianlin-Zhao Aug 5, 2020
c1adf5a
updated the trace state reference in http trace context to keep with …
Tianlin-Zhao Aug 5, 2020
a19cd59
updated the trace state reference in http trace context to keep with …
Tianlin-Zhao Aug 5, 2020
d392f64
changed opentelemetry namespace in trace_state.h
Tianlin-Zhao Aug 5, 2020
d774328
span_context.h fix of function get invalid
Tianlin-Zhao Aug 5, 2020
99be4b7
span context added back empty constructor
Tianlin-Zhao Aug 5, 2020
87ae915
span context added back empty constructor
Tianlin-Zhao Aug 5, 2020
a78b5d1
span context added back empty constructor
Tianlin-Zhao Aug 5, 2020
17d8c3e
span context added back empty constructor
Tianlin-Zhao Aug 5, 2020
9168e67
span context added back empty constructor
Tianlin-Zhao Aug 10, 2020
e4d6474
Merge pull request #18 from Tianlin-Zhao/origin/w3ctest
Tianlin-Zhao Aug 10, 2020
47b6a6f
commenting out trace state in span context
Tianlin-Zhao Aug 10, 2020
c78c8cb
Merge pull request #19 from Tianlin-Zhao/origin/w3ctest
Tianlin-Zhao Aug 10, 2020
edd9188
commenting out trace state in span context
Tianlin-Zhao Aug 10, 2020
9e4e820
Merge pull request #20 from Tianlin-Zhao/origin/w3ctest
Tianlin-Zhao Aug 10, 2020
6d4a23f
commenting out trace state in span context
Tianlin-Zhao Aug 10, 2020
d95f29e
Merge pull request #21 from Tianlin-Zhao/origin/w3ctest
Tianlin-Zhao Aug 10, 2020
7a9e9ba
format
Tianlin-Zhao Aug 11, 2020
fa90b35
Merge pull request #22 from Tianlin-Zhao/origin/w3ctest
Tianlin-Zhao Aug 11, 2020
c1fb682
Merge branch 'master' into origin/propagation
Tianlin-Zhao Aug 12, 2020
5fe65b6
change in tokens
Tianlin-Zhao Aug 12, 2020
5701303
change in tokens
Tianlin-Zhao Aug 12, 2020
c42cd38
format
Tianlin-Zhao Aug 12, 2020
07c5930
format
Tianlin-Zhao Aug 12, 2020
b182a5f
Update api/include/opentelemetry/propagators/composite_http_propagator.h
Tianlin-Zhao Aug 13, 2020
3887dc7
Update api/include/opentelemetry/trace/propagation/http_text_format.h
Tianlin-Zhao Aug 13, 2020
1d47802
format
Tianlin-Zhao Aug 13, 2020
0d53d33
format
Tianlin-Zhao Aug 13, 2020
2de9266
format
Tianlin-Zhao Aug 13, 2020
cd47c3a
format
Tianlin-Zhao Aug 13, 2020
e7ebefa
resolving issues
Tianlin-Zhao Aug 13, 2020
820dd14
resolving issues
Tianlin-Zhao Aug 13, 2020
7dc1203
resolving issues
Tianlin-Zhao Aug 13, 2020
3f73d5d
resolving issues
Tianlin-Zhao Aug 13, 2020
3fa337a
resolving issues
Tianlin-Zhao Aug 13, 2020
f31f9fa
resolving issues
Tianlin-Zhao Aug 13, 2020
93a9389
resolving issues
Tianlin-Zhao Aug 13, 2020
5bf0693
new PR: removed all TraceState references
Tianlin-Zhao Aug 13, 2020
544c0ee
removed all TraceState references
Tianlin-Zhao Aug 13, 2020
2064606
Merge pull request #23 from Tianlin-Zhao/noTraceState
Tianlin-Zhao Aug 13, 2020
69b688c
Merge pull request #24 from Tianlin-Zhao/noTraceState
Tianlin-Zhao Aug 14, 2020
aee8cfd
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
Tianlin-Zhao Aug 14, 2020
5e054ee
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
Tianlin-Zhao Aug 18, 2020
d066f4e
Merge branch 'origin/propagation' of https://github.com/Tianlin-Zhao/…
Tianlin-Zhao Aug 18, 2020
c0e74ff
format, todo clean ups
Tianlin-Zhao Aug 19, 2020
466d4f3
format, todo clean ups
Tianlin-Zhao Aug 19, 2020
c5164c9
removed tracer from all span classes
Tianlin-Zhao Aug 19, 2020
2cd73ce
removed noop test because all it does is testing the noop tracer whic…
Tianlin-Zhao Aug 19, 2020
bd41f80
removed noop test because all it does is testing the noop tracer whic…
Tianlin-Zhao Aug 19, 2020
051089d
Added new field to span.h of spancontext
Tianlin-Zhao Aug 19, 2020
249c32c
Added new field to span.h of spancontext
Tianlin-Zhao Aug 19, 2020
b6002fc
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
Tianlin-Zhao Aug 19, 2020
3e89067
manual format of cmake
Tianlin-Zhao Aug 19, 2020
19ca833
cmake
Tianlin-Zhao Aug 20, 2020
5d6a288
format, added test case for default span on GetContext
Tianlin-Zhao Aug 20, 2020
1a90fec
format, added test case for default span on GetContext
Tianlin-Zhao Aug 20, 2020
8aa9b7f
format, added test case for default span on GetContext
Tianlin-Zhao Aug 20, 2020
1c89300
format, added test case for default span on GetContext
Tianlin-Zhao Aug 20, 2020
f928930
format, added test case for default span on GetContext
Tianlin-Zhao Aug 20, 2020
2e813fb
removed pointer addition, replaced with loop variable
Tianlin-Zhao Aug 20, 2020
017e470
removed pointer addition, replaced with loop variable
Tianlin-Zhao Aug 20, 2020
9bb3984
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
3eb1d6a
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
a0e2f23
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
51a380a
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
d5edbec
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
8ac9486
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
af1b484
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
eddb689
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
fabc345
resolving Null issue of span
Tianlin-Zhao Aug 20, 2020
0a8021a
resolved aditya's questions
Tianlin-Zhao Aug 20, 2020
31220c6
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
190a7fa
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
fd8dd98
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
185e8a3
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
432ab0d
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
d0724ae
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
0b1a90f
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
f0c1c9d
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
8e6c3a1
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
eb8c38f
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
dd7f65d
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
bae2047
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
e8eeb9d
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
d86fbd3
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
4ff679b
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
3f03636
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
42c1ace
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
5f23ebe
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
09bd626
resolved aditya's questions
Tianlin-Zhao Aug 21, 2020
c7aa9ae
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
186f47f
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
987b90c
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
e063cb7
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
f423173
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
2925d5a
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
5eaa32d
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
ba2bfaa
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
Tianlin-Zhao Aug 21, 2020
1dfc9d7
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
6acc97f
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
b04a00f
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
c367480
added noop test to cover more lines of code -- for code coverage
Tianlin-Zhao Aug 21, 2020
e98bb2a
Revert "dependency"
Tianlin-Zhao Aug 21, 2020
127c6f1
Merge branch 'origin/propagation' of https://github.com/Tianlin-Zhao/…
Tianlin-Zhao Aug 21, 2020
7df20dd
revert to ba2bfaa
Tianlin-Zhao Aug 21, 2020
c6690b0
test revert
Tianlin-Zhao Aug 21, 2020
5b66308
Merge pull request #28 from ZhaoTianlin990121/test_revert
ZhaoTianlin990121 Aug 21, 2020
1144903
Update .gitignore
ZhaoTianlin990121 Aug 24, 2020
1ff6c52
Merge branch 'master' of https://github.com/open-telemetry/openteleme…
Tianlin-Zhao Aug 24, 2020
fb0ac53
test revert
Tianlin-Zhao Aug 24, 2020
43722fd
resolving conflicts
Tianlin-Zhao Aug 25, 2020
a5166a9
resolving conflicts
Tianlin-Zhao Aug 25, 2020
8f82a70
resolving conflicts
Tianlin-Zhao Aug 25, 2020
8f0d0c4
resolving conflicts
Tianlin-Zhao Aug 25, 2020
0d83afa
resolving conflicts
Tianlin-Zhao Aug 25, 2020
43ec98e
Merge branch 'master' into origin/propagation
reyang Aug 25, 2020
9576052
resolving conflicts
Tianlin-Zhao Aug 25, 2020
0947b16
Merge remote-tracking branch 'origin/origin/propagation' into origin/…
Tianlin-Zhao Aug 25, 2020
7f560ed
resolving conflicts
Tianlin-Zhao Aug 25, 2020
298cf43
resolving conflicts
Tianlin-Zhao Aug 25, 2020
e27a159
resolving conflicts
Tianlin-Zhao Aug 25, 2020
2a0e5b3
resolving conflicts
Tianlin-Zhao Aug 25, 2020
5b5b930
resolving conflicts
Tianlin-Zhao Aug 25, 2020
431ee66
resolving conflicts
Tianlin-Zhao Aug 25, 2020
e78ad86
resolving conflicts
Tianlin-Zhao Aug 25, 2020
16c340a
resolving conflicts
Tianlin-Zhao Aug 25, 2020
7c6cba8
resolving conflicts
Tianlin-Zhao Aug 25, 2020
5a0a40f
resolving conflicts
Tianlin-Zhao Aug 25, 2020
d6fe242
resolving conflicts
Tianlin-Zhao Aug 25, 2020
24e490d
resolving conflicts
Tianlin-Zhao Aug 25, 2020
b090657
resolving conflicts
Tianlin-Zhao Aug 25, 2020
e75105e
resolving conflicts
Tianlin-Zhao Aug 25, 2020
3fb3182
resolving conflicts
Tianlin-Zhao Aug 25, 2020
ae9485c
resolving conflicts
Tianlin-Zhao Aug 25, 2020
3da1f13
resolving conflicts
Tianlin-Zhao Aug 25, 2020
d5f869e
resolving conflicts
Tianlin-Zhao Aug 25, 2020
4b9605e
resolving conflicts
Tianlin-Zhao Aug 25, 2020
b7d0eb4
Minor change to EOF
Tianlin-Zhao Aug 25, 2020
9a27369
Merge branch 'master' into origin/propagation
reyang Aug 26, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions api/include/opentelemetry/context/context_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
#include "opentelemetry/nostd/unique_ptr.h"
#include "opentelemetry/nostd/variant.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/trace/span.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace context
{
using ContextValue =
nostd::variant<bool, int64_t, uint64_t, double, nostd::shared_ptr<trace::SpanContext>>;
nostd::variant<bool, int64_t, uint64_t, double, nostd::shared_ptr<trace::SpanContext>, nostd::shared_ptr<trace::Span>>;
} // namespace context
OPENTELEMETRY_END_NAMESPACE
OPENTELEMETRY_END_NAMESPACE
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
65 changes: 65 additions & 0 deletions api/include/opentelemetry/propagators/composite_http_propagator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2020, OpenTelemetry Authors
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include "opentelemetry/context/context.h"
#include "opentelemetry/trace/propagation/httptextformat.h"
#include "opentelemetry/nostd/span.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace propagators
{
// CompositeHTTPPropagator provides a mechanism for combining multiple
// propagators into a single one.
template <typename T>
class CompositeHTTPPropagator(trace::propagation::HTTPTextFormat<T>) {
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
public:
// Rules that manages how context will be extracted from carrier.
using Getter = nostd::string_view(*)(const T &carrier, nostd::string_view trace_type);

// Rules that manages how context will be injected to carrier.
using Setter = void(*)(T &carrier, nostd::string_view trace_type,nostd::string_view trace_description);

// Initializes a Composite Http Propagator with given propagators
CompositeHTTPPropagator(nostd::span<trace::propagation::HTTPTextFormat> &propagators) {
this.propagators_ = propagators;
}

// Run each of the configured propagators with the given context and carrier.
// Propagators are run in the order they are configured, if multiple
// propagators write the same context key, the propagator later in the list
// will override previous propagators.
// See opentelemetry.trace.propagation.httptextformat.HTTPTextFormat.extract
Extract(Getter get_from_carrier, const T &carrier, Context &context) {
for (nostd::span<trace::propagation::HTTPTextFormat>::iterator it = propagators_.begin(); it != propagators_.end(); it++) {
context = it->Extract(get_from_carrier, carrier, context);
}
return context;
}

// Run each of the configured propagators with the given context and carrier.
// Propagators are run in the order they are configured, if multiple
// propagators write the same carrier key, the propagator later in the list
// will override previous propagators.
// See `opentelemetry.trace.propagation.httptextformat.HTTPTextFormat.inject`
Inject(Setter set_from_carrier, T &carrier, const Context &context) {
for (nostd::span<trace::propagation::HTTPTextFormat>::iterator it = propagators_.begin(); it != propagators_.end(); it++) {
it->Inject(get_from_carrier, carrier, context);
}
}
private:
nostd::span<trace::propagation::HTTPTextFormat> propagators_;
}
}
84 changes: 84 additions & 0 deletions api/include/opentelemetry/trace/default_span.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#pragma once
#include "opentelemetry/trace/span.h"
#include "opentelemetry/trace/span_context.h"
#include "opentelemetry/trace/canonical_code.h"
#include "opentelemetry/common/attribute_value.h"
#include "opentelemetry/trace/span.h"
//#include "opentelemetry/trace/tracer.h"

#define pass
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
OPENTELEMETRY_BEGIN_NAMESPACE
namespace trace {
class DefaultSpan: public Span {
public:
// Returns an invalid span.
static DefaultSpan GetInvalid() {
return DefaultSpan(SpanContext::GetInvalid());
}

trace::SpanContext GetContext() const noexcept {
return span_context_;
}

bool IsRecording() const noexcept {
return false;
}

void SetAttribute(nostd::string_view key, const common::AttributeValue &value) noexcept {
pass;
}

void AddEvent(nostd::string_view name) noexcept { pass; }

void AddEvent(nostd::string_view name, core::SystemTimestamp timestamp) noexcept { pass; }

void AddEvent(nostd::string_view name,
core::SystemTimestamp timestamp,
const KeyValueIterable &attributes) noexcept { pass; }

void AddEvent(nostd::string_view name, const KeyValueIterable &attributes) noexcept
{
this->AddEvent(name, std::chrono::system_clock::now(), attributes);
}

void SetStatus(CanonicalCode status, nostd::string_view description) noexcept {
pass;
}

void UpdateName(nostd::string_view name) noexcept {
pass;
}

void End(const EndSpanOptions &options = {}) noexcept {
pass;
}

nostd::string_view ToString() {
return "DefaultSpan";
}

DefaultSpan() = default;

DefaultSpan(SpanContext span_context) {
this->span_context_ = span_context;
}

// movable and copiable
DefaultSpan(DefaultSpan&& spn) : span_context_(spn.GetContext()) {}
DefaultSpan(const DefaultSpan& spn) : span_context_(spn.GetContext()) {}

trace::Tracer &tracer() noexcept {
return tracer_; // Invalid tracer
}

// Creates an instance of this class with spancontext.
static DefaultSpan Create(SpanContext span_context) {
return DefaultSpan(span_context);
}

private:
SpanContext span_context_;
trace::Tracer tracer_;
};
}
OPENTELEMETRY_END_NAMESPACE
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
42 changes: 42 additions & 0 deletions api/include/opentelemetry/trace/propagation/http_text_format.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#pragma once

#include <cstdint>
#include "opentelemetry/context/context.h"
#include "opentelemetry/nostd/string_view.h"
//#include "opentelemetry/trace/span.h"
#include "opentelemetry/version.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace trace
{
namespace propagation
{

// The HTTPTextFormat class provides an interface that enables extracting and injecting
// context into headers of HTTP requests. HTTP frameworks and clients
// can integrate with HTTPTextFormat by providing the object containing the
// headers, and a getter and setter function for the extraction and
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
// injection of values, respectively.
template <typename T>
class HTTPTextFormat {
public:
// Rules that manages how context will be extracted from carrier.
using Getter = nostd::string_view(*)(const T &carrier, nostd::string_view trace_type);

// Rules that manages how context will be injected to carrier.
using Setter = void(*)(T &carrier, nostd::string_view trace_type,nostd::string_view trace_description);

// Returns the context that is stored in the HTTP header carrier with self defined rules.
virtual context::Context Extract(Getter get_from_carrier, const T &carrier, context::Context &context) = 0;

// Sets the context for a HTTP header carrier with self defined rules.
virtual void Inject(Setter set_from_carrier, T &carrier, const context::Context &context) = 0;

// // Set the span in the given context.
// virtual context::Context SetSpanInContext(trace::Span* span, context::Context &context) = 0;
// // Retrieve the current span.
// virtual trace::Span* GetCurrentSpan(context::Context &context) = 0;
Tianlin-Zhao marked this conversation as resolved.
Show resolved Hide resolved
};
}
}
OPENTELEMETRY_END_NAMESPACE
Loading