You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brpc.apache.org by se...@apache.org on 2022/11/14 09:15:19 UTC
[incubator-brpc] branch master updated: add gflag to disable sampler thread (#1990)
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 <z8...@gmail.com>
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: dev-unsubscribe@brpc.apache.org
For additional commands, e-mail: dev-help@brpc.apache.org