Skip to content

rpc_dump的功能可以方便的自定义采样频率吗? #1225

@guodongxiaren

Description

@guodongxiaren

Is your feature request related to a problem? (你需要的功能是否与某个问题有关?)
不用生产环境来dump流量。用的非生产环境,但是非生产环境的流量很小。想dump流量貌似很慢。

Describe the solution you'd like (描述你期望的解决方法)

inline size_t is_collectable(CollectorSpeedLimit* speed_limit) {
    if (speed_limit->ever_grabbed) { // most common case
        const size_t sampling_range = speed_limit->sampling_range;
        // fast_rand is faster than fast_rand_in
        if ((butil::fast_rand() & (COLLECTOR_SAMPLING_BASE - 1)) >= sampling_range) {
            return 0;
        }
        return sampling_range;
    }
    // Slower, only runs before -bvar_collector_expected_per_second samples are
    // collected to calculate a more reasonable sampling_range for the type.
    extern size_t is_collectable_before_first_time_grabbed(CollectorSpeedLimit*);
    return is_collectable_before_first_time_grabbed(speed_limit);
}

这个sampling_range 受FLAGS_bvar_collector_expected_per_second影响。
但是计算方法太迷了。怎么设置才能让每个请求过来都能dump。

Describe alternatives you've considered (描述你想到的折衷方案)

Additional context/screenshots (更多上下文/截图)

Metadata

Metadata

Assignees

No one assigned

    Labels

    usageuser need to change the way using brpc to solve the problem

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions