Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦 sorry, just realised that this causes a dependency on API 1.2.1 (see here).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh, yeah. Let's create a local const in GrpcTransportFactory for now.

);
}

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
Loading