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

Add option to enable trace sampling #238

Merged
merged 1 commit into from
Aug 23, 2023
Merged

Conversation

grcevski
Copy link
Contributor

This PR adds a configuration option to enable trace generation sampling. Sampling with ParentBased and TraceIDRatio are recommended as per the OTEL spec https://opentelemetry.io/docs/instrumentation/go/sampling/.

By default our sampling remains at 1.0, which means everything is sent, however it can be configured as little as 0.

@codecov-commenter
Copy link

Codecov Report

Merging #238 (372fa91) into main (c73c3a7) will decrease coverage by 4.62%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #238      +/-   ##
==========================================
- Coverage   80.78%   76.16%   -4.62%     
==========================================
  Files          37       35       -2     
  Lines        3065     3008      -57     
==========================================
- Hits         2476     2291     -185     
- Misses        438      539     +101     
- Partials      151      178      +27     
Flag Coverage Δ
integration-test 76.16% <100.00%> (+<0.01%) ⬆️
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
pkg/internal/pipe/config.go 28.20% <ø> (-28.21%) ⬇️
pkg/internal/export/otel/traces.go 72.54% <100.00%> (-16.45%) ⬇️

... and 8 files with indirect coverage changes

Copy link
Contributor

@MattFrick MattFrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Should there be a test that does a sampling ratio other than fully on or off?

@grcevski
Copy link
Contributor Author

Looks good. Should there be a test that does a sampling ratio other than fully on or off?

I was thinking about it, but I'm struggling to make one that won't be flaky. Maybe at 50% I can double the events and check if I get half. I'll try that.

@grcevski grcevski merged commit a56c905 into grafana:main Aug 23, 2023
mattdurham pushed a commit to mattdurham/beyla that referenced this pull request Jan 22, 2025
Add option to enable trace sampling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants