Skip to content

Sort attribute tables by requirement level and attribute name#260

Merged
lmolkova merged 13 commits into
open-telemetry:mainfrom
pyohannes:sort-by-req-level
Mar 13, 2024
Merged

Sort attribute tables by requirement level and attribute name#260
lmolkova merged 13 commits into
open-telemetry:mainfrom
pyohannes:sort-by-req-level

Conversation

@pyohannes
Copy link
Copy Markdown
Contributor

Fixes open-telemetry/semantic-conventions#614

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.

This changes the ordering of generated attribute tables to order by requirement level: required attributes first, then conditionally required ones, recommended ones, and opt-ins. Especially for metrics, looking for required attributes is a more common use case than looking attributes up by name.

Example

That's how this would look for http.server.request.duration attributes:

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

Copy link
Copy Markdown
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

(please add a changelog entry)

Comment thread semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py Outdated
@lmolkova lmolkova force-pushed the sort-by-req-level branch from a23a9aa to 3e64191 Compare March 13, 2024 19:45
@lmolkova
Copy link
Copy Markdown
Member

There was a bunch of new merge conflicts - I resolved them. Keeping it open a bit longer in case anyone wants to take a look.

@pyohannes
Copy link
Copy Markdown
Contributor Author

There was a bunch of new merge conflicts - I resolved them. Keeping it open a bit longer in case anyone wants to take a look.

@lmolkova Looks good to me.

@lmolkova lmolkova merged commit 472bedb into open-telemetry:main Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Order attributes in generated tables by requirement level

3 participants