Skip to content
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

[BUILD] Improve the handling of OPENTELEMETRY_HAVE_WORKING_REGEX. #2430

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

kylepl
Copy link
Contributor

@kylepl kylepl commented Dec 5, 2023

It used to be some places were checking for
defined(OPENTELEMETRY_HAVE_WORKING_REGEX), but it is always being set (to either 0 or 1) in api/include/opentelemetry/common/macros.h.

Thus move to just checking its value everywhere.

Additionally, even if we did have the feature off - compilation would fail, since not all the functions were ifdef'd. I assume this fails since there are not tests that have OPENTELEMETRY_HAVE_WORKING_REGEX as off.

My initial motivation for this was to reduce compile times, since specificing the definition with an std::regex adds a significant penalty to each translation unit (~700ms on my 5-year old laptop). In a separate patch, I think this should be moved to a .cc file - happy to receive advice on how (since api/ seems not to have .cc's).

It used to be some places were checking for
defined(OPENTELEMETRY_HAVE_WORKING_REGEX), but it is always being set
(to either 0 or 1) in api/include/opentelemetry/common/macros.h.

Thus move to just checking its value everywhere.

Additionally, even if we did have the feature off - compilation would
fail, since not all the functions were ifdef'd.

My initial motivation for this was to reduce compile times, since
specificing the definition with an std::regex adds a significant penalty
to each translation unit (~700ms on my 5-year old laptop). In a separate
patch, I think this should be moved to a .cc file - happy to receive
advice on how (since api/ seems not to have .cc's).
@kylepl kylepl requested a review from a team December 5, 2023 17:43
Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Merging #2430 (3267cce) into main (d1143ab) will increase coverage by 0.02%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2430      +/-   ##
==========================================
+ Coverage   87.04%   87.06%   +0.02%     
==========================================
  Files         199      199              
  Lines        6079     6079              
==========================================
+ Hits         5291     5292       +1     
+ Misses        788      787       -1     
Files Coverage Δ
api/include/opentelemetry/trace/trace_state.h 97.60% <ø> (ø)
...include/opentelemetry/sdk/metrics/view/predicate.h 81.82% <ø> (ø)
sdk/src/metrics/instrument_metadata_validator.cc 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks for the fix.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix.

@marcalff marcalff changed the title Improve the handling of OPENTELEMETRY_HAVE_WORKING_REGEX. [BUILD] Improve the handling of OPENTELEMETRY_HAVE_WORKING_REGEX. Dec 5, 2023
@marcalff marcalff merged commit a86f8f0 into open-telemetry:main Dec 5, 2023
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants