Closed icelava closed 2 years ago
Currently this library doesn't have any kind of built-in support for retrieving sampling rules from X-Ray, but it should be possible to retreive them yourself using the AWS PHP SDK (with some form of caching so you don't have to do it on every request) and then call setSampled
on the trace depending on the outcome of applying the rules.
https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-xray-2016-04-12.html#getsamplingrules
There was a previous attempt to add support to this library which unfortunately neither I nor the author had the time to test under a production workload, but you might be able to use it as an example of how to retrieve and apply sampling rules:
Yea that seems to be AWS recommended approach too; use AWS SDK to grab all sampling rules, then apply own custom logic to pick the "preferred". Thanks.
Any idea how to query X-Ray for specific predefined sampling rules?