Skip to content

Support client-side per-record sampling #45

@tgr

Description

@tgr

Currently StatsdService is the only way to actually perform sampling (short of doing it manually), and it does not allow setting different sampling rates for different keys. Something like

$statsdService->increment('foo')->setSampleRate(0.01);

looks valid but actually will only account for the sampling on the server side, not the client side, since the client-side sampling check happens inside increment. IMO StatsdClient::send() would be a more reasonable place to perform the client-side sampling. (Also, setting the sample rate both in StatsdData and StatsdService will result in the latter overriding the former, which is counterintuitive; and setting the sample rate in StatsdData and also using the $sampleRate parameter of StatsdClient::send() will result in a malformed message with two sampling rates. The nice thing to do would be to rename $sampleRate to $defaultSampleRate and the StatsdService field similarly, and have the StatsdData value always override the others.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions