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

feat(volo-http): support disabling stats #370

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

wfly1998
Copy link
Member

Motivation

Sometimes stats needs a switch to control it for optimal performance, this PR adds it to the config to enable or disable it.

Solution

Add enable_stats in Config.

For server, we can disable it by:

let mut server = Server::new(app);
server.config_mut().stat_enable = false;
server.run(addr).await.unwrap();

For client, we can disable it by:

let client = ClientBuilder::new()
    .caller_name("example.http.client")
    .callee_name("example.http.server")
    .enable_stat(false)
    .header("Test", "Test")?
    .build();

Or:

let mut builder = ClientBuilder::new()
    .caller_name("example.http.client")
    .callee_name("example.http.server")
    .header("Test", "Test")?;
builder.config_mut().stat_enable = false;
let client = builder.build();

Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
@wfly1998 wfly1998 merged commit 10f39e4 into cloudwego:main Feb 20, 2024
13 checks passed
@wfly1998 wfly1998 deleted the feat/disable-stats branch February 20, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants