diff --git a/README.md b/README.md index 74c1b02..ad4de43 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/config/tracing.php b/config/tracing.php index 9a365e4..26f7d60 100644 --- a/config/tracing.php +++ b/config/tracing.php @@ -1,5 +1,7 @@ 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), ],