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

Define attribute requirement levels #2522

Merged
merged 18 commits into from
May 16, 2022

Conversation

lmolkova
Copy link
Contributor

@lmolkova lmolkova commented May 3, 2022

Extracted general attribute requirement level from #2469

Changes

Adds terminology to be used by semantic convention to declare attribute presence requirements.

We currently have 4 vaguely defined levels across semantic conventions:

  • always - all instrumentations MUST provide

  • conditional which we use to specify when an attribute should be provided (but we use it inconsistently on optional and required attributes)
    e.g. rpc.service is recommended (but not required?)

       required:
         conditional: "No, but recommended"

    or http.retry_count that is optional and conditional

       required:
         conditional: If and only if a request was retried.

    or db.name which is required if available

       required:
         conditional: Required, if applicable.
  • none, which means optional

  • requires explicit enablement (e.g. HTTP headers)

This PR adds and clarifies the terminology:

  • required - MUST provide
  • conditional (naming suggestions are welcome) conditionally required - MUST IF <condition>
  • recommended - SHOULD provide
  • opt-in optional - MAY provide (when enabled)

Here's the corresponding tooling change: open-telemetry/build-tools#92

Related issues #2114.

@reyang reyang added the area:semantic-conventions Related to semantic conventions label May 3, 2022
Copy link
Member

@reyang reyang left a comment

Choose a reason for hiding this comment

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

LGTM.

@Oberon00
Copy link
Member

Oberon00 commented May 5, 2022

Generally looks very sensible to me 👍, my only concern is about the MUST for transforming conditional/recommended into opt-in.

@carlosalberto
Copy link
Contributor

Overall LGTM - let's address @tigrannajaryan concern though. Maybe we can discuss it in today's Spec call?

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.

@lmolkova Thank you for writing this PR. I think this is very important and we need to have it in the spec.

It has a big impact on all conventions and implementations, so please bear with me, I want to make sure the language is clear and precise enough in this section.

I think the PR now reads much better, there are only a few questions remaining that would be great to clarify before merging. Sorry for lots of comments :-)

I would also like to understand what others think about MUST vs SHOULD for the Required level.

specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
@bogdandrutu
Copy link
Member

Summary of the SIG discussion:

  1. The "conditional" level is equivalent of SHOULD;
  2. The "required" level is equivalent of MUST;

Bogdan's feedback:

  1. Find a better name for "conditional";
  2. Almost all current (already defined) "required" semantic conventions are "conditional";
  3. @lmolkova Recommended in RFC 2119 is "SHOULD" and by their definition looks like "conditional" here.
  4. @tigrannajaryan per RFC 2119 REQUIRED == MUST, I do believe that we should not use required everywhere like we do right now, but I would not make the change REQUIRED == SHOULD as suggested.

Bogdan's questions:

  1. If the "summary" is correct, why not using directly the words in RFC 2119?

@tigrannajaryan
Copy link
Member

@tigrannajaryan per RFC 2119 REQUIRED == MUST, I do believe that we should not use required everywhere like we do right now, but I would not make the change REQUIRED == SHOULD as suggested.

Interesting. I didn't know RFC defines "REQUIRED". I agree with this.

Once the new level definitions are accepted we will need to review all existing semantic conventions to make sure we don't unnecessarily use REQUIRED level.

@tigrannajaryan
Copy link
Member

3. @lmolkova Recommended in RFC 2119 is "SHOULD" and by their definition looks like "conditional" here.

I think Conditional is different here because it has a "condition" associated with it.

@lmolkova lmolkova force-pushed the requirement-levels branch 3 times, most recently from 74e24ca to 6f57605 Compare May 11, 2022 03:14
lmolkova added a commit to lmolkova/opentelemetry-specification that referenced this pull request May 11, 2022
@lmolkova
Copy link
Contributor Author

lmolkova commented May 11, 2022

Find a better name for "conditional";

How would everyone feel about Conditionally required?

@bogdandrutu

If the "summary" is correct, why not using directly the words in RFC 2119?

The summary is mostly correct, but not full:

  • Required == MUST is just fine

  • Conditionally required == MUST IF <CONDITION>, not really a SHOULD. If such an attribute is missing, telemetry loses a lot in quality

  • Recommended == SHOULD, unless disabled. Telemetry is mostly fine without it (e.g. http.user_agent could be redundunt on internal calls)

  • Opt-in == SHOULD IF explicitly enabled

Considering these nuances RFC levels would not be descriptive enough.

@lmolkova
Copy link
Contributor Author

lmolkova commented May 11, 2022

Once the new level definitions are accepted we will need to review all existing semantic conventions to make sure we don't unnecessarily use REQUIRED level.

@tigrannajaryan and @bogdandrutu

I went through the existing semantic conventions (ones we have YAML for) and here's what I believe this change would mean for them:
lmolkova@8f53b12 - It would only change the attributes that we currently classify as required conditionally, but they are actually recommended.

We have 26 required: conditional attributes, which are mostly used to:

  • describe constraints.any_of mostly for net.peer.name/ip substitutes
  • skip if default (port, success response, empty string, etc)
  • used with if available/applicable clause: db.name, db.statement (not disabled), net.transport, http.status_code, faas.invoked_region (comes with MUST if), messaging.destination_kind (set topic or queue if any of them)

I believe new terminology does not change semantics for them.

We have 26 required: always attributes and I believe they are safe to keep, the details:

  • comes a lot on static things: os.type, service.name - also has MUST in desription, webengine_resource.name, db.system, messaging.system, rpc.system
  • things defined in other specs: http.method, rpc.method, cloudevents.<many> (required in the CloudEvent spec)
  • Specific implementations that can confidently require things: db.mongodb.collection, messaging.rocketmq has also a few required fields
  • faas:

So I believe this is a pretty minor change for current conventions and we already have good classification there, just some lack of terminology.

@bogdandrutu
Copy link
Member

bogdandrutu commented May 11, 2022

Required == MUST is just fine

+1

Conditionally Required == MUST IF , not really a SHOULD. If such an attribute is missing, telemetry loses a lot in quality

+1 I like the name.

Recommended == SHOULD, unless disabled. Telemetry is mostly fine without it (e.g. http.user_agent could be redundunt on internal calls)
Opt-in == SHOULD IF explicitly enabled

The RFC defines "recommended" as "should", without any caveat like "unless disabled". Are we mixing 2 "dimensions" here: 1. for devs to make enough effort to make these available in the instrumentation; 2. the capability for users of enabling/disabling these?

I would actually consider to change "Opt-In" to "OPTIONAL", and say that instrumentation plugins must offers way to "opt-out" for any recommended attributes, and to "opt-in' for any available "optional" attributes. the required and conditional required cannot be disabled, this way we separate the 2 concerns about what is available and what is configurable for the user.

Considering these nuances RFC levels would not be descriptive enough.

I agree, but I would use references to RFC when explain them, since is easier to understand.

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.

LGTM, great job.
I left some minor spelling comments.

specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
specification/common/attribute-requirement-level.md Outdated Show resolved Hide resolved
Co-authored-by: Christian Neumüller <[email protected]>
@tigrannajaryan
Copy link
Member

@lmolkova please resolve the conflicts.

@lmolkova
Copy link
Contributor Author

@tigrannajaryan done, thank you!

Copy link
Contributor

@jamesmoessis jamesmoessis left a comment

Choose a reason for hiding this comment

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

This is super valuable work, thankyou for getting this through!

@bogdandrutu bogdandrutu merged commit e6352b4 into open-telemetry:main May 16, 2022
beeme1mr pushed a commit to beeme1mr/opentelemetry-specification that referenced this pull request Aug 31, 2022
* nits

* review comments

* No exceptions for Required attributes, clarifications on performance

* Conditional clarifications

* nits

* Conditional -> required conditionally and minor fixes

* Align requirement levels with RFC levels better

* Clarify Note on required attributes

* Update specification/common/attribute-requirement-level.md

Co-authored-by: Tigran Najaryan <[email protected]>

* Clarify Note on required attributes

* Remove performance from conditionally required attributes

* Clarify Conditionally Required case when condition is false

* Apply suggestions from code review

Co-authored-by: Tigran Najaryan <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christian Neumüller <[email protected]>

* headings for levels and moving things around

* nits: formatting

Co-authored-by: Tigran Najaryan <[email protected]>
Co-authored-by: Christian Neumüller <[email protected]>
Co-authored-by: Reiley Yang <[email protected]>
carlosalberto pushed a commit to carlosalberto/opentelemetry-specification that referenced this pull request Oct 31, 2024
* nits

* review comments

* No exceptions for Required attributes, clarifications on performance

* Conditional clarifications

* nits

* Conditional -> required conditionally and minor fixes

* Align requirement levels with RFC levels better

* Clarify Note on required attributes

* Update specification/common/attribute-requirement-level.md

Co-authored-by: Tigran Najaryan <[email protected]>

* Clarify Note on required attributes

* Remove performance from conditionally required attributes

* Clarify Conditionally Required case when condition is false

* Apply suggestions from code review

Co-authored-by: Tigran Najaryan <[email protected]>

* Apply suggestions from code review

Co-authored-by: Christian Neumüller <[email protected]>

* headings for levels and moving things around

* nits: formatting

Co-authored-by: Tigran Najaryan <[email protected]>
Co-authored-by: Christian Neumüller <[email protected]>
Co-authored-by: Reiley Yang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:semantic-conventions Related to semantic conventions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants