Skip to content

Commit

Permalink
Rename Optional requirement level to Opt-In
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Feb 17, 2023
1 parent 6baebe9 commit 85d73c9
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions semantic-conventions/semconv.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@
{
"properties": {
"requirement_level": {
"description": "specifies the attribute requirement level. Can be 'required', 'conditionally_required', 'recommended', or 'optional'. When omitted, the attribute is 'recommended'. When set to 'conditionally_required', the string provided as <condition> MUST specify the conditions under which the attribute is required.",
"description": "specifies the attribute requirement level. Can be 'required', 'conditionally_required', 'recommended', or 'opt_in'. When omitted, the attribute is 'recommended'. When set to 'conditionally_required', the string provided as <condition> MUST specify the conditions under which the attribute is required.",
"oneOf": [
{
"const": "required"
Expand Down Expand Up @@ -378,7 +378,7 @@
]
},
{
"const": "optional"
"const": "opt_in"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class RequirementLevel(Enum):
REQUIRED = 1
CONDITIONALLY_REQUIRED = 2
RECOMMENDED = 3
OPTIONAL = 4
OPT_IN = 4


class StabilityLevel(Enum):
Expand Down Expand Up @@ -137,7 +137,7 @@ def parse(
"required": RequirementLevel.REQUIRED,
"conditionally_required": RequirementLevel.CONDITIONALLY_REQUIRED,
"recommended": RequirementLevel.RECOMMENDED,
"optional": RequirementLevel.OPTIONAL,
"opt_in": RequirementLevel.OPT_IN,
}
requirement_level_msg = ""
requirement_level_val = attribute.get("requirement_level", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ def to_markdown_attr(
# We put the condition in the notes after the table
self.render_ctx.add_note(attribute.requirement_level_msg)
required = f"Conditionally Required: [{ len(self.render_ctx.notes)}]"
elif attribute.requirement_level == RequirementLevel.OPTIONAL:
required = "Optional"
elif attribute.requirement_level == RequirementLevel.OPT_IN:
required = "Opt-In"
else: # attribute.requirement_level == Required.RECOMMENDED or None
# check if there are any notes
if (
Expand Down
2 changes: 1 addition & 1 deletion semantic-conventions/src/tests/data/markdown/ref/rpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ groups:
requirement_level: required
brief: 'It describes the server port the client is connecting to'
- ref: net.peer.name
requirement_level: optional
requirement_level: opt_in
brief: override brief.
note: override note.
- ref: net.sock.peer.addr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ groups:
type: boolean
brief: 'test'
requirement_level: required
requirement_level: optional
requirement_level: opt_in
examples: [true, false]
2 changes: 1 addition & 1 deletion semantic-conventions/src/tests/data/yaml/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ groups:
unit: "{cartons}"
attributes:
- ref: http.method
requirement_level: optional
requirement_level: opt_in
- ref: bar.egg.type
requirement_level:
conditionally_required: "if available to instrumentation."
4 changes: 2 additions & 2 deletions semantic-conventions/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ member ::= id value [brief] [note]
requirement_level ::= "required"
| "conditionally_required" <condition>
| "recommended" [condition] # Default if not specified
| "optional"
| "opt_in"
# EXPERIMENTAL: Using this is NOT ALLOWED in the specification currently.
sampling_relevant ::= boolean
Expand Down Expand Up @@ -231,7 +231,7 @@ An attribute is defined by:
It carries no particular semantic meaning but can be used e.g. for filtering
in the markdown generator.
- `requirement_level`, optional, specifies if the attribute is mandatory.
Can be "required", "conditionally_required", "recommended" or "optional". When omitted, the attribute is "recommended".
Can be "required", "conditionally_required", "recommended" or "opt_in". When omitted, the attribute is "recommended".
When set to "conditionally_required", the string provided as `<condition>` MUST specify
the conditions under which the attribute is required.
- `sampling_relevant`, optional EXPERIMENTAL boolean,
Expand Down

0 comments on commit 85d73c9

Please sign in to comment.