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

expose sampling radio settings for tracing #3171

Open
dmaoxiang opened this issue Nov 23, 2023 · 6 comments
Open

expose sampling radio settings for tracing #3171

dmaoxiang opened this issue Nov 23, 2023 · 6 comments
Assignees
Labels
enhancement planned This issue/proposal is planned into our next steps.

Comments

@dmaoxiang
Copy link

gf v2.5.6 链路追踪 怎么设置采样比例, 全量上报数据量太大了

@Issues-translate-bot Issues-translate-bot changed the title 链路追踪采样设置 Link tracking sampling settings Nov 23, 2023
@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


gf v2.5.6 link tracking How to set the sampling ratio? The amount of data reported in full is too large

@houseme
Copy link
Member

houseme commented Dec 11, 2023

需要自己初始化的时候设置

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


Set when you need to initialize it yourself

@weimx2023
Copy link

@dmaoxiang @houseme I see this function for setting the sampling ratio, which is currently written as standard sampling (100%) in the code.

	tracerProvider := sdktrace.NewTracerProvider(
		sdktrace.WithSampler(sdktrace.AlwaysSample()),//this config the sampling ratio
		sdktrace.WithResource(res),
		sdktrace.WithSpanProcessor(bsp),
	)

Could we open up some configuration parameters for users to set? Otherwise, we'll have to rewrite this function ourselves.

    samplingRatio := 0.1

    tracerProvider := sdktrace.NewTracerProvider(
        sdktrace.WithSampler(sdktrace.TraceIDRatioBased(samplingRatio)),//set the sampling ratio to 10%
        sdktrace.WithResource(res),
        sdktrace.WithSpanProcessor(bsp),
    )

@gqcn
Copy link
Member

gqcn commented Sep 30, 2024

@dmaoxiang @houseme I see this function for setting the sampling ratio, which is currently written as standard sampling (100%) in the code.

	tracerProvider := sdktrace.NewTracerProvider(
		sdktrace.WithSampler(sdktrace.AlwaysSample()),//this config the sampling ratio
		sdktrace.WithResource(res),
		sdktrace.WithSpanProcessor(bsp),
	)

Could we open up some configuration parameters for users to set? Otherwise, we'll have to rewrite this function ourselves.

    samplingRatio := 0.1

    tracerProvider := sdktrace.NewTracerProvider(
        sdktrace.WithSampler(sdktrace.TraceIDRatioBased(samplingRatio)),//set the sampling ratio to 10%
        sdktrace.WithResource(res),
        sdktrace.WithSpanProcessor(bsp),
    )

@houseme 我看了下咱们提供的contrib/trace/otlphttp&otlpgrpc没有开放TraceProvider的参数配置,封装得比较死,是否可以考虑在初始化的时候公开一下参数设置?例如像metric那样增加Option的选项

func NewProvider(option ...Option) (gmetric.Provider, error) {
这个Option可以直接使用OpenTelemetryOption不需要自己再转换一下With*方法。

@houseme
Copy link
Member

houseme commented Sep 30, 2024

@dmaoxiang @houseme I see this function for setting the sampling ratio, which is currently written as standard sampling (100%) in the code.我看到这个函数用于设置采样率,目前在代码中写为标准采样(100%)。

	tracerProvider := sdktrace.NewTracerProvider(
		sdktrace.WithSampler(sdktrace.AlwaysSample()),//this config the sampling ratio
		sdktrace.WithResource(res),
		sdktrace.WithSpanProcessor(bsp),
	)

Could we open up some configuration parameters for users to set? Otherwise, we'll have to rewrite this function ourselves.能否开放一些配置参数供用户设置?否则,我们就必须自己重写这个函数。

    samplingRatio := 0.1

    tracerProvider := sdktrace.NewTracerProvider(
        sdktrace.WithSampler(sdktrace.TraceIDRatioBased(samplingRatio)),//set the sampling ratio to 10%
        sdktrace.WithResource(res),
        sdktrace.WithSpanProcessor(bsp),
    )

@houseme 我看了下咱们提供的contrib/trace/otlphttp&otlpgrpc没有开放TraceProvider的参数配置,封装得比较死,是否可以考虑在初始化的时候公开一下参数设置?例如像metric那样增加Option的选项

func NewProvider(option ...Option) (gmetric.Provider, error) {

这个Option可以直接使用OpenTelemetryOption不需要自己再转换一下With*方法。

咱们改造 使用option的形式

@gqcn gqcn changed the title Link tracking sampling settings add sampling radio settings for tracing Oct 7, 2024
@gqcn gqcn added enhancement planned This issue/proposal is planned into our next steps. labels Oct 7, 2024
@gqcn gqcn changed the title add sampling radio settings for tracing expose sampling radio settings for tracing Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement planned This issue/proposal is planned into our next steps.
Projects
None yet
Development

No branches or pull requests

5 participants