1212use InvalidArgumentException ;
1313use function json_encode ;
1414use OpenTelemetry \API \Behavior \LogsMessagesTrait ;
15+ use OpenTelemetry \API \Common \Time \ClockInterface ;
1516use OpenTelemetry \Contrib \Otlp \ContentTypes ;
1617use OpenTelemetry \SDK \Common \Export \TransportFactoryInterface ;
1718use 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