-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Since #12768, when multiple export requests are batched together, the Context passed to the exporter has no Done() signal or Deadline(): it's just a context.Background with some extra data, which will never be cancelled.
The previous behavior was to cancel a batch when any input context was canceled, which has questionable semantics. However, it would still be good to respect the timeouts of the original requests in some way.
Because combining the Done() signals of the input contexts would be messy, the suggestion is to ignore them, and only take into account Deadline(). The idea would be to apply a timeout to the newly created context with context.WithDeadline(), computed as the maximum of all incoming deadlines. If none of the input contexts has deadlines, this would not be applied.
If some, but not all input contexts have a deadline, it has been suggested to apply the deadline anyway, to avoid penalizing requests with timeouts, which are meant to become the norm.
This deadline should naturally combine with the one imposed by the timeout_sender (ie. the effective deadline will be the minimum of the two).