Skip to content

Commit

Permalink
A couple of code tidies left over from PR #1499
Browse files Browse the repository at this point in the history
  • Loading branch information
spadger committed Feb 5, 2025
1 parent 31d902b commit 904d76a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Contrib/Grpc/GrpcTransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use InvalidArgumentException;
use function json_encode;
use OpenTelemetry\API\Behavior\LogsMessagesTrait;
use OpenTelemetry\API\Common\Time\ClockInterface;
use OpenTelemetry\Contrib\Otlp\ContentTypes;
use OpenTelemetry\SDK\Common\Export\TransportFactoryInterface;
use OpenTelemetry\SDK\Common\Export\TransportInterface;
Expand Down Expand Up @@ -62,7 +63,7 @@ public function create(
throw new InvalidArgumentException(sprintf('Endpoint path is not a valid GRPC method "%s"', $method));
}

$opts = self::createOpts($compression, $timeout, $maxRetries, $retryDelay);
$opts = self::createOpts($compression, $maxRetries, $retryDelay);
/** @psalm-suppress PossiblyNullArgument */
$opts['credentials'] = $scheme === 'http'
? ChannelCredentials::createInsecure()
Expand All @@ -81,13 +82,12 @@ public function create(
$opts,
$method,
$headers,
(int) ($timeout * 1000),
(int) ($timeout * ClockInterface::MILLIS_PER_SECOND),
);
}

private static function createOpts(
$compression,
float $timeout,
int $maxRetries,
int $retryDelay,
): array {
Expand Down Expand Up @@ -119,8 +119,8 @@ private static function createOpts(
],
'retryPolicy' => [
'maxAttempts' => $maxRetries,
'initialBackoff' => sprintf('%0.3fs', $retryDelay / 1000),
'maxBackoff' => sprintf('%0.3fs', ($retryDelay << $maxRetries - 1) / 1000),
'initialBackoff' => sprintf('%0.3fs', $retryDelay / ClockInterface::MILLIS_PER_SECOND),
'maxBackoff' => sprintf('%0.3fs', ($retryDelay << $maxRetries - 1) / ClockInterface::MILLIS_PER_SECOND),
'backoffMultiplier' => 2,
'retryableStatusCodes' => [
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md#otlpgrpc-response
Expand Down

0 comments on commit 904d76a

Please sign in to comment.