danielgtaylor / danielgtaylor/huma
Huma middleware can't access some information comming from the http.Request
- Dominant language
- Go
- Stars
- 4.4k
- Forks
- 285
- Avg merge
- 40m
- Merged PRs (30d)
- 1
Description
I'm in the process of adding opentelemetry support to one of our project that uses huma.
As I want to set the `operationID` that was matched to this request as a span name/attribute I need to make that at the huma middleware. (An router-level middleware wouldn't have this information)
In this middleware I need to crate a new opentelemetry span and then attach some attribute to it that describe the request.
This list of attribute is [standardized](https://opentelemetry.io/docs/specs/semconv/http/http-spans/#http-server-semantic-conventions). There are two attributes that are `required` by the standard and that can't be accessed from a `huma.Context` (unless I missed something)
- Whether or not tls is used for the request
- The http version used for the request (1.0/1.1/2.0...)
In other opentelemetry interceptors & middleware this information is extracted from the [`http.Request`](https://pkg.go.dev/net/http#Request) struct and specifically the `r.TLS`, `r.Proto`, `r.ProtoMajor` and `r.ProtoMinor` fields.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.