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 configurable samples #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,17 @@ You can log additional data between span start and finish. For example, `annotat
$span->annotate('Order Validated')
```

### PercentageSampler

Use `PercentageSampler` to control the upload of samples according to the sampling rate and reduce data reporting

- Adding configuration to `.env`,Reporting rate `0 ~ 1`, `0.2` 20% data reporting
- ZIPKIN_SAMPLER_CLASS support `"Zipkin\\Samplers\\BinarySampler"`、`"Zipkin\\Samplers\\PercentageSampler"` `"Zipkin\\Samplers\\BinarySampler"` representative upload all
```bash
ZIPKIN_SAMPLER_CLASS="Zipkin\\Samplers\\PercentageSampler"
ZIPKIN_PERCENTAGE_SAMPLER_RATE=0.2
```

## Flushing Spans

Flush refers to the process of sending all pending spans to the transport. It will also reset the state of the tracer including the active spans and UUID:
Expand Down
4 changes: 3 additions & 1 deletion config/tracing.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Zipkin\Samplers\BinarySampler;

return [

/*
Expand Down Expand Up @@ -97,7 +99,7 @@
'max_tag_len' => 1048576,
'request_timeout' => 5,
],
'sampler_class' => \Zipkin\Samplers\BinarySampler::class,
'sampler_class' => env('ZIPKIN_SAMPLER_CLASS', BinarySampler::class),
'percentage_sampler_rate' => env('ZIPKIN_PERCENTAGE_SAMPLER_RATE', 0.2),
],

Expand Down