From 658949519df91e5a08272f54713c8b149e3813cf Mon Sep 17 00:00:00 2001 From: Konstantin Grachev Date: Sun, 24 Jan 2021 00:22:25 +0300 Subject: [PATCH] Sampling --- README.md | 2 +- src/Connection.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a7d9b6..79c89ba 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Features - [ ] Backoff - [ ] TLS - [ ] Snappy -- [ ] Sampling +- [X] Sampling - [ ] AUTH Usage diff --git a/src/Connection.php b/src/Connection.php index 66b03ab..8f610c5 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -47,6 +47,7 @@ abstract class Connection string $hostname = null, string $userAgent = null, int $heartbeatInterval = null, + int $sampleRate = 0, ) { $this->address = $address; @@ -55,6 +56,7 @@ abstract class Connection 'hostname' => $hostname ?? (static fn (mixed $host): string => \is_string($host) ? $host : '')(gethostname()), 'user_agent' => $userAgent ?? 'nsqphp/'.InstalledVersions::getPrettyVersion('nsq/nsq'), 'heartbeat_interval' => $heartbeatInterval, + 'sample_rate' => $sampleRate, ]; $this->logger = $logger ?? new NullLogger();