From cc7f79b0fb33426e33a491b71d4ad38a91703e08 Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Sat, 28 Aug 2021 06:14:40 +0530 Subject: [PATCH 1/3] Update to semantic conventions v1.6.1 --- .gitignore | 1 + opentelemetry-semantic-conventions/README.rst | 7 +- .../semconv/resource/__init__.py | 13 +- .../opentelemetry/semconv/trace/__init__.py | 117 +++++++++++++++++- scripts/semconv/generate.sh | 4 +- 5 files changed, 134 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index c784acf9f61..e2538e67eea 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ build eggs parts bin +include var sdist develop-eggs diff --git a/opentelemetry-semantic-conventions/README.rst b/opentelemetry-semantic-conventions/README.rst index 3e1a322cdf1..f84cf523d0b 100644 --- a/opentelemetry-semantic-conventions/README.rst +++ b/opentelemetry-semantic-conventions/README.rst @@ -18,14 +18,15 @@ Installation Code Generation --------------- -These files were generated automatically from code in opentelemetry-semantic-conventions_. +These files were generated automatically from code in semconv_. To regenerate the code, run ``../scripts/semconv/generate.sh``. -To build against a new release or specific commit of opentelemetry-semantic-conventions_, +To build against a new release or specific commit of opentelemetry-specification_, update the ``SPEC_VERSION`` variable in ``../scripts/semconv/generate.sh``. Then run the script and commit the changes. -.. _opentelemetry-semantic-conventions: https://github.com/open-telemetry/opentelemetry-semantic-conventions +.. _opentelemetry-specification: https://github.com/open-telemetry/opentelemetry-specification +.. _semconv: https://github.com/open-telemetry/opentelemetry-python/tree/main/scripts/semconv References diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py index c8e27683ee0..af10a64c9a1 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/resource/__init__.py @@ -28,13 +28,13 @@ class ResourceAttributes: CLOUD_REGION = "cloud.region" """ - The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations). + The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations). """ CLOUD_AVAILABILITY_ZONE = "cloud.availability_zone" """ Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. - Note: Availability zones are called "zones" on Google Cloud. + Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. """ CLOUD_PLATFORM = "cloud.platform" @@ -460,6 +460,9 @@ class ResourceAttributes: class CloudProviderValues(Enum): + ALIBABA_CLOUD = "alibaba_cloud" + """Alibaba Cloud.""" + AWS = "aws" """Amazon Web Services.""" @@ -471,6 +474,12 @@ class CloudProviderValues(Enum): class CloudPlatformValues(Enum): + ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs" + """Alibaba Cloud Elastic Compute Service.""" + + ALIBABA_CLOUD_FC = "alibaba_cloud_fc" + """Alibaba Cloud Function Compute.""" + AWS_EC2 = "aws_ec2" """AWS Elastic Compute Cloud.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 5ecfd2946b8..1f61d425345 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -314,6 +314,36 @@ class SpanAttributes: Local hostname or similar, see note below. """ + NET_HOST_CONNECTION_TYPE = "net.host.connection.type" + """ + The internet connection type currently being used by the host. + """ + + NET_HOST_CONNECTION_SUBTYPE = "net.host.connection.subtype" + """ + This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + """ + + NET_HOST_CARRIER_NAME = "net.host.carrier.name" + """ + The name of the mobile carrier. + """ + + NET_HOST_CARRIER_MCC = "net.host.carrier.mcc" + """ + The mobile carrier country code. + """ + + NET_HOST_CARRIER_MNC = "net.host.carrier.mnc" + """ + The mobile carrier network code. + """ + + NET_HOST_CARRIER_ICC = "net.host.carrier.icc" + """ + The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. + """ + MESSAGING_SYSTEM = "messaging.system" """ A string identifying the messaging system. @@ -608,7 +638,7 @@ class SpanAttributes: MESSAGING_KAFKA_MESSAGE_KEY = "messaging.kafka.message_key" """ Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set. - Note: If the key type is not string, its string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. + Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. """ MESSAGING_KAFKA_CONSUMER_GROUP = "messaging.kafka.consumer_group" @@ -903,6 +933,88 @@ class HttpFlavorValues(Enum): """QUIC protocol.""" +class NetHostConnectionTypeValues(Enum): + WIFI = "wifi" + """wifi.""" + + WIRED = "wired" + """wired.""" + + CELL = "cell" + """cell.""" + + UNAVAILABLE = "unavailable" + """unavailable.""" + + UNKNOWN = "unknown" + """unknown.""" + + +class NetHostConnectionSubtypeValues(Enum): + GPRS = "gprs" + """GPRS.""" + + EDGE = "edge" + """EDGE.""" + + UMTS = "umts" + """UMTS.""" + + CDMA = "cdma" + """CDMA.""" + + EVDO_0 = "evdo_0" + """EVDO Rel. 0.""" + + EVDO_A = "evdo_a" + """EVDO Rev. A.""" + + CDMA2000_1XRTT = "cdma2000_1xrtt" + """CDMA2000 1XRTT.""" + + HSDPA = "hsdpa" + """HSDPA.""" + + HSUPA = "hsupa" + """HSUPA.""" + + HSPA = "hspa" + """HSPA.""" + + IDEN = "iden" + """IDEN.""" + + EVDO_B = "evdo_b" + """EVDO Rev. B.""" + + LTE = "lte" + """LTE.""" + + EHRPD = "ehrpd" + """EHRPD.""" + + HSPAP = "hspap" + """HSPAP.""" + + GSM = "gsm" + """GSM.""" + + TD_SCDMA = "td_scdma" + """TD-SCDMA.""" + + IWLAN = "iwlan" + """IWLAN.""" + + NR = "nr" + """5G NR (New Radio).""" + + NRNSA = "nrnsa" + """5G NRNSA (New Radio Non-Standalone).""" + + LTE_CA = "lte_ca" + """LTE CA.""" + + class MessagingDestinationKindValues(Enum): QUEUE = "queue" """A message sent to a queue.""" @@ -912,6 +1024,9 @@ class MessagingDestinationKindValues(Enum): class FaasInvokedProviderValues(Enum): + ALIBABA_CLOUD = "alibaba_cloud" + """Alibaba Cloud.""" + AWS = "aws" """Amazon Web Services.""" diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index ccf75a63649..d793bf5809b 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,8 +4,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible -SPEC_VERSION=v1.5.0 -OTEL_SEMCONV_GEN_IMG_VERSION=0.4.1 +SPEC_VERSION=v1.6.1 +OTEL_SEMCONV_GEN_IMG_VERSION=0.5.0 cd ${SCRIPT_DIR} From 4b407d17d43f574e0e4818bb0d52ee797cfa8acc Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Sat, 28 Aug 2021 06:18:31 +0530 Subject: [PATCH 2/3] Add CHANGELOG entry --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67585bde861..db3b4eb83f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.5.0-0.24b0...HEAD) +- `opentelemetry-semantic-conventions` Update to semantic conventions v1.6.1 + ([#2077](https://github.com/open-telemetry/opentelemetry-python/pull/2077)) + ## [1.5.0-0.24b0](https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.5.0-0.24b0) - 2021-08-26 From a4f6f88057beb66aaa6d45c37bf8be6fc15c17d6 Mon Sep 17 00:00:00 2001 From: Srikanth Chekuri Date: Sat, 28 Aug 2021 16:34:31 +0530 Subject: [PATCH 3/3] Fix lint --- .../src/opentelemetry/semconv/trace/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 1f61d425345..5d32bbef995 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# pylint: disable=too-many-lines + from enum import Enum