opentelemetry-php-contrib icon indicating copy to clipboard operation
opentelemetry-php-contrib copied to clipboard

implement rule-based sampler

Open brettmc opened this issue 1 year ago • 2 comments

Ported rule-based sampler from https://github.com/Nevay/otel-sdk-contrib-sampler

Co-authored-by: Tobias Bachert [email protected]

brettmc avatar Jul 04 '24 11:07 brettmc

Codecov Report

Attention: Patch coverage is 32.14286% with 114 lines in your changes missing coverage. Please review.

Project coverage is 82.68%. Comparing base (727236e) to head (75c26b6). Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
...leBased/src/ComponentProvider/SamplerRuleBased.php 0.00% 28 Missing :warning:
...sed/src/ComponentProvider/SamplingRuleSpanKind.php 0.00% 26 Missing :warning:
...ed/src/ComponentProvider/SamplingRuleAttribute.php 0.00% 20 Missing :warning:
...sed/src/ComponentProvider/SamplingRuleSpanName.php 0.00% 14 Missing :warning:
...leBased/src/ComponentProvider/SamplingRuleLink.php 0.00% 13 Missing :warning:
...Based/src/ComponentProvider/SamplingRuleParent.php 0.00% 13 Missing :warning:
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##               main     #279      +/-   ##
============================================
+ Coverage     82.45%   82.68%   +0.23%     
+ Complexity     1073      948     -125     
============================================
  Files           104       89      -15     
  Lines          4480     3807     -673     
============================================
- Hits           3694     3148     -546     
+ Misses          786      659     -127     
Flag Coverage Δ
Aws 85.75% <ø> (?)
Aws:7.4 ?
Aws:8.0 ?
Aws:8.1 ?
Aws:8.2 ?
Aws:8.3 ?
Context/Swoole 0.00% <ø> (?)
Context/Swoole:7.4 ?
Context/Swoole:8.0 ?
Context/Swoole:8.1 ?
Context/Swoole:8.2 ?
Context/Swoole:8.3 ?
Instrumentation/CakePHP:8.0 ?
Instrumentation/CakePHP:8.1 ?
Instrumentation/CakePHP:8.2 ?
Instrumentation/CakePHP:8.3 ?
Instrumentation/CodeIgniter 73.94% <ø> (?)
Instrumentation/CodeIgniter:8.0 ?
Instrumentation/CodeIgniter:8.1 ?
Instrumentation/CodeIgniter:8.2 ?
Instrumentation/CodeIgniter:8.3 ?
Instrumentation/ExtAmqp 89.58% <ø> (?)
Instrumentation/ExtAmqp:8.2 ?
Instrumentation/ExtAmqp:8.3 ?
Instrumentation/Guzzle 69.73% <ø> (?)
Instrumentation/Guzzle:8.0 ?
Instrumentation/Guzzle:8.1 ?
Instrumentation/Guzzle:8.2 ?
Instrumentation/Guzzle:8.3 ?
Instrumentation/HttpAsyncClient 81.33% <ø> (?)
Instrumentation/HttpAsyncClient:8.0 ?
Instrumentation/HttpAsyncClient:8.1 ?
Instrumentation/HttpAsyncClient:8.2 ?
Instrumentation/HttpAsyncClient:8.3 ?
Instrumentation/IO 70.90% <ø> (?)
Instrumentation/IO:8.2 ?
Instrumentation/IO:8.3 ?
Instrumentation/Laravel:8.0 ?
Instrumentation/Laravel:8.1 ?
Instrumentation/Laravel:8.2 ?
Instrumentation/Laravel:8.3 ?
Instrumentation/MongoDB 77.33% <ø> (?)
Instrumentation/MongoDB:7.4 ?
Instrumentation/MongoDB:8.0 ?
Instrumentation/MongoDB:8.1 ?
Instrumentation/MongoDB:8.2 ?
Instrumentation/MongoDB:8.3 ?
Instrumentation/OpenAIPHP 86.82% <ø> (?)
Instrumentation/OpenAIPHP:8.1 ?
Instrumentation/OpenAIPHP:8.2 ?
Instrumentation/OpenAIPHP:8.3 ?
Instrumentation/PDO 89.56% <ø> (?)
Instrumentation/PDO:8.2 ?
Instrumentation/PDO:8.3 ?
Instrumentation/Psr14 78.12% <ø> (?)
Instrumentation/Psr14:8.0 ?
Instrumentation/Psr14:8.1 ?
Instrumentation/Psr14:8.2 ?
Instrumentation/Psr14:8.3 ?
Instrumentation/Psr15 93.50% <ø> (?)
Instrumentation/Psr15:8.0 ?
Instrumentation/Psr15:8.1 ?
Instrumentation/Psr15:8.2 ?
Instrumentation/Psr15:8.3 ?
Instrumentation/Psr16:8.0 ?
Instrumentation/Psr16:8.1 ?
Instrumentation/Psr16:8.2 ?
Instrumentation/Psr16:8.3 ?
Instrumentation/Psr18 82.08% <ø> (?)
Instrumentation/Psr18:8.0 ?
Instrumentation/Psr18:8.1 ?
Instrumentation/Psr18:8.2 ?
Instrumentation/Psr18:8.3 ?
Instrumentation/Psr3:8.0 ?
Instrumentation/Psr3:8.1 ?
Instrumentation/Psr3:8.2 ?
Instrumentation/Psr3:8.3 ?
Instrumentation/Psr6:8.0 ?
Instrumentation/Psr6:8.1 ?
Instrumentation/Psr6:8.2 ?
Instrumentation/Psr6:8.3 ?
Instrumentation/Slim 86.95% <ø> (?)
Instrumentation/Slim:8.0 ?
Instrumentation/Slim:8.1 ?
Instrumentation/Slim:8.2 ?
Instrumentation/Slim:8.3 ?
Instrumentation/Symfony 89.03% <ø> (?)
Instrumentation/Symfony:8.0 ?
Instrumentation/Symfony:8.1 ?
Instrumentation/Symfony:8.2 ?
Instrumentation/Symfony:8.3 ?
Instrumentation/Yii 77.77% <ø> (?)
Instrumentation/Yii:8.0 ?
Instrumentation/Yii:8.1 ?
Instrumentation/Yii:8.2 ?
Instrumentation/Yii:8.3 ?
Logs/Monolog 100.00% <ø> (?)
Logs/Monolog:7.4 ?
Logs/Monolog:8.0 ?
Logs/Monolog:8.1 ?
Logs/Monolog:8.2 ?
Logs/Monolog:8.3 ?
Propagation/ServerTiming 100.00% <ø> (?)
Propagation/ServerTiming:8.0 ?
Propagation/ServerTiming:8.1 ?
Propagation/ServerTiming:8.2 ?
Propagation/ServerTiming:8.3 ?
Propagation/TraceResponse 100.00% <ø> (?)
Propagation/TraceResponse:7.4 ?
Propagation/TraceResponse:8.0 ?
Propagation/TraceResponse:8.1 ?
Propagation/TraceResponse:8.2 ?
Propagation/TraceResponse:8.3 ?
ResourceDetectors/Azure:7.4 ?
ResourceDetectors/Azure:8.0 ?
ResourceDetectors/Azure:8.1 ?
ResourceDetectors/Azure:8.2 ?
ResourceDetectors/Azure:8.3 ?
ResourceDetectors/Container 93.02% <ø> (?)
ResourceDetectors/Container:8.0 ?
ResourceDetectors/Container:8.1 ?
ResourceDetectors/Container:8.2 ?
ResourceDetectors/Container:8.3 ?
Sampler/RuleBased 32.14% <32.14%> (?)
Shims/OpenTracing 92.99% <ø> (?)
Shims/OpenTracing:7.4 ?
Shims/OpenTracing:8.0 ?
Shims/OpenTracing:8.1 ?
Shims/OpenTracing:8.2 ?
Shims/OpenTracing:8.3 ?
Symfony 88.20% <ø> (?)
Symfony:7.4 ?
Symfony:8.0 ?
Symfony:8.1 ?
Symfony:8.2 ?
Symfony:8.3 ?

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

Files with missing lines Coverage Δ
src/Sampler/RuleBased/src/RuleBasedSampler.php 100.00% <100.00%> (ø)
src/Sampler/RuleBased/src/RuleSet.php 100.00% <100.00%> (ø)
...mpler/RuleBased/src/SamplingRule/AttributeRule.php 100.00% <100.00%> (ø)
...rc/Sampler/RuleBased/src/SamplingRule/LinkRule.php 100.00% <100.00%> (ø)
.../Sampler/RuleBased/src/SamplingRule/ParentRule.php 100.00% <100.00%> (ø)
...ampler/RuleBased/src/SamplingRule/SpanKindRule.php 100.00% <100.00%> (ø)
...ampler/RuleBased/src/SamplingRule/SpanNameRule.php 100.00% <100.00%> (ø)
...leBased/src/ComponentProvider/SamplingRuleLink.php 0.00% <0.00%> (ø)
...Based/src/ComponentProvider/SamplingRuleParent.php 0.00% <0.00%> (ø)
...sed/src/ComponentProvider/SamplingRuleSpanName.php 0.00% <0.00%> (ø)
... and 3 more

... and 33 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 727236e...75c26b6. Read the comment docs.

codecov[bot] avatar Jul 04 '24 11:07 codecov[bot]

I think this is ready for review now, @open-telemetry/php-approvers There's an OTEP which looks like it will eventually specify a rules-based sampler, so to avoid a future config collision I've changed the key for this one to contrib_rule_based (open to improved names, though!)

brettmc avatar Jul 18 '24 07:07 brettmc