Skip to content

Commit

Permalink
Align HTTP metric exporter timeout with other exporters
Browse files Browse the repository at this point in the history
It's desirable to have a common API across all exporters.

Since the previously existing timeout_millis argument wasn't used
anyways, it should not be an issue to change the default value here.

The None case will fall back to the object level timeout, which is
the same as the previous default argument value.
  • Loading branch information
LarsMichelsen committed Aug 29, 2024
1 parent 9fc19c3 commit 65a7215
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def _retryable(resp: requests.Response) -> bool:
def export(
self,
metrics_data: MetricsData,
timeout_millis: float = 10_000,
timeout_millis: Optional[float] = None,
**kwargs,
) -> MetricExportResult:
if self._shutdown:
Expand All @@ -225,7 +225,10 @@ def export(

serialized_data = encode_metrics(metrics_data)
return self._exporter.export_with_retry(
serialized_data.SerializeToString()
serialized_data.SerializeToString(),
timeout_sec=(
timeout_millis / 1000 if timeout_millis is not None else None
),
)

def shutdown(self, timeout_millis: float = 30_000, **kwargs) -> None:
Expand Down

0 comments on commit 65a7215

Please sign in to comment.