This commit is contained in:
2021-01-24 00:22:25 +03:00
parent 8d03980177
commit 658949519d
2 changed files with 3 additions and 1 deletions

View File

@ -35,7 +35,7 @@ Features
- [ ] Backoff - [ ] Backoff
- [ ] TLS - [ ] TLS
- [ ] Snappy - [ ] Snappy
- [ ] Sampling - [X] Sampling
- [ ] AUTH - [ ] AUTH
Usage Usage

View File

@ -47,6 +47,7 @@ abstract class Connection
string $hostname = null, string $hostname = null,
string $userAgent = null, string $userAgent = null,
int $heartbeatInterval = null, int $heartbeatInterval = null,
int $sampleRate = 0,
) { ) {
$this->address = $address; $this->address = $address;
@ -55,6 +56,7 @@ abstract class Connection
'hostname' => $hostname ?? (static fn (mixed $host): string => \is_string($host) ? $host : '')(gethostname()), 'hostname' => $hostname ?? (static fn (mixed $host): string => \is_string($host) ? $host : '')(gethostname()),
'user_agent' => $userAgent ?? 'nsqphp/'.InstalledVersions::getPrettyVersion('nsq/nsq'), 'user_agent' => $userAgent ?? 'nsqphp/'.InstalledVersions::getPrettyVersion('nsq/nsq'),
'heartbeat_interval' => $heartbeatInterval, 'heartbeat_interval' => $heartbeatInterval,
'sample_rate' => $sampleRate,
]; ];
$this->logger = $logger ?? new NullLogger(); $this->logger = $logger ?? new NullLogger();