From 2fdc0226c459e39e43d73de750829db38facbb1c Mon Sep 17 00:00:00 2001 From: Kyle L Date: Sun, 16 Feb 2025 00:11:23 -0500 Subject: [PATCH] Fix compilation with Regex being disabled (#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. --- sdk/src/metrics/instrument_metadata_validator.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sdk/src/metrics/instrument_metadata_validator.cc b/sdk/src/metrics/instrument_metadata_validator.cc index 59244bfe33..482330a682 100644 --- a/sdk/src/metrics/instrument_metadata_validator.cc +++ b/sdk/src/metrics/instrument_metadata_validator.cc @@ -9,6 +9,8 @@ #if OPENTELEMETRY_HAVE_WORKING_REGEX # include +#else +# include #endif OPENTELEMETRY_BEGIN_NAMESPACE @@ -16,11 +18,13 @@ namespace sdk { namespace metrics { +#if OPENTELEMETRY_HAVE_WORKING_REGEX // instrument-name = ALPHA 0*254 ("_" / "." / "-" / "/" / ALPHA / DIGIT) const std::string kInstrumentNamePattern = "[a-zA-Z][-_./a-zA-Z0-9]{0,254}"; // const std::string kInstrumentUnitPattern = "[\x01-\x7F]{0,63}"; // instrument-unit = It can have a maximum length of 63 ASCII chars +#endif InstrumentMetaDataValidator::InstrumentMetaDataValidator() #if OPENTELEMETRY_HAVE_WORKING_REGEX