Hive
fix(server): handle streamed Req telemetry results
GitHub issue · Closed
What changed
- Normalized the Req/Finch telemetry
resultvalues inTuist.HTTP.PromExPluginbefore deriving PromEx request tags. - Added focused regressions for streamed Req success and streamed timeout/error result shapes.
Why
Sentry was reporting telemetry handler crashes for outbound job-log requests. The PromEx request tag extractor only handled plain results like {:ok, %Req.Response{}} and {:error, exception}. Req telemetry can also report streamed into results as tuple shapes such as {:ok, {%Req.Request{}, %Req.Response{}}} and {:error, exception, {%Req.Request{}, %Req.Response{}}}.
Because those shapes were not matched, the telemetry handler itself crashed with a CaseClauseError, producing issues like https://tuist.sentry.io/issues/127401699/.
Impact
HTTP request metrics continue to be emitted for the streamed Req cases instead of turning telemetry into a production exception source. Successful streamed responses keep their status tag, and streamed failures keep a sanitized error tag.
Validation
- Added the regression first and reproduced the
CaseClauseErrorlocally. - Ran
mix format lib/tuist/http/prom_ex_plugin.ex test/tuist/http/prom_ex_plugin_test.exs. - Ran
mix test test/tuist/http/prom_ex_plugin_test.exs. - Ran
git diff --check.