Skip to content

Commit 5d24db8

Browse files
authored
A couple of code tidies left over from PR #1499 (#1502)
1 parent 31d902b commit 5d24db8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Contrib/Grpc/GrpcTransportFactory.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use InvalidArgumentException;
1313
use function json_encode;
1414
use OpenTelemetry\API\Behavior\LogsMessagesTrait;
15+
use OpenTelemetry\API\Common\Time\ClockInterface;
1516
use OpenTelemetry\Contrib\Otlp\ContentTypes;
1617
use OpenTelemetry\SDK\Common\Export\TransportFactoryInterface;
1718
use OpenTelemetry\SDK\Common\Export\TransportInterface;
@@ -62,7 +63,7 @@ public function create(
6263
throw new InvalidArgumentException(sprintf('Endpoint path is not a valid GRPC method "%s"', $method));
6364
}
6465

65-
$opts = self::createOpts($compression, $timeout, $maxRetries, $retryDelay);
66+
$opts = self::createOpts($compression, $maxRetries, $retryDelay);
6667
/** @psalm-suppress PossiblyNullArgument */
6768
$opts['credentials'] = $scheme === 'http'
6869
? ChannelCredentials::createInsecure()
@@ -81,13 +82,12 @@ public function create(
8182
$opts,
8283
$method,
8384
$headers,
84-
(int) ($timeout * 1000),
85+
(int) ($timeout * ClockInterface::MILLIS_PER_SECOND),
8586
);
8687
}
8788

8889
private static function createOpts(
8990
$compression,
90-
float $timeout,
9191
int $maxRetries,
9292
int $retryDelay,
9393
): array {
@@ -119,8 +119,8 @@ private static function createOpts(
119119
],
120120
'retryPolicy' => [
121121
'maxAttempts' => $maxRetries,
122-
'initialBackoff' => sprintf('%0.3fs', $retryDelay / 1000),
123-
'maxBackoff' => sprintf('%0.3fs', ($retryDelay << $maxRetries - 1) / 1000),
122+
'initialBackoff' => sprintf('%0.3fs', $retryDelay / ClockInterface::MILLIS_PER_SECOND),
123+
'maxBackoff' => sprintf('%0.3fs', ($retryDelay << $maxRetries - 1) / ClockInterface::MILLIS_PER_SECOND),
124124
'backoffMultiplier' => 2,
125125
'retryableStatusCodes' => [
126126
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#otlpgrpc-response

0 commit comments

Comments
 (0)