When consulting semantic conventions and the documentation generated from it, especially for metrics, I often find myself asking which attributes I can rely on to be present (which ones are "required"). For me, that's a much more common use case than looking for a single attribute by name.
Therefore I suggest to change the ordering of generated attribute tables to order by requirement level: required attributes first, then conditionally required ones, recommended ones, and opt-ins. Find below an example of how that would look for http.server.request.duration attributes.
If there's consensus about this, I could implement the necessary changes in the build tools.
Example
| Attribute |
Type |
Description |
Examples |
Requirement Level |
http.request.method |
string |
HTTP request method. [1] |
GET; POST; HEAD |
Required |
url.scheme |
string |
The URI scheme component identifying the used protocol. [2] |
http; https |
Required |
error.type |
string |
Describes a class of error the operation ended with. [3] |
timeout; java.net.UnknownHostException; server_certificate_invalid; 500 |
Conditionally Required: If request has ended with an error. |
http.response.status_code |
int |
HTTP response status code. |
200 |
Conditionally Required: If and only if one was received/sent. |
http.route |
string |
The matched route, that is, the path template in the format used by the respective server framework. [4] |
/users/:userID?; {controller}/{action}/{id?} |
Conditionally Required: If and only if it's available |
network.protocol.name |
string |
OSI application layer or non-OSI equivalent. [5] |
http; spdy |
Conditionally Required: [6] |
network.protocol.version |
string |
Version of the protocol specified in network.protocol.name. [7] |
1.0; 1.1; 2; 3 |
Recommended |
server.address |
string |
Name of the local HTTP server that received the request. [8] |
example.com; 10.1.2.80; /tmp/my.sock |
Opt-In |
server.port |
int |
Port of the local HTTP server that received the request. [9] |
80; 8080; 443 |
Opt-In |
When consulting semantic conventions and the documentation generated from it, especially for metrics, I often find myself asking which attributes I can rely on to be present (which ones are "required"). For me, that's a much more common use case than looking for a single attribute by name.
Therefore I suggest to change the ordering of generated attribute tables to order by requirement level: required attributes first, then conditionally required ones, recommended ones, and opt-ins. Find below an example of how that would look for
http.server.request.durationattributes.If there's consensus about this, I could implement the necessary changes in the build tools.
Example
http.request.methodGET;POST;HEADurl.schemehttp;httpserror.typetimeout;java.net.UnknownHostException;server_certificate_invalid;500http.response.status_code200http.route/users/:userID?;{controller}/{action}/{id?}network.protocol.namehttp;spdynetwork.protocol.versionnetwork.protocol.name. [7]1.0;1.1;2;3server.addressexample.com;10.1.2.80;/tmp/my.sockserver.port80;8080;443