This is an automated email from the ASF dual-hosted git repository.
serverglen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git
The following commit(s) were added to refs/heads/master by this push:
new 81b9397c add gflag to disable sampler thread (#1990)
81b9397c is described below
commit 81b9397c6b8750098d787d00a19d3f1650f173cd
Author: Ran Miller <[email protected]>
AuthorDate: Mon Nov 14 17:15:12 2022 +0800
add gflag to disable sampler thread (#1990)
---
src/bvar/detail/sampler.cpp | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/bvar/detail/sampler.cpp b/src/bvar/detail/sampler.cpp
index 9887539f..1d398ba9 100644
--- a/src/bvar/detail/sampler.cpp
+++ b/src/bvar/detail/sampler.cpp
@@ -202,8 +202,14 @@ Sampler::Sampler() : _used(true) {}
Sampler::~Sampler() {}
+DEFINE_bool(bvar_enable_sampling, true, "is enable bvar sampling");
+
void Sampler::schedule() {
- *butil::get_leaky_singleton<SamplerCollector>() << this;
+ // since the SamplerCollector is initialized before the program starts
+ // flags will not take effect if used in the SamplerCollector constructor
+ if (FLAGS_bvar_enable_sampling) {
+ *butil::get_leaky_singleton<SamplerCollector>() << this;
+ }
}
void Sampler::destroy() {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]