From 9595b1958404e837503cd0650414cee74f257315 Mon Sep 17 00:00:00 2001 From: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> Date: Wed, 19 Jun 2024 21:09:38 +0530 Subject: [PATCH 1/7] Remove UTF-8 (BOM) text from API headers Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> --- api/include/opentelemetry/baggage/baggage.h | 3 ++- api/include/opentelemetry/context/context.h | 3 ++- api/include/opentelemetry/context/runtime_context.h | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/include/opentelemetry/baggage/baggage.h b/api/include/opentelemetry/baggage/baggage.h index 66eb9d9833..9bdf09f752 100644 --- a/api/include/opentelemetry/baggage/baggage.h +++ b/api/include/opentelemetry/baggage/baggage.h @@ -1,4 +1,4 @@ -// Copyright The OpenTelemetry Authors +// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 #pragma once @@ -297,3 +297,4 @@ class OPENTELEMETRY_EXPORT Baggage } // namespace baggage OPENTELEMETRY_END_NAMESPACE + diff --git a/api/include/opentelemetry/context/context.h b/api/include/opentelemetry/context/context.h index d0b53c3ea8..f571d14f44 100644 --- a/api/include/opentelemetry/context/context.h +++ b/api/include/opentelemetry/context/context.h @@ -1,4 +1,4 @@ -// Copyright The OpenTelemetry Authors +// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 #pragma once @@ -160,3 +160,4 @@ class Context }; } // namespace context OPENTELEMETRY_END_NAMESPACE + diff --git a/api/include/opentelemetry/context/runtime_context.h b/api/include/opentelemetry/context/runtime_context.h index 2cd5b0ff90..da76d586c7 100644 --- a/api/include/opentelemetry/context/runtime_context.h +++ b/api/include/opentelemetry/context/runtime_context.h @@ -1,4 +1,4 @@ -// Copyright The OpenTelemetry Authors +// Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 #pragma once @@ -333,3 +333,4 @@ static RuntimeContextStorage *GetDefaultStorage() noexcept } } // namespace context OPENTELEMETRY_END_NAMESPACE + From aef18d8530ab40312ff9935625a8f31033632ef8 Mon Sep 17 00:00:00 2001 From: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> Date: Wed, 19 Jun 2024 21:24:47 +0530 Subject: [PATCH 2/7] Remove UTF-8 text from opentracing-shim Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> --- opentracing-shim/src/span_shim.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentracing-shim/src/span_shim.cc b/opentracing-shim/src/span_shim.cc index 808b6b9e74..7911277f78 100644 --- a/opentracing-shim/src/span_shim.cc +++ b/opentracing-shim/src/span_shim.cc @@ -111,7 +111,7 @@ void SpanShim::Log(opentracing::SystemTime timestamp, void SpanShim::logImpl(nostd::span fields, const opentracing::SystemTime *const timestamp) noexcept { - // The Add Event’s name parameter MUST be the value with the event key + // The Add Event's name parameter MUST be the value with the event key // in the pair set, or else fallback to use the log literal string. const auto &event = std::find_if(fields.begin(), fields.end(), [](const EventEntry &item) { return item.first == "event"; }); From dd4169b0a9dc3db52ba7016579624530e1f4971f Mon Sep 17 00:00:00 2001 From: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> Date: Wed, 19 Jun 2024 21:27:40 +0530 Subject: [PATCH 3/7] Fix new lines Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> --- api/include/opentelemetry/baggage/baggage.h | 1 - api/include/opentelemetry/context/context.h | 1 - api/include/opentelemetry/context/runtime_context.h | 1 - 3 files changed, 3 deletions(-) diff --git a/api/include/opentelemetry/baggage/baggage.h b/api/include/opentelemetry/baggage/baggage.h index 9bdf09f752..6c799cda27 100644 --- a/api/include/opentelemetry/baggage/baggage.h +++ b/api/include/opentelemetry/baggage/baggage.h @@ -297,4 +297,3 @@ class OPENTELEMETRY_EXPORT Baggage } // namespace baggage OPENTELEMETRY_END_NAMESPACE - diff --git a/api/include/opentelemetry/context/context.h b/api/include/opentelemetry/context/context.h index f571d14f44..cf5c9cd319 100644 --- a/api/include/opentelemetry/context/context.h +++ b/api/include/opentelemetry/context/context.h @@ -160,4 +160,3 @@ class Context }; } // namespace context OPENTELEMETRY_END_NAMESPACE - diff --git a/api/include/opentelemetry/context/runtime_context.h b/api/include/opentelemetry/context/runtime_context.h index da76d586c7..cccc71e32f 100644 --- a/api/include/opentelemetry/context/runtime_context.h +++ b/api/include/opentelemetry/context/runtime_context.h @@ -333,4 +333,3 @@ static RuntimeContextStorage *GetDefaultStorage() noexcept } } // namespace context OPENTELEMETRY_END_NAMESPACE - From ec795da75c688f9e00743ca71fd11dfbbef16931 Mon Sep 17 00:00:00 2001 From: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> Date: Wed, 19 Jun 2024 23:11:42 +0530 Subject: [PATCH 4/7] Fix unicode characters in tests Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> --- ext/test/http/url_parser_test.cc | 2 +- sdk/test/metrics/instrument_metadata_validator_test.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/test/http/url_parser_test.cc b/ext/test/http/url_parser_test.cc index 212c5655a7..250bda2618 100644 --- a/ext/test/http/url_parser_test.cc +++ b/ext/test/http/url_parser_test.cc @@ -140,7 +140,7 @@ TEST(UrlDecoderTests, BasicTests) std::map testdata{ {"Authentication=Basic xxx", "Authentication=Basic xxx"}, {"Authentication=Basic%20xxx", "Authentication=Basic xxx"}, - {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", "öà§ÖabcdÄ"}, + {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", "\u00F6\u00E0\u00A7\u00D6abcd\u00C4"}, {"%2x", "%2x"}, {"%20", " "}, {"text%2", "text%2"}, diff --git a/sdk/test/metrics/instrument_metadata_validator_test.cc b/sdk/test/metrics/instrument_metadata_validator_test.cc index 17b76a9419..eb7659ad49 100644 --- a/sdk/test/metrics/instrument_metadata_validator_test.cc +++ b/sdk/test/metrics/instrument_metadata_validator_test.cc @@ -21,7 +21,7 @@ TEST(InstrumentMetadataValidator, TestName) std::vector invalid_names = { "", // empty string "1sdf", // string starting with number - "123€AAA€BBB", // unicode characters + "123\u20ACAAA\u20ACBBB" // unicode characters "/\\sdsd", // string starting with special character "***sSSs", // string starting with special character "a\\broken\\path", // contains backward slash @@ -56,7 +56,7 @@ TEST(InstrumentMetadataValidator, TestUnit) std::vector invalid_units = { CreateVeryLargeString(5) + "ABCERTYGJ", // total 64 charactes CreateVeryLargeString(7), // string bigger than 63 chars - "123€AAA€BBB", // unicode string + "123\u20ACAAA\u20ACBBB", // unicode string }; for (auto const &str : invalid_units) { From 6b0a70086bb89b7c93930913de2e4ba8446049cc Mon Sep 17 00:00:00 2001 From: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> Date: Thu, 20 Jun 2024 06:50:31 +0530 Subject: [PATCH 5/7] Use UTF-8 characters instead of UTF-16 Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> --- ext/test/http/url_parser_test.cc | 2 +- .../instrument_metadata_validator_test.cc | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/ext/test/http/url_parser_test.cc b/ext/test/http/url_parser_test.cc index 250bda2618..6a87ae675e 100644 --- a/ext/test/http/url_parser_test.cc +++ b/ext/test/http/url_parser_test.cc @@ -140,7 +140,7 @@ TEST(UrlDecoderTests, BasicTests) std::map testdata{ {"Authentication=Basic xxx", "Authentication=Basic xxx"}, {"Authentication=Basic%20xxx", "Authentication=Basic xxx"}, - {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", "\u00F6\u00E0\u00A7\u00D6abcd\u00C4"}, + {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", "\xc3\xb6\xc3\xa0\xc2\xa7\xc3\x96\x61\x62\x63\x64\xc3\x84"}, {"%2x", "%2x"}, {"%20", " "}, {"text%2", "text%2"}, diff --git a/sdk/test/metrics/instrument_metadata_validator_test.cc b/sdk/test/metrics/instrument_metadata_validator_test.cc index eb7659ad49..963f57fecb 100644 --- a/sdk/test/metrics/instrument_metadata_validator_test.cc +++ b/sdk/test/metrics/instrument_metadata_validator_test.cc @@ -19,14 +19,14 @@ TEST(InstrumentMetadataValidator, TestName) { opentelemetry::sdk::metrics::InstrumentMetaDataValidator validator; std::vector invalid_names = { - "", // empty string - "1sdf", // string starting with number - "123\u20ACAAA\u20ACBBB" // unicode characters - "/\\sdsd", // string starting with special character - "***sSSs", // string starting with special character - "a\\broken\\path", // contains backward slash - CreateVeryLargeString(25) + "X", // total 256 characters - CreateVeryLargeString(26), // string much bigger than 255 characters + "", // empty string + "1sdf", // string starting with number + "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42" // unicode characters + "/\\sdsd", // string starting with special character + "***sSSs", // string starting with special character + "a\\broken\\path", // contains backward slash + CreateVeryLargeString(25) + "X", // total 256 characters + CreateVeryLargeString(26), // string much bigger than 255 characters }; for (auto const &str : invalid_names) { @@ -54,9 +54,9 @@ TEST(InstrumentMetadataValidator, TestUnit) { opentelemetry::sdk::metrics::InstrumentMetaDataValidator validator; std::vector invalid_units = { - CreateVeryLargeString(5) + "ABCERTYGJ", // total 64 charactes - CreateVeryLargeString(7), // string bigger than 63 chars - "123\u20ACAAA\u20ACBBB", // unicode string + CreateVeryLargeString(5) + "ABCERTYGJ", // total 64 charactes + CreateVeryLargeString(7), // string bigger than 63 chars + "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42", // unicode string }; for (auto const &str : invalid_units) { From 33660fb64f892d3ef61a5da8b501289958de0252 Mon Sep 17 00:00:00 2001 From: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> Date: Thu, 20 Jun 2024 07:07:20 +0530 Subject: [PATCH 6/7] Fix formatting Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> --- ext/test/http/url_parser_test.cc | 3 ++- .../instrument_metadata_validator_test.cc | 22 +++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/ext/test/http/url_parser_test.cc b/ext/test/http/url_parser_test.cc index 6a87ae675e..a30fb0ab72 100644 --- a/ext/test/http/url_parser_test.cc +++ b/ext/test/http/url_parser_test.cc @@ -140,7 +140,8 @@ TEST(UrlDecoderTests, BasicTests) std::map testdata{ {"Authentication=Basic xxx", "Authentication=Basic xxx"}, {"Authentication=Basic%20xxx", "Authentication=Basic xxx"}, - {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", "\xc3\xb6\xc3\xa0\xc2\xa7\xc3\x96\x61\x62\x63\x64\xc3\x84"}, + {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", + "\xc3\xb6\xc3\xa0\xc2\xa7\xc3\x96\x61\x62\x63\x64\xc3\x84"}, {"%2x", "%2x"}, {"%20", " "}, {"text%2", "text%2"}, diff --git a/sdk/test/metrics/instrument_metadata_validator_test.cc b/sdk/test/metrics/instrument_metadata_validator_test.cc index 963f57fecb..172df1af3c 100644 --- a/sdk/test/metrics/instrument_metadata_validator_test.cc +++ b/sdk/test/metrics/instrument_metadata_validator_test.cc @@ -19,14 +19,14 @@ TEST(InstrumentMetadataValidator, TestName) { opentelemetry::sdk::metrics::InstrumentMetaDataValidator validator; std::vector invalid_names = { - "", // empty string - "1sdf", // string starting with number - "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42" // unicode characters - "/\\sdsd", // string starting with special character - "***sSSs", // string starting with special character - "a\\broken\\path", // contains backward slash - CreateVeryLargeString(25) + "X", // total 256 characters - CreateVeryLargeString(26), // string much bigger than 255 characters + "", // empty string + "1sdf", // string starting with number + "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42" // unicode characters + "/\\sdsd", // string starting with special character + "***sSSs", // string starting with special character + "a\\broken\\path", // contains backward slash + CreateVeryLargeString(25) + "X", // total 256 characters + CreateVeryLargeString(26), // string much bigger than 255 character }; for (auto const &str : invalid_names) { @@ -54,9 +54,9 @@ TEST(InstrumentMetadataValidator, TestUnit) { opentelemetry::sdk::metrics::InstrumentMetaDataValidator validator; std::vector invalid_units = { - CreateVeryLargeString(5) + "ABCERTYGJ", // total 64 charactes - CreateVeryLargeString(7), // string bigger than 63 chars - "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42", // unicode string + CreateVeryLargeString(5) + "ABCERTYGJ", // total 64 charactes + CreateVeryLargeString(7), // string bigger than 63 chars + "\x31\x32\x33\xe2\x82\xac\x41\x41\x41\xe2\x82\xac\x42\x42\x42", // unicode string }; for (auto const &str : invalid_units) { From 0a8dc8d774cd90988c718aa010d77974a0f416d5 Mon Sep 17 00:00:00 2001 From: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> Date: Thu, 20 Jun 2024 07:28:17 +0530 Subject: [PATCH 7/7] Fix formatting Signed-off-by: perhapsmaple <140232061+perhapsmaple@users.noreply.github.com> --- ext/test/http/url_parser_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/test/http/url_parser_test.cc b/ext/test/http/url_parser_test.cc index a30fb0ab72..7b28d763e6 100644 --- a/ext/test/http/url_parser_test.cc +++ b/ext/test/http/url_parser_test.cc @@ -140,7 +140,7 @@ TEST(UrlDecoderTests, BasicTests) std::map testdata{ {"Authentication=Basic xxx", "Authentication=Basic xxx"}, {"Authentication=Basic%20xxx", "Authentication=Basic xxx"}, - {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", + {"%C3%B6%C3%A0%C2%A7%C3%96abcd%C3%84", "\xc3\xb6\xc3\xa0\xc2\xa7\xc3\x96\x61\x62\x63\x64\xc3\x84"}, {"%2x", "%2x"}, {"%20", " "},