Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add http.connection.protocol_error_code to connection duration metric #1135

Open
JamesNK opened this issue Jun 10, 2024 · 1 comment
Open
Labels
area:http enhancement New feature or request

Comments

@JamesNK
Copy link
Contributor

JamesNK commented Jun 10, 2024

Area(s)

No response

Is your change request related to a problem? Please describe.

HTTP/2 and HTTP/3 define protocol error codes that are used when ending a HTTP connection.

These codes are often - but not always - sent over the wire when a HTTP connection is ending gracefully or with an error. They can have useful information that explains why a connection was closed. They're basically the connection version of HTTP status code.

Describe the solution you'd like

Add a tag to client/server HTTP connection duration metrics that has this value.

Value would be an unsigned integer. HTTP/2 value can be up to 32 bits and HTTP/3 value can be up to 64 bits. To support both values, the tag definition should say its value in an unsigned 64 bit integer.

Although HTTP/2 and HTTP/3 have predefined values for the code, I think it should be a number like the HTTP status code. In it's possible to send an error code that isn't predefined, although it's not recommended.

The tags is omitted if the value is NO_ERROR (http/2) or H3_NO_ERROR (http/3)

Describe alternatives you've considered

The value could be put in error.type. I prefer having a different tag value because the server or client might want to supply the internal error reason in the error.type field, while it is still useful to know the protocol error code value that was sent to the peer.

Additional context

No response

@JamesNK JamesNK added enhancement New feature or request triage:needs-triage labels Jun 10, 2024
@JamesNK JamesNK changed the title Add http.connection.protocol_code to connection duration metric Add http.connection.protocol_error_code to connection duration metric Jun 10, 2024
@lmolkova
Copy link
Contributor

lmolkova commented Jun 17, 2024

Having a domain-specific attribute along with error.type would be right by design:

If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes),
it's RECOMMENDED to:
- Use a domain-specific attribute
- Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not.

The only suggestion I have is to call it http.connection.protocol.error_code (in case there will be more things in protocol) or http.protocol.error_code (for brevity and because these errors codes seem to apply to streams as well as connections).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:http enhancement New feature or request
Projects
Development

No branches or pull requests

4 participants