fix: OTel root span should indicate error status on exceptions (#82212)
For cases when the root span's status returned 500, the span status
returned `OK`.
This results in inaccurate telemetry, as users may expect the span to
indicate an error when a 500 occurs.
Failed CI:
https://github.com/vercel/next.js/actions/runs/16633984270/job/47070403977?pr=82212#step:34:427
Also, the OTel documentation states:
> For HTTP status codes in the 5xx range, as well as any other code the
client failed to interpret, span status SHOULD be set to Error.
x-ref:
https://opentelemetry.io/docs/specs/semconv/http/http-spans/#status
Therefore, set the root span to `Error` when the status is in the 5xx
range.
In addition, as the document states:
> When instrumentation detects such errors it SHOULD set span status to
Error and SHOULD set the error.type attribute.
Added `error.type` attributes to places where sets `Error` span status.
Fixes NEXT-4668