Skip to content

Commit 2fdc022

Browse files
authored
Fix compilation with Regex being disabled (open-telemetry#3276)
* Fix compilation with Regex disabled: * It was missing an include for std::any_of * Avoid declaring unused constants (at least my LLVM errors out) * Only include algorithm if needed. * Fix where we reference the WORKING_REGEX.
1 parent 2f58e95 commit 2fdc022

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sdk/src/metrics/instrument_metadata_validator.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@
99

1010
#if OPENTELEMETRY_HAVE_WORKING_REGEX
1111
# include <regex>
12+
#else
13+
# include <algorithm>
1214
#endif
1315

1416
OPENTELEMETRY_BEGIN_NAMESPACE
1517
namespace sdk
1618
{
1719
namespace metrics
1820
{
21+
#if OPENTELEMETRY_HAVE_WORKING_REGEX
1922
// instrument-name = ALPHA 0*254 ("_" / "." / "-" / "/" / ALPHA / DIGIT)
2023
const std::string kInstrumentNamePattern = "[a-zA-Z][-_./a-zA-Z0-9]{0,254}";
2124
//
2225
const std::string kInstrumentUnitPattern = "[\x01-\x7F]{0,63}";
2326
// instrument-unit = It can have a maximum length of 63 ASCII chars
27+
#endif
2428

2529
InstrumentMetaDataValidator::InstrumentMetaDataValidator()
2630
#if OPENTELEMETRY_HAVE_WORKING_REGEX

0 commit comments

Comments
 (0)