From b227621467c23d0b9f49cc81b76b77a9f0a32917 Mon Sep 17 00:00:00 2001 From: Johannes Tax Date: Tue, 12 Mar 2024 09:58:06 +0100 Subject: [PATCH] Fix default requirement level --- .../opentelemetry/semconv/model/semantic_convention.py | 8 +++++--- .../src/tests/data/markdown/include/expected.md | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py index b57e63ce..7a8adf15 100644 --- a/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py +++ b/semantic-conventions/src/opentelemetry/semconv/model/semantic_convention.py @@ -134,9 +134,11 @@ def _get_attributes(self, templates: Optional[bool]): or templates == AttributeType.is_template_type(attr.attr_type) ], key=lambda attr: ( - attr.requirement_level.value - if attr.requirement_level - else RequirementLevel.OPT_IN.value, + ( + attr.requirement_level.value + if attr.requirement_level + else RequirementLevel.RECOMMENDED.value + ), attr.fqn, ), ) diff --git a/semantic-conventions/src/tests/data/markdown/include/expected.md b/semantic-conventions/src/tests/data/markdown/include/expected.md index 8456ec95..07f90935 100644 --- a/semantic-conventions/src/tests/data/markdown/include/expected.md +++ b/semantic-conventions/src/tests/data/markdown/include/expected.md @@ -7,15 +7,15 @@ | `http.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | `Required` | | [`http.server_name`](input_http.md) | string | The primary server name of the matched virtual host. [1] | `example.com` | `Conditionally Required` [2] | | `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | `Conditionally Required` if and only if one was received/sent | -| `http.recommended_attribute` | string | brief | `foo` | `Recommended` short note | -| `http.recommended_attribute_long_note` | string | brief | `bar` | `Recommended` [3] | -| `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | `Recommended` | | `faas.execution` | string | The execution id of the current function execution. | `af9d5aa4-a685-4c5f-a22b-444f80b3cc28` | `Recommended` | | `http.host` | string | The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is empty or not present, this attribute should be the same. | `www.example.org` | See below | +| `http.recommended_attribute` | string | brief | `foo` | `Recommended` short note | +| `http.recommended_attribute_long_note` | string | brief | `bar` | `Recommended` [3] | | `http.scheme` | string | The URI scheme identifying the used protocol. | `http`; `https` | See below | | `http.status_text` | string | [HTTP reason phrase](https://tools.ietf.org/html/rfc7230#section-3.1.2). | `OK` | `Recommended` | | `http.target` | string | The full request target as passed in a HTTP request line or equivalent. | `/path/12314/?q=ddds#123` | See below | | `http.url` | string | Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. | `https://www.foo.bar/search?q=OpenTelemetry#SemConv` | See below | +| `http.user_agent` | string | Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | `Recommended` | **[1]:** This is an example