diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py index f579043768..2c3c4e712b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py @@ -15,8 +15,6 @@ from enum import Enum -from deprecated import deprecated - DB_CASSANDRA_CONSISTENCY_LEVEL = "db.cassandra.consistency_level" """ The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). @@ -214,16 +212,6 @@ Deprecated: No replacement at this time. """ -POOL_NAME = "pool.name" -""" -Deprecated: Replaced by `db.client.connections.pool.name`. -""" - -STATE = "state" -""" -Deprecated: Replaced by `db.client.connections.state`. -""" - class DbCassandraConsistencyLevelValues(Enum): ALL = "all" @@ -402,13 +390,3 @@ class DbSystemValues(Enum): """Cloud Spanner.""" TRINO = "trino" """Trino.""" - - -@deprecated( - reason="The attribute state is deprecated - Replaced by `db.client.connections.state`" -) -class StateValues(Enum): - IDLE = "idle" - """idle.""" - USED = "used" - """used.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/message_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/message_attributes.py new file mode 100644 index 0000000000..db06400591 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/message_attributes.py @@ -0,0 +1,48 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from enum import Enum + +from deprecated import deprecated + +MESSAGE_COMPRESSED_SIZE = "message.compressed_size" +""" +Deprecated: Replaced by `rpc.message.compressed_size`. +""" + +MESSAGE_ID = "message.id" +""" +Deprecated: Replaced by `rpc.message.id`. +""" + +MESSAGE_TYPE = "message.type" +""" +Deprecated: Replaced by `rpc.message.type`. +""" + +MESSAGE_UNCOMPRESSED_SIZE = "message.uncompressed_size" +""" +Deprecated: Replaced by `rpc.message.uncompressed_size`. +""" + + +@deprecated( + reason="The attribute message.type is deprecated - Replaced by `rpc.message.type`" +) +class MessageTypeValues(Enum): + SENT = "SENT" + """sent.""" + RECEIVED = "RECEIVED" + """received.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/net_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/net_attributes.py new file mode 100644 index 0000000000..de0b17da01 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/net_attributes.py @@ -0,0 +1,121 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from enum import Enum + +from deprecated import deprecated + +NET_HOST_IP = "net.host.ip" +""" +Deprecated: Replaced by `network.local.address`. +""" + +NET_HOST_NAME = "net.host.name" +""" +Deprecated: Replaced by `server.address`. +""" + +NET_HOST_PORT = "net.host.port" +""" +Deprecated: Replaced by `server.port`. +""" + +NET_PEER_IP = "net.peer.ip" +""" +Deprecated: Replaced by `network.peer.address`. +""" + +NET_PEER_NAME = "net.peer.name" +""" +Deprecated: Replaced by `server.address` on client spans and `client.address` on server spans. +""" + +NET_PEER_PORT = "net.peer.port" +""" +Deprecated: Replaced by `server.port` on client spans and `client.port` on server spans. +""" + +NET_PROTOCOL_NAME = "net.protocol.name" +""" +Deprecated: Replaced by `network.protocol.name`. +""" + +NET_PROTOCOL_VERSION = "net.protocol.version" +""" +Deprecated: Replaced by `network.protocol.version`. +""" + +NET_SOCK_FAMILY = "net.sock.family" +""" +Deprecated: Split to `network.transport` and `network.type`. +""" + +NET_SOCK_HOST_ADDR = "net.sock.host.addr" +""" +Deprecated: Replaced by `network.local.address`. +""" + +NET_SOCK_HOST_PORT = "net.sock.host.port" +""" +Deprecated: Replaced by `network.local.port`. +""" + +NET_SOCK_PEER_ADDR = "net.sock.peer.addr" +""" +Deprecated: Replaced by `network.peer.address`. +""" + +NET_SOCK_PEER_NAME = "net.sock.peer.name" +""" +Deprecated: Removed. +""" + +NET_SOCK_PEER_PORT = "net.sock.peer.port" +""" +Deprecated: Replaced by `network.peer.port`. +""" + +NET_TRANSPORT = "net.transport" +""" +Deprecated: Replaced by `network.transport`. +""" + + +@deprecated( + reason="The attribute net.sock.family is deprecated - Split to `network.transport` and `network.type`" +) +class NetSockFamilyValues(Enum): + INET = "inet" + """IPv4 address.""" + INET6 = "inet6" + """IPv6 address.""" + UNIX = "unix" + """Unix domain socket path.""" + + +@deprecated( + reason="The attribute net.transport is deprecated - Replaced by `network.transport`" +) +class NetTransportValues(Enum): + IP_TCP = "ip_tcp" + """ip_tcp.""" + IP_UDP = "ip_udp" + """ip_udp.""" + PIPE = "pipe" + """Named or anonymous pipe.""" + INPROC = "inproc" + """In-process communication.""" + OTHER = "other" + """Something else (non IP-based).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py index aa12debcff..937c1c9335 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py @@ -17,81 +17,6 @@ from deprecated import deprecated -NET_HOST_IP = "net.host.ip" -""" -Deprecated: Replaced by `network.local.address`. -""" - -NET_HOST_NAME = "net.host.name" -""" -Deprecated: Replaced by `server.address`. -""" - -NET_HOST_PORT = "net.host.port" -""" -Deprecated: Replaced by `server.port`. -""" - -NET_PEER_IP = "net.peer.ip" -""" -Deprecated: Replaced by `network.peer.address`. -""" - -NET_PEER_NAME = "net.peer.name" -""" -Deprecated: Replaced by `server.address` on client spans and `client.address` on server spans. -""" - -NET_PEER_PORT = "net.peer.port" -""" -Deprecated: Replaced by `server.port` on client spans and `client.port` on server spans. -""" - -NET_PROTOCOL_NAME = "net.protocol.name" -""" -Deprecated: Replaced by `network.protocol.name`. -""" - -NET_PROTOCOL_VERSION = "net.protocol.version" -""" -Deprecated: Replaced by `network.protocol.version`. -""" - -NET_SOCK_FAMILY = "net.sock.family" -""" -Deprecated: Split to `network.transport` and `network.type`. -""" - -NET_SOCK_HOST_ADDR = "net.sock.host.addr" -""" -Deprecated: Replaced by `network.local.address`. -""" - -NET_SOCK_HOST_PORT = "net.sock.host.port" -""" -Deprecated: Replaced by `network.local.port`. -""" - -NET_SOCK_PEER_ADDR = "net.sock.peer.addr" -""" -Deprecated: Replaced by `network.peer.address`. -""" - -NET_SOCK_PEER_NAME = "net.sock.peer.name" -""" -Deprecated: Removed. -""" - -NET_SOCK_PEER_PORT = "net.sock.peer.port" -""" -Deprecated: Replaced by `network.peer.port`. -""" - -NET_TRANSPORT = "net.transport" -""" -Deprecated: Replaced by `network.transport`. -""" - NETWORK_CARRIER_ICC = "network.carrier.icc" """ The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. @@ -168,34 +93,6 @@ """ -@deprecated( - reason="The attribute net.sock.family is deprecated - Split to `network.transport` and `network.type`" -) -class NetSockFamilyValues(Enum): - INET = "inet" - """IPv4 address.""" - INET6 = "inet6" - """IPv6 address.""" - UNIX = "unix" - """Unix domain socket path.""" - - -@deprecated( - reason="The attribute net.transport is deprecated - Replaced by `network.transport`" -) -class NetTransportValues(Enum): - IP_TCP = "ip_tcp" - """ip_tcp.""" - IP_UDP = "ip_udp" - """ip_udp.""" - PIPE = "pipe" - """Named or anonymous pipe.""" - INPROC = "inproc" - """In-process communication.""" - OTHER = "other" - """Something else (non IP-based).""" - - class NetworkConnectionSubtypeValues(Enum): GPRS = "gprs" """GPRS.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py new file mode 100644 index 0000000000..175542d2c3 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/other_attributes.py @@ -0,0 +1,33 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from enum import Enum + +from deprecated import deprecated + +STATE = "state" +""" +Deprecated: Replaced by `db.client.connections.state`. +""" + + +@deprecated( + reason="The attribute state is deprecated - Replaced by `db.client.connections.state`" +) +class StateValues(Enum): + IDLE = "idle" + """idle.""" + USED = "used" + """used.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py new file mode 100644 index 0000000000..19f6384959 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/pool_attributes.py @@ -0,0 +1,19 @@ +# Copyright The OpenTelemetry Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +POOL_NAME = "pool.name" +""" +Deprecated: Replaced by `db.client.connections.pool.name`. +""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py index 63350ffc7e..d6f95083c4 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py @@ -15,28 +15,6 @@ from enum import Enum -from deprecated import deprecated - -MESSAGE_COMPRESSED_SIZE = "message.compressed_size" -""" -Deprecated: Replaced by `rpc.message.compressed_size`. -""" - -MESSAGE_ID = "message.id" -""" -Deprecated: Replaced by `rpc.message.id`. -""" - -MESSAGE_TYPE = "message.type" -""" -Deprecated: Replaced by `rpc.message.type`. -""" - -MESSAGE_UNCOMPRESSED_SIZE = "message.uncompressed_size" -""" -Deprecated: Replaced by `rpc.message.uncompressed_size`. -""" - RPC_CONNECT_RPC_ERROR_CODE = "rpc.connect_rpc.error_code" """ The [error codes](https://connect.build/docs/protocol/#error-codes) of the Connect request. Error codes are always string values. @@ -132,16 +110,6 @@ """ -@deprecated( - reason="The attribute message.type is deprecated - Replaced by `rpc.message.type`" -) -class MessageTypeValues(Enum): - SENT = "SENT" - """sent.""" - RECEIVED = "RECEIVED" - """received.""" - - class RpcConnectRpcErrorCodeValues(Enum): CANCELLED = "cancelled" """cancelled.""" @@ -178,39 +146,39 @@ class RpcConnectRpcErrorCodeValues(Enum): class RpcGrpcStatusCodeValues(Enum): - OK = "0" + OK = 0 """OK.""" - CANCELLED = "1" + CANCELLED = 1 """CANCELLED.""" - UNKNOWN = "2" + UNKNOWN = 2 """UNKNOWN.""" - INVALID_ARGUMENT = "3" + INVALID_ARGUMENT = 3 """INVALID_ARGUMENT.""" - DEADLINE_EXCEEDED = "4" + DEADLINE_EXCEEDED = 4 """DEADLINE_EXCEEDED.""" - NOT_FOUND = "5" + NOT_FOUND = 5 """NOT_FOUND.""" - ALREADY_EXISTS = "6" + ALREADY_EXISTS = 6 """ALREADY_EXISTS.""" - PERMISSION_DENIED = "7" + PERMISSION_DENIED = 7 """PERMISSION_DENIED.""" - RESOURCE_EXHAUSTED = "8" + RESOURCE_EXHAUSTED = 8 """RESOURCE_EXHAUSTED.""" - FAILED_PRECONDITION = "9" + FAILED_PRECONDITION = 9 """FAILED_PRECONDITION.""" - ABORTED = "10" + ABORTED = 10 """ABORTED.""" - OUT_OF_RANGE = "11" + OUT_OF_RANGE = 11 """OUT_OF_RANGE.""" - UNIMPLEMENTED = "12" + UNIMPLEMENTED = 12 """UNIMPLEMENTED.""" - INTERNAL = "13" + INTERNAL = 13 """INTERNAL.""" - UNAVAILABLE = "14" + UNAVAILABLE = 14 """UNAVAILABLE.""" - DATA_LOSS = "15" + DATA_LOSS = 15 """DATA_LOSS.""" - UNAUTHENTICATED = "16" + UNAUTHENTICATED = 16 """UNAUTHENTICATED.""" @@ -227,7 +195,7 @@ class RpcSystemValues(Enum): JAVA_RMI = "java_rmi" """Java RMI.""" DOTNET_WCF = "dotnet_wcf" - """NET WCF.""" + """.NET WCF.""" APACHE_DUBBO = "apache_dubbo" """Apache Dubbo.""" CONNECT_RPC = "connect_rpc" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py index 2ac0cd8da9..227f46c441 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/http_metrics.py @@ -86,7 +86,7 @@ def create_http_client_request_body_size(meter: Meter) -> Histogram: HTTP_CLIENT_REQUEST_DURATION = "http.client.request.duration" """ -Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.`. +Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.http.client.request.duration`. """ @@ -154,7 +154,7 @@ def create_http_server_request_body_size(meter: Meter) -> Histogram: HTTP_SERVER_REQUEST_DURATION = "http.server.request.duration" """ -Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.`. +Deprecated in favor of stable :py:const:`opentelemetry.semconv.metrics.http_metrics.http.server.request.duration`. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py index a24731bb94..77c904c492 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/client_attributes.py @@ -13,13 +13,6 @@ # limitations under the License. - - - - - - - CLIENT_ADDRESS = "client.address" """ Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. @@ -31,5 +24,3 @@ Client port number. Note: When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent the client port behind any intermediaries, for example proxies, if it's available. """ - - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py index cacb05e15e..8e68a89a00 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/error_attributes.py @@ -13,13 +13,8 @@ # limitations under the License. - - - - from enum import Enum - ERROR_TYPE = "error.type" """ Describes a class of error the operation ended with. @@ -45,7 +40,6 @@ """ - class ErrorTypeValues(Enum): OTHER = "_OTHER" """A fallback error value to be used when the instrumentation doesn't define a custom value.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py index 3b24aa9f65..56800548dd 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py @@ -13,13 +13,6 @@ # limitations under the License. - - - - - - - EXCEPTION_ESCAPED = "exception.escaped" """ SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. @@ -55,5 +48,3 @@ """ The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. """ - - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py index 2a3087e807..e02633d4a5 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/http_attributes.py @@ -13,13 +13,8 @@ # limitations under the License. - - - - from enum import Enum - HTTP_REQUEST_HEADER_TEMPLATE = "http.request.header" """ HTTP request headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. @@ -79,7 +74,6 @@ """ - class HttpRequestMethodValues(Enum): CONNECT = "CONNECT" """CONNECT method.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py index 87c1cc15bf..2c68fe4f62 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py @@ -13,13 +13,8 @@ # limitations under the License. - - - - from enum import Enum - NETWORK_LOCAL_ADDRESS = "network.local.address" """ Local address of the network connection - IP address or Unix domain socket name. @@ -69,7 +64,6 @@ """ - class NetworkTransportValues(Enum): TCP = "tcp" """TCP.""" @@ -80,6 +74,7 @@ class NetworkTransportValues(Enum): UNIX = "unix" """Unix domain socket.""" + class NetworkTypeValues(Enum): IPV4 = "ipv4" """IPv4.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py index b0beb5f7a2..1ccb108c3e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/otel_attributes.py @@ -13,13 +13,8 @@ # limitations under the License. - - - - from enum import Enum - OTEL_SCOPE_NAME = "otel.scope.name" """ The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). @@ -41,7 +36,6 @@ """ - class OtelStatusCodeValues(Enum): OK = "OK" """The operation has been validated by an Application developer or Operator to have completed successfully.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py index dbde3a9dea..1b882a3fd4 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/server_attributes.py @@ -13,13 +13,6 @@ # limitations under the License. - - - - - - - SERVER_ADDRESS = "server.address" """ Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. @@ -31,5 +24,3 @@ Server port number. Note: When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available. """ - - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py index d587aa5fe2..c2ec77fa5f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/service_attributes.py @@ -13,13 +13,6 @@ # limitations under the License. - - - - - - - SERVICE_NAME = "service.name" """ Logical name of the service. @@ -30,5 +23,3 @@ """ The version string of the service API or implementation. The format is not defined by these conventions. """ - - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py index c40868c36b..29454f7d52 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/telemetry_attributes.py @@ -13,13 +13,8 @@ # limitations under the License. - - - - from enum import Enum - TELEMETRY_SDK_LANGUAGE = "telemetry.sdk.language" """ The language of the telemetry SDK. @@ -42,7 +37,6 @@ """ - class TelemetrySdkLanguageValues(Enum): CPP = "cpp" """cpp.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py index 0ea3d468f1..ccd0c9e1cb 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/url_attributes.py @@ -13,13 +13,6 @@ # limitations under the License. - - - - - - - URL_FRAGMENT = "url.fragment" """ The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component. @@ -49,5 +42,3 @@ """ The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. """ - - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py index 34db801c02..41ea48eeea 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/user_agent_attributes.py @@ -13,16 +13,7 @@ # limitations under the License. - - - - - - - USER_AGENT_ORIGINAL = "user_agent.original" """ Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. """ - - diff --git a/scripts/semconv/templates/registry/common.j2 b/scripts/semconv/templates/registry/common.j2 index 3b7c530d98..c6222f3c51 100644 --- a/scripts/semconv/templates/registry/common.j2 +++ b/scripts/semconv/templates/registry/common.j2 @@ -27,12 +27,20 @@ {% if str is defined and str is not none %}{{str}}{% else %}{{""}}{% endif %} {%- endmacro %} +{%- macro remove_trailing_dots(str) -%} +{%- if str[-1:] == '.' -%}{{ remove_trailing_dots(str[:-1]) }}{%- else -%}{{ str }}{%- endif -%} +{%- endmacro -%} + {%- macro to_docstring(str, prefix) -%} -{{str | trim('.\n ') | comment_with_prefix(prefix)}} +{{remove_trailing_dots(str | trim(' \n')) | comment_with_prefix(prefix)}} {%- endmacro %} {%- macro import_deprecated(semconv) -%} - {%- if (semconv | rejectattr("deprecated", "none") | list | count > 0) or (ctx.filter == "any" and semconv | selectattr("stability", "equalto", "stable") | list | count > 0) %} + {%- if (semconv | rejectattr("deprecated", "none") | list | count > 0) or (ctx.filter == "any" and semconv | selectattr("stability", "equalto", "stable") | list | count > 0) -%} from deprecated import deprecated - {%- endif %} -{%- endmacro-%} \ No newline at end of file + {%- endif -%} +{%- endmacro-%} + +{%- macro print_value(type, value) -%} +{%- if type == "string" -%}"{{value}}"{%-else-%}{{value}}{%-endif-%} +{%- endmacro -%} \ No newline at end of file diff --git a/scripts/semconv/templates/registry/semantic_attributes.j2 b/scripts/semconv/templates/registry/semantic_attributes.j2 index 3773e6b0f7..2c17a04423 100644 --- a/scripts/semconv/templates/registry/semantic_attributes.j2 +++ b/scripts/semconv/templates/registry/semantic_attributes.j2 @@ -20,7 +20,6 @@ {% set attributes = ctx.attributes | sort(attribute="name") | list %} {% set enum_attributes = attributes | selectattr("type", "mapping") | list %} {% if enum_attributes | count > 0 %}from enum import Enum{% endif %} - {{c.import_deprecated(enum_attributes)}} {%- macro attribute_name(attribute) -%} @@ -65,7 +64,7 @@ class {{class_name}}(Enum): {%- for member in attribute.type.members %} {% set member_name = c.to_const_name(member.id) -%} {%- set doc_string=write_docstring(class_name + '.' + member_name, member.brief or member.id, "", member.deprecated, member.stability, "")-%} - {{member_name}} = "{{ member.value }}" + {{member_name}} = {{c.print_value(attribute.type | instantiated_type, member.value) }} {% if doc_string %}"""{{doc_string}}"""{% endif %} {%- endfor %} {% endfor %} \ No newline at end of file diff --git a/scripts/semconv/templates/registry/semantic_metrics.j2 b/scripts/semconv/templates/registry/semantic_metrics.j2 index fe9c46bf21..362a99aff9 100644 --- a/scripts/semconv/templates/registry/semantic_metrics.j2 +++ b/scripts/semconv/templates/registry/semantic_metrics.j2 @@ -23,40 +23,33 @@ {%- macro write_docstring(metric, prefix) -%} {%- if c.str_or_empty(metric.deprecated)|length %} -{{prefix}}Deprecated: {{c.to_docstring(metric.deprecated)}}. +{{prefix}}Deprecated: {{c.to_docstring(metric.deprecated, prefix)}}. {%- elif ctx.filter == "any" and metric.stability == "stable" %} {{prefix}}Deprecated in favor of stable :py:const:`{{stable_class_ref(metric.metric_name, '.')}}`. {%- elif c.str_or_empty(metric.brief)|length %} -{{prefix}}{{c.to_docstring(metric.brief)}}. +{{prefix}}{{c.to_docstring(metric.brief, prefix)}}. {{prefix}}Instrument: {{ metric.instrument }} {{prefix}}Unit: {{ metric.unit }} {%- if c.str_or_empty(metric.note)|length %} -{{prefix}}Note: {{c.to_docstring(metric.note)}}. +{{prefix}}Note: {{c.to_docstring(metric.note, prefix)}}. {%- endif -%} {%- endif -%} {%- endmacro -%} - {%- macro import_instrument_classes(metrics) -%} {% if ctx.filter == "any" %} from opentelemetry.metrics import Meter {%- if ctx.metrics | selectattr("instrument", "equalto", "gauge") | list | count > 0 %} from typing import Callable, Sequence -from opentelemetry.metrics import ObservableGauge - {%- endif %} - - {%- if ctx.metrics | selectattr("instrument", "equalto", "histogram") | list | count > 0 %} -from opentelemetry.metrics import Histogram {%- endif %} - {%- if ctx.metrics | selectattr("instrument", "equalto", "updowncounter") | list | count > 0 %} -from opentelemetry.metrics import UpDownCounter - {%- endif %} - - {%- if ctx.metrics | selectattr("instrument", "equalto", "counter") | list | count > 0 %} -from opentelemetry.metrics import Counter - {%- endif %} + {%- set instruments = ["counter", "histogram", "gauge", "updowncounter"]-%} + {%- for i in instruments -%} + {%- if ctx.metrics | selectattr("instrument", "equalto", i) | list | count > 0 %} +from opentelemetry.metrics import {{i | map_text("py_instrument_to_type")}} + {%- endif -%} + {%- endfor-%} {%- endif -%} {%- endmacro-%} diff --git a/scripts/semconv/templates/registry/weaver.yaml b/scripts/semconv/templates/registry/weaver.yaml index 96192a976d..0bf8906570 100644 --- a/scripts/semconv/templates/registry/weaver.yaml +++ b/scripts/semconv/templates/registry/weaver.yaml @@ -9,15 +9,18 @@ templates: .groups | map(select(.type == "attribute_group")) | map(select(.id | startswith("registry"))) - | map({ id: .id, group_id: .id | split(".") | .[1], attributes: .attributes}) + | map({attributes: .attributes + | map(.group_id= (if .name |index(".") then .name |split(".")[0] else "other" end)) + | map(.const_name= (.name | split(".")|join("_"))) + }) + | [.[].attributes[] ] | group_by(.group_id) - | map({ id: .[0].group_id, attributes: [.[].attributes[]] | map(select(if $filter == "any" then true else .stability == $filter end)) | sort_by(.id)}) + | map({ id: .[0].group_id, attributes: [.[]] | map(select(if $filter == "any" then true else .stability == $filter end)) | sort_by(.name)}) | map(select( .id as $id | any( $excluded[]; . == $id) | not )) | map(select(.attributes | length > 0)) | map({ id: .id, attributes: .attributes - | map(. + {const_name: .name | split(".")|join("_")}) | map(if has("deprecated") then . else . + {"deprecated": null} end) | group_by(.const_name) | map({const_name: .[0].const_name, names: [.[]] | sort_by(.deprecated) })