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

Parses schema extraction remote config configuration #2428

Closed
wants to merge 14 commits into from

Conversation

estringana
Copy link
Contributor

Description

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@estringana estringana force-pushed the estringana/schema-extraction-remote-config branch 2 times, most recently from 05825bc to cbb6eed Compare December 22, 2023 14:20
@estringana estringana force-pushed the estringana/schema-extraction-remote-config branch from 336d777 to e4f9b11 Compare January 4, 2024 09:06
@estringana estringana marked this pull request as ready for review January 10, 2024 11:51
@estringana estringana requested a review from a team as a code owner January 10, 2024 11:51
appsec/src/helper/sampler.hpp Outdated Show resolved Hide resolved
appsec/src/helper/sampler.hpp Outdated Show resolved Hide resolved
appsec/src/helper/sampler.hpp Show resolved Hide resolved
appsec/src/helper/sampler.hpp Outdated Show resolved Hide resolved
appsec/src/helper/service.cpp Outdated Show resolved Hide resolved
Comment on lines 71 to 73
if (sample_rate_ !=
valid_sample_rate(service_config_->get_request_sample_rate())) {
set_sampler_rate(service_config_->get_request_sample_rate());
Copy link
Contributor

Choose a reason for hiding this comment

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

It makes no sense for you to be doing all these checks on each call to get(), then calling valid_sample_rate possibly twice, etc. Plus there's the lock and concurrent_, ...

What I suggest is:

  • Make the only mutable variable in sampler be request_ (an atomic that you can increment with fetch_add and relaxed memory order btw).
  • Keep the sample rate, but never change it.
  • Remove the mutex. Remove, service_config_. Remove concurrent_, maybe, I've no idea what it's doing.
  • Do all the normalization of the sample rate on the sampler constructor or before calling the constructor.
  • Store the sampler in an atomic shared_ptr if this is c++20 or previous facilities if before.
  • The condition in request_ < std::numeric_limits<unsigned>::max() is also redudant, unsigned numbers already wrap around.

@estringana estringana force-pushed the estringana/schema-extraction-remote-config branch from 3597b5d to 3651c11 Compare March 27, 2024 10:50
@estringana estringana force-pushed the estringana/schema-extraction-remote-config branch from 3651c11 to 20cac65 Compare April 17, 2024 07:05
appsec/src/helper/sampler.hpp Outdated Show resolved Hide resolved
appsec/src/helper/service.hpp Outdated Show resolved Hide resolved
@estringana estringana force-pushed the estringana/schema-extraction-remote-config branch from 5e7989a to ccf2514 Compare April 23, 2024 09:47
Copy link
Contributor

@Anilm3 Anilm3 left a comment

Choose a reason for hiding this comment

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

Sorry I should've mentioned this sooner but the RFC related to sampling was deprecated in favour of a new one. So the sampling isn't provided through remote configuration any longer.

I'm not sure if there's anything from this PR you'd like to keep but otherwise it can't be merged.

@estringana estringana closed this Apr 23, 2024
@estringana estringana deleted the estringana/schema-extraction-remote-config branch April 23, 2024 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants