-
Notifications
You must be signed in to change notification settings - Fork 501
[API] Comply with W3C Trace Context #3115
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
Merged
Merged
Changes from 23 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
111f234
fix test_traceparent_header_name_valid_casing
psx95 e73c58b
Fix test_tracestate_empty_header
psx95 c4816de
Fix test_traceparent_duplicated
psx95 3696baf
Fix test_tracestate_member_count_limit
psx95 b1d0623
Fix TraceContextTest.test_traceparent_version_* tests
psx95 b0732da
Add TrimString function
psx95 9fcef5b
Fix test_traceparent_ows_handling
psx95 cc31fbb
Fix the Trim function to include all whitespace characters
psx95 6374424
Replace the use of detail::TrimString with common::Trim
psx95 a756114
Avoid unnecessary style change
psx95 b856c55
Update string util test cases to include other whitespaces
psx95 66599ce
Fix cmake clang warnings
psx95 b460bd4
Add tests for SplitString
psx95 75aa431
Run format tool
psx95 0b0ef58
Fix valgrind issues with gtest
psx95 ffab2ee
Replace parameterized test with standard one
psx95 e7cfb9a
Move the test cases within test scope
psx95 06283f7
Remove vector from testcase struct
psx95 5d1d476
Add CI for trace context validation
psx95 22b8eb1
Stop server using a signal callback
psx95 175df2e
Remove debugging statements from CI
psx95 e2c2805
Specify SPEC_LEVEL and test suites to run
psx95 444abe6
Update Changelog
psx95 975ac71
Remove extraneous thread and busy loop
psx95 a90c053
Move static function outside class
psx95 1785610
Update test
psx95 a4c121a
Merge branch 'main' into w3c-trace-context
psx95 8dbf8e5
Update stop instructions in README
psx95 ebaaaf3
Update CI step to run on ubuntu-latest
psx95 35e6ec0
Prevent repeated conversions of hex versions to binary
psx95 bb5f91a
Remove one-liner functions with inline code
psx95 73a9b86
Merge branch 'main' into w3c-trace-context
marcalff 92f198a
Update changelog
psx95 894c042
Remove unused env variable
psx95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // Copyright The OpenTelemetry Authors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #include <gtest/gtest.h> | ||
| #include <opentelemetry/trace/propagation/b3_propagator.h> | ||
| #include <string> | ||
|
|
||
| #include "opentelemetry/nostd/string_view.h" | ||
|
|
||
| using namespace opentelemetry; | ||
|
|
||
| namespace | ||
| { | ||
|
|
||
| struct SplitStringTestData | ||
| { | ||
| opentelemetry::nostd::string_view input; | ||
| char separator; | ||
| size_t max_count; | ||
| size_t expected_number_strings; | ||
|
|
||
| // When googletest registers parameterized tests, it uses this method to format the parameters. | ||
| // The default implementation prints hex dump of all bytes in the object. If there is any padding | ||
| // in these bytes, valgrind reports this as a warning - "Use of uninitialized bytes". | ||
| // See https://github.com/google/googletest/issues/3805. | ||
| friend void PrintTo(const SplitStringTestData &data, std::ostream *os) | ||
| { | ||
| std::stringstream ss; | ||
| *os << "(" << data.input << "," << data.separator << "," << data.max_count << "," | ||
| << data.expected_number_strings << ")"; | ||
| } | ||
| }; | ||
|
|
||
| const SplitStringTestData split_string_test_cases[] = { | ||
| {"foo,bar,baz", ',', 4, 3}, | ||
| {"foo,bar,baz,foobar", ',', 4, 4}, | ||
| {"foo,bar,baz,foobar", '.', 4, 1}, | ||
| {"foo,bar,baz,", ',', 4, 4}, | ||
| {"foo,bar,baz,", ',', 2, 2}, | ||
| {"foo ,bar, baz ", ',', 4, 3}, | ||
| {"foo ,bar, baz ", ',', 4, 3}, | ||
| {"00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01", '-', 4, 4}, | ||
| }; | ||
| } // namespace | ||
|
|
||
| // Test fixture | ||
| class SplitStringTestFixture : public ::testing::TestWithParam<SplitStringTestData> | ||
| {}; | ||
|
|
||
| TEST_P(SplitStringTestFixture, SplitsAsExpected) | ||
| { | ||
| const SplitStringTestData test_param = GetParam(); | ||
| std::vector<opentelemetry::nostd::string_view> fields{}; | ||
psx95 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fields.reserve(test_param.expected_number_strings); | ||
| size_t got_splits_num = opentelemetry::trace::propagation::detail::SplitString( | ||
| test_param.input, test_param.separator, fields.data(), test_param.max_count); | ||
|
|
||
| // Assert on the output | ||
| EXPECT_EQ(got_splits_num, test_param.expected_number_strings); | ||
| } | ||
|
|
||
| INSTANTIATE_TEST_SUITE_P(SplitStringTestCases, | ||
| SplitStringTestFixture, | ||
| ::testing::ValuesIn(split_string_test_cases)); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.