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

Give guideline of not using unit names in attributes (#1053) #1307

Closed
wants to merge 1 commit into from

Conversation

alexvanboxel
Copy link

Add a paragraph in the attribute name guidelines that discourage the use
of unit names and prefixes.

Add note about historical naming violation in messaging.md, the attribute names
message_payload_size_bytes and message_payload_compressed_size_bytes about the
incorrect use of bytes in the name.

Fixes #1053

Changes

Please provide a brief description of the changes here. Update the
CHANGELOG.md for non-trivial changes. If CHANGELOG.md is updated,
also be sure to update spec-compliance-matrix.md if necessary.

Related issues #

Related oteps #

specification/common/attribute-and-label-naming.md Outdated Show resolved Hide resolved
- Names should not contain unit names, and their values should be measured in the
smallest practical unit size. For example, `http.request_content_length` does not
have bytes in its name and uses the smallest unit size: byte. If the smallest
unit is a fraction, the prefix is not part of the name.
Copy link
Member

Choose a reason for hiding this comment

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

I think you need an example here. Would this mean that we use execution_time instead of execution_time_nanos?.

Copy link
Author

Choose a reason for hiding this comment

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

I've been going over all the attributes defined in the spec and none mention the unit fraction. The only attribute that uses the unit name is message_payload_size_bytes. So yes, I think having execution_time would be more consistent with the rest of the attributes.

@@ -49,6 +49,11 @@ Names SHOULD follow these rules:
name prohibits existence of an equally named namespace in the future, and vice
versa: any existing namespace prohibits existence of an equally named
attribute or label key in the future.

- Names should not contain unit names, and their values should be measured in the
Copy link
Member

Choose a reason for hiding this comment

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

What is the justification for that vs they should always contain unit names?

Copy link
Author

Choose a reason for hiding this comment

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

Having the unit names in the attribute names would in most cases redundant. Example execution_time would be silly to have seconds in the name. The same for message_payload_size_bytes, the fact that it's bytes is redundant information.

We could discuss the fraction names (nanos, MiB, ...) separately: here it's about the fact that it's not used in any of the attributes yet.

Copy link
Member

Choose a reason for hiding this comment

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

This change is reasonable for metric names which support units natively. Span or log attributes have no such support. I don't think this is a good blanket recommendation for all cases. There may be cases when units are ambiguous. In the example given execution_time it is not obvious to me that the execution time should be in seconds. Why would I assume that? Why not milliseconds?

Copy link
Member

Choose a reason for hiding this comment

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

I think it would make sense to require all spec semantic conventions to always use nanoseconds for any timespans. That way it would be unambiguous.

Copy link
Author

Choose a reason for hiding this comment

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

I reworded the wording not to talk about the smallest practical unit, just to focus on the naming. Talking about this could be interesting, but I propose that someone takes this out of the scope of this PR.

@github-actions
Copy link

github-actions bot commented Jan 6, 2021

This PR was marked stale due to lack of activity. It will be closed in 7 days.

…1053)

Add a paragraph in the attribute name guidelines that discourage the use
of unit names and prefixes.

Add note about historical naming violation in messaging.md, the attribute names
message_payload_size_bytes and message_payload_compressed_size_bytes about the
incorrect use of bytes in the name.
Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

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

@alexvanboxel sorry, I am not convinced that this change is an improvement for Spans. For metrics, sure, I completely agree, it is wrong to have units in the names. For span attributes, I disagree.
I would be fine to merge a change like this if it applied only to metric names. As-is it applies to spans too so I am blocking it until we figure this out (I am willing to be convinced).

@alexvanboxel
Copy link
Author

@alexvanboxel sorry, I am not convinced that this change is an improvement for Spans. For metrics, sure, I completely agree, it is wrong to have units in the names. For span attributes, I disagree.
I would be fine to merge a change like this if it applied only to metric names. As-is it applies to spans too so I am blocking it until we figure this out (I am willing to be convinced).

are you opposed to units (ex. bytes) or fractions (ex. nano, milli, ...) or both?

@tigrannajaryan
Copy link
Member

are you opposed to units (ex. bytes) or fractions (ex. nano, milli, ...) or both?

I am opposed to the blanket requirement which says we cannot have units in attribute names. I think there are valid cases when it is useful to have units in span attribute names, because not having the unit in the name makes the value ambiguous. For example execution_time attribute does not convey in any way whether the attribute value is in seconds or maybe milliseconds? How would the recipient of such attribute know?

@@ -181,6 +181,8 @@ For batch receiving and processing (see the [Batch receiving](#batch-receiving)
Even though in that case one might think that the processing span's kind should be `INTERNAL`, that kind MUST NOT be used.
Instead span kind should be set to either `CONSUMER` or `SERVER` according to the rules defined above.

**Note:** The payload size names (`message_payload_compressed_size_bytes` and `message_payload_size_bytes`) don't comply with the [Attribute and Label Naming](../../common/attribute-and-label-naming.md), it should not contain `bytes`. This is due to historical reasons.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we change this spec?

@github-actions github-actions bot removed the Stale label Jan 14, 2021
@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jan 21, 2021
@alexvanboxel
Copy link
Author

are you opposed to units (ex. bytes) or fractions (ex. nano, milli, ...) or both?

I am opposed to the blanket requirement which says we cannot have units in attribute names. I think there are valid cases when it is useful to have units in span attribute names, because not having the unit in the name makes the value ambiguous. For example execution_time attribute does not convey in any way whether the attribute value is in seconds or maybe milliseconds? How would the recipient of such attribute know?

I'm fine with dropping this PR if no consensus can be reached. I like to have consistency, and this PR only resulted from the issue I created. Do we drop this PR?

@github-actions github-actions bot removed the Stale label Jan 22, 2021
@carlosalberto
Copy link
Contributor

@alexvanboxel For metrics it looks right IMHO, so worth considering going metrics-only from here.

Base automatically changed from master to main January 27, 2021 21:16
@github-actions
Copy link

github-actions bot commented Feb 4, 2021

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Feb 4, 2021
@github-actions
Copy link

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Feb 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Trace payload/message size in semantic convention is inconsistent
6 participants