Skip to content

Commit 71e6ce2

Browse files
committed
Fixes IWYU and clang-tidy warnings
1 parent e98ad81 commit 71e6ce2

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

sdk/src/common/attribute_validity.cc

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <map>
77
#include <ostream>
8-
#include <unordered_map>
98
#include <unordered_set>
109
#include <utility>
1110

@@ -37,13 +36,39 @@ OPENTELEMETRY_EXPORT bool AttributeIsValidString(nostd::string_view value) noexc
3736

3837
OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid(const OwnedAttributeValue &value) noexcept
3938
{
40-
return nostd::visit(GetSharedAttributeValidator(), value);
39+
#if OPENTELEMETRY_HAVE_EXCEPTIONS
40+
try
41+
{
42+
#endif
43+
44+
return nostd::visit(GetSharedAttributeValidator(), value);
45+
46+
#if OPENTELEMETRY_HAVE_EXCEPTIONS
47+
}
48+
catch (...)
49+
{
50+
return false;
51+
}
52+
#endif
4153
}
4254

4355
OPENTELEMETRY_EXPORT bool AttributeValidator::IsValid(
4456
const opentelemetry::common::AttributeValue &value) noexcept
4557
{
46-
return nostd::visit(GetSharedAttributeValidator(), value);
58+
#if OPENTELEMETRY_HAVE_EXCEPTIONS
59+
try
60+
{
61+
#endif
62+
63+
return nostd::visit(GetSharedAttributeValidator(), value);
64+
65+
#if OPENTELEMETRY_HAVE_EXCEPTIONS
66+
}
67+
catch (...)
68+
{
69+
return false;
70+
}
71+
#endif
4772
}
4873

4974
OPENTELEMETRY_EXPORT bool AttributeValidator::IsAllValid(const AttributeMap &attributes) noexcept

sdk/src/trace/span.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
#include <chrono>
5+
#include <ostream>
56
#include <utility>
67

78
#include "opentelemetry/nostd/function_ref.h"

0 commit comments

Comments
 (0)