diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/client_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/client_attributes.py index 89ab626809b..8e2730ca90e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/client_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/client_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/error_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/error_attributes.py index 6a58d46622c..c3818751181 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/error_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/error_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,12 +32,11 @@ If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), it's RECOMMENDED to: - * Use a domain-specific attribute - * Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not. -""" + * Use a domain-specific attribute + * Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not. +""" 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/v1_23_1/android_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/android_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/android_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/android_attributes.py index 22e538ffbd0..468c648f886 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/android_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/android_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -30,7 +29,6 @@ Note: The Android lifecycle states are defined in [Activity lifecycle callbacks](https://developer.android.com/guide/components/activities/activity-lifecycle#lc), and from which the `OS identifiers` are derived. """ - class AndroidStateValues(Enum): CREATED = "created" """Any time before Activity.onResume() or, if the app has no Activity, Context.startService() has been called in the app for the first time.""" @@ -40,4 +38,3 @@ class AndroidStateValues(Enum): FOREGROUND = "foreground" """Any time after Activity.onResume() or, if the app has no Activity, Context.startService() has been called when the app was in either the created or background states.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aspnetcore_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aspnetcore_attributes.py new file mode 100644 index 00000000000..078512d96c7 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aspnetcore_attributes.py @@ -0,0 +1,90 @@ +# 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. + +# pylint: disable=too-many-lines + +from enum import Enum + + +ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = "aspnetcore.diagnostics.exception.result" +""" +ASP.NET Core exception middleware handling result. +""" + + +ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = "aspnetcore.diagnostics.handler.type" +""" +Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception. +""" + + +ASPNETCORE_RATE_LIMITING_POLICY = "aspnetcore.rate_limiting.policy" +""" +Rate limiting policy name. +""" + + +ASPNETCORE_RATE_LIMITING_RESULT = "aspnetcore.rate_limiting.result" +""" +Rate-limiting result, shows whether the lease was acquired or contains a rejection reason. +""" + + +ASPNETCORE_REQUEST_IS_UNHANDLED = "aspnetcore.request.is_unhandled" +""" +Flag indicating if request was handled by the application pipeline. +""" + + +ASPNETCORE_ROUTING_IS_FALLBACK = "aspnetcore.routing.is_fallback" +""" +A value that indicates whether the matched route is a fallback route. +""" + + +ASPNETCORE_ROUTING_MATCH_STATUS = "aspnetcore.routing.match_status" +""" +Match result - success or failure. +""" + +class AspnetcoreDiagnosticsExceptionResultValues(Enum): + HANDLED = "handled" + """Exception was handled by the exception handling middleware.""" + + UNHANDLED = "unhandled" + """Exception was not handled by the exception handling middleware.""" + + SKIPPED = "skipped" + """Exception handling was skipped because the response had started.""" + + ABORTED = "aborted" + """Exception handling didn't run because the request was aborted.""" +class AspnetcoreRateLimitingResultValues(Enum): + ACQUIRED = "acquired" + """Lease was acquired.""" + + ENDPOINT_LIMITER = "endpoint_limiter" + """Lease request was rejected by the endpoint limiter.""" + + GLOBAL_LIMITER = "global_limiter" + """Lease request was rejected by the global limiter.""" + + REQUEST_CANCELED = "request_canceled" + """Lease request was canceled.""" +class AspnetcoreRoutingMatchStatusValues(Enum): + SUCCESS = "success" + """Match succeeded.""" + + FAILURE = "failure" + """Match failed.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aspnetcore_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aspnetcore_metrics.py new file mode 100644 index 00000000000..fe5c8d9bb13 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aspnetcore_metrics.py @@ -0,0 +1,107 @@ +# 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 opentelemetry.metrics import ( + Counter, + Histogram, + Meter, + UpDownCounter, + ObservableGauge, +) +from typing import Callable, Sequence + +class AspnetcoreMetrics: + + """ + Number of exceptions caught by exception handling middleware + """ + @staticmethod + def create_aspnetcore_diagnostics_exceptions(meter: Meter) -> Counter: + return meter.create_counter( + name="aspnetcore.diagnostics.exceptions", + description="Number of exceptions caught by exception handling middleware.", + unit="{exception}", + ) + + + """ + Number of requests that are currently active on the server that hold a rate limiting lease + """ + @staticmethod + def create_aspnetcore_rate_limiting_active_request_leases(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="aspnetcore.rate_limiting.active_request_leases", + description="Number of requests that are currently active on the server that hold a rate limiting lease.", + unit="{request}", + ) + + + """ + Number of requests that are currently queued, waiting to acquire a rate limiting lease + """ + @staticmethod + def create_aspnetcore_rate_limiting_queued_requests(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="aspnetcore.rate_limiting.queued_requests", + description="Number of requests that are currently queued, waiting to acquire a rate limiting lease.", + unit="{request}", + ) + + + """ + The time the request spent in a queue waiting to acquire a rate limiting lease + """ + @staticmethod + def create_aspnetcore_rate_limiting_request_time_in_queue(meter: Meter) -> Histogram: + return meter.create_histogram( + name="aspnetcore.rate_limiting.request.time_in_queue", + description="The time the request spent in a queue waiting to acquire a rate limiting lease.", + unit="s", + ) + + + """ + The duration of rate limiting lease held by requests on the server + """ + @staticmethod + def create_aspnetcore_rate_limiting_request_lease_duration(meter: Meter) -> Histogram: + return meter.create_histogram( + name="aspnetcore.rate_limiting.request_lease.duration", + description="The duration of rate limiting lease held by requests on the server.", + unit="s", + ) + + + """ + Number of requests that tried to acquire a rate limiting lease + """ + @staticmethod + def create_aspnetcore_rate_limiting_requests(meter: Meter) -> Counter: + return meter.create_counter( + name="aspnetcore.rate_limiting.requests", + description="Number of requests that tried to acquire a rate limiting lease.", + unit="{request}", + ) + + + """ + Number of requests that were attempted to be matched to an endpoint + """ + @staticmethod + def create_aspnetcore_routing_match_attempts(meter: Meter) -> Counter: + return meter.create_counter( + name="aspnetcore.routing.match_attempts", + description="Number of requests that were attempted to be matched to an endpoint.", + unit="{match_attempt}", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/aws_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aws_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/aws_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aws_attributes.py index 67eecf97bb9..bb4ff1c41ed 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/aws_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/aws_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -307,11 +306,9 @@ - [upload-part-copy](https://docs.aws.amazon.com/cli/latest/reference/s3api/upload-part-copy.html). """ - class AwsEcsLaunchtypeValues(Enum): EC2 = "ec2" """ec2.""" FARGATE = "fargate" """fargate.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/browser_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/browser_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/browser_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/browser_attributes.py index fb7d0bf49f3..55fd2ef0fdb 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/browser_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/browser_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/cloud_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/cloud_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/cloud_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/cloud_attributes.py index fdc68929ae6..fee387956a2 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/cloud_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/cloud_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -73,7 +72,6 @@ a TracerProvider. """ - class CloudPlatformValues(Enum): ALIBABA_CLOUD_ECS = "alibaba_cloud_ecs" """Alibaba Cloud Elastic Compute Service.""" @@ -155,8 +153,6 @@ class CloudPlatformValues(Enum): TENCENT_CLOUD_SCF = "tencent_cloud_scf" """Tencent Cloud Serverless Cloud Function (SCF).""" - - class CloudProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -178,4 +174,3 @@ class CloudProviderValues(Enum): TENCENT_CLOUD = "tencent_cloud" """Tencent Cloud.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/cloudevents_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/cloudevents_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/cloudevents_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/cloudevents_attributes.py index 006696a3cad..d8f2340a9e8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/cloudevents_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/cloudevents_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/code_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/code_attributes.py similarity index 88% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/code_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/code_attributes.py index 45641af17f3..ad5e9defd8b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/code_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/code_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -45,3 +44,9 @@ The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. """ + +CODE_STACKTRACE = "code.stacktrace" +""" +A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. +""" + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/container_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/container_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/container_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/container_attributes.py index e36e71ad18f..c2ed100a0d0 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/container_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/container_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/db_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/db_attributes.py similarity index 94% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/db_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/db_attributes.py index 61a203df42a..78d9f0af525 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/db_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/db_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -56,7 +55,7 @@ DB_CASSANDRA_TABLE = "db.cassandra.table" """ -The name of the primary table that the operation is acting upon, including the keyspace name (if applicable). +The name of the primary Cassandra table that the operation is acting upon, including the keyspace name (if applicable). Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. """ @@ -134,6 +133,12 @@ """ +DB_INSTANCE_ID = "db.instance.id" +""" +An identifier (address, unique name, or any other identifier) of the database instance that is executing queries or mutations on the current connection. This is useful in cases where the database is running in a clustered environment and the instrumentation is able to record the node executing the query. The client may obtain this value in databases like MySQL using queries like `select @@hostname`. +""" + + DB_JDBC_DRIVER_CLASSNAME = "db.jdbc.driver_classname" """ The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. @@ -142,7 +147,7 @@ DB_MONGODB_COLLECTION = "db.mongodb.collection" """ -The collection being accessed within the database stated in `db.name`. +The MongoDB collection being accessed within the database stated in `db.name`. """ @@ -197,7 +202,6 @@ Username for accessing the database. """ - class DbCassandraConsistencyLevelValues(Enum): ALL = "all" """all.""" @@ -231,16 +235,12 @@ class DbCassandraConsistencyLevelValues(Enum): LOCAL_SERIAL = "local_serial" """local_serial.""" - - class DbCosmosdbConnectionModeValues(Enum): GATEWAY = "gateway" """Gateway (HTTP) connections mode.""" DIRECT = "direct" """Direct connection.""" - - class DbCosmosdbOperationTypeValues(Enum): INVALID = "Invalid" """invalid.""" @@ -286,8 +286,6 @@ class DbCosmosdbOperationTypeValues(Enum): EXECUTE_JAVASCRIPT = "ExecuteJavaScript" """execute_javascript.""" - - class DbSystemValues(Enum): OTHER_SQL = "other_sql" """Some other SQL database. Fallback only. See notes.""" @@ -444,4 +442,3 @@ class DbSystemValues(Enum): TRINO = "trino" """Trino.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/db_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/db_metrics.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/db_metrics.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/db_metrics.py index 304cb660493..a298975372d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/db_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/db_metrics.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -130,4 +129,3 @@ def create_db_client_connections_wait_time(meter: Meter) -> Histogram: description="The time it took to obtain an open connection from the pool", unit="ms", ) - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/deployment_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/deployment_attributes.py new file mode 100644 index 00000000000..e22f14ec837 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/deployment_attributes.py @@ -0,0 +1,29 @@ +# 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. + +# pylint: disable=too-many-lines + + +DEPLOYMENT_ENVIRONMENT = "deployment.environment" +""" +Name of the [deployment environment](https://wikipedia.org/wiki/Deployment_environment) (aka deployment tier). +Note: `deployment.environment` does not affect the uniqueness constraints defined through + the `service.namespace`, `service.name` and `service.instance.id` resource attributes. + This implies that resources carrying the following attribute combinations MUST be + considered to be identifying the same service: + + * `service.name=frontend`, `deployment.environment=production` + * `service.name=frontend`, `deployment.environment=staging`. +""" + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/destination_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/destination_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/destination_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/destination_attributes.py index 498892f957f..32046d62e51 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/destination_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/destination_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/device_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/device_attributes.py similarity index 91% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/device_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/device_attributes.py index 4087e2424b1..6add1ad59a8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/device_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/device_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,13 +32,13 @@ DEVICE_MODEL_IDENTIFIER = "device.model.identifier" """ The model identifier for the device. -Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device. +Note: It's recommended this value represents a machine-readable version of the model identifier rather than the market or consumer-friendly name of the device. """ DEVICE_MODEL_NAME = "device.model.name" """ The marketing name for the device model. -Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative. +Note: It's recommended this value represents a human-readable version of the device model rather than a machine-readable alternative. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/deployment_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/disk_attributes.py similarity index 75% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/deployment_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/disk_attributes.py index 2449e70bc6f..9c7acf184b8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/deployment_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/disk_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,9 +14,17 @@ # pylint: disable=too-many-lines +from enum import Enum + -DEPLOYMENT_ENVIRONMENT = "deployment.environment" +DISK_IO_DIRECTION = "disk.io.direction" """ -Name of the [deployment environment](https://wikipedia.org/wiki/Deployment_environment) (aka deployment tier). +The disk IO operation direction. """ +class DiskIoDirectionValues(Enum): + READ = "read" + """read.""" + + WRITE = "write" + """write.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/dns_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/dns_attributes.py new file mode 100644 index 00000000000..526d61b8e77 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/dns_attributes.py @@ -0,0 +1,24 @@ +# 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. + +# pylint: disable=too-many-lines + + +DNS_QUESTION_NAME = "dns.question.name" +""" +The name being queried. +Note: The name being queried. + If the name field contains non-printable characters (below 32 or above 126), those characters should be represented as escaped base 10 integers (\DDD). Back slashes and quotes should be escaped. Tabs, carriage returns, and line feeds should be converted to \t, \r, and \n respectively. +""" + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/dns_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/dns_metrics.py new file mode 100644 index 00000000000..d3daa4d7a58 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/dns_metrics.py @@ -0,0 +1,35 @@ +# 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 opentelemetry.metrics import ( + Counter, + Histogram, + Meter, + UpDownCounter, + ObservableGauge, +) +from typing import Callable, Sequence + +class DnsMetrics: + + """ + Measures the time taken to perform a DNS lookup + """ + @staticmethod + def create_dns_lookup_duration(meter: Meter) -> Histogram: + return meter.create_histogram( + name="dns.lookup.duration", + description="Measures the time taken to perform a DNS lookup.", + unit="s", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/enduser_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/enduser_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/enduser_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/enduser_attributes.py index 01f0f065fe6..25a93ebfe3f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/enduser_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/enduser_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/event_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/event_attributes.py similarity index 59% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/event_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/event_attributes.py index 14f504331dc..50eb8d8cf96 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/event_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/event_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -15,29 +14,10 @@ # pylint: disable=too-many-lines -from enum import Enum - - -EVENT_DOMAIN = "event.domain" -""" -The domain identifies the business context for the events. -Note: Events across different domains may have same `event.name`, yet be unrelated events. -""" - EVENT_NAME = "event.name" """ -The name identifies the event. +Identifies the class / type of event. +Note: Event names are subject to the same rules as [attribute names](https://github.com/open-telemetry/opentelemetry-specification/tree/v1.26.0/specification/common/attribute-naming.md). Notably, event names are namespaced to avoid collisions and provide a clean separation of semantics for events in separate domains like browser, mobile, and kubernetes. """ - -class EventDomainValues(Enum): - BROWSER = "browser" - """Events from browser apps.""" - - DEVICE = "device" - """Events from mobile apps.""" - - K8S = "k8s" - """Events from Kubernetes.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/exception_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/exception_attributes.py similarity index 96% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/exception_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/exception_attributes.py index eb7a72d593b..f26f3cc2a6f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/exception_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/exception_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -29,7 +28,7 @@ whether it will escape the scope of a span. However, it is trivial to know that an exception will escape, if one checks for an active exception just before ending the span, - as done in the [example above](#recording-an-exception). + as done in the [example for recording span exceptions](#recording-an-exception). It follows that an exception may still escape the scope of the span even if the `exception.escaped` attribute was not set or set to false, diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/faas_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/faas_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/faas_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/faas_attributes.py index 30fcd22a82b..a80e5a84862 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/faas_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/faas_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -143,7 +142,6 @@ * **Azure Functions:** Not applicable. Do not set this attribute. """ - class FaasDocumentOperationValues(Enum): INSERT = "insert" """When a new object is created.""" @@ -153,8 +151,6 @@ class FaasDocumentOperationValues(Enum): DELETE = "delete" """When an object is deleted.""" - - class FaasInvokedProviderValues(Enum): ALIBABA_CLOUD = "alibaba_cloud" """Alibaba Cloud.""" @@ -170,8 +166,6 @@ class FaasInvokedProviderValues(Enum): TENCENT_CLOUD = "tencent_cloud" """Tencent Cloud.""" - - class FaasTriggerValues(Enum): DATASOURCE = "datasource" """A response to some data source operation such as a database or filesystem read/write.""" @@ -187,4 +181,3 @@ class FaasTriggerValues(Enum): OTHER = "other" """If none of the others apply.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/faas_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/faas_metrics.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/faas_metrics.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/faas_metrics.py index 6808480f011..d2b53fd018c 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/faas_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/faas_metrics.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -130,4 +129,3 @@ def create_faas_timeouts(meter: Meter) -> Counter: description="Number of invocation timeouts", unit="{timeout}", ) - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/feature_flag_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/feature_flag_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/feature_flag_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/feature_flag_attributes.py index b6ecdaaed6f..b826d8abea6 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/feature_flag_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/feature_flag_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/gcp_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/gcp_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/gcp_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/gcp_attributes.py index 64c8fc17e4a..97b7b9a1ddb 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/gcp_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/gcp_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/graphql_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/graphql_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/graphql_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/graphql_attributes.py index ee05ebe9230..4d2c9ba558a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/graphql_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/graphql_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,7 +35,6 @@ The type of the operation being executed. """ - class GraphqlOperationTypeValues(Enum): QUERY = "query" """GraphQL query.""" @@ -46,4 +44,3 @@ class GraphqlOperationTypeValues(Enum): SUBSCRIPTION = "subscription" """GraphQL subscription.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/heroku_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/heroku_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/heroku_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/heroku_attributes.py index c17e0ead246..d54b5eb981e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/heroku_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/heroku_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/host_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/host_attributes.py similarity index 96% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/host_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/host_attributes.py index 368a4fcc154..fcc1c66caf6 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/host_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/host_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,7 +31,7 @@ HOST_CPU_FAMILY = "host.cpu.family" """ -Numeric value specifying the family or generation of the CPU. +Family or generation of the CPU. """ @@ -81,7 +80,7 @@ HOST_IMAGE_VERSION = "host.image.version" """ -The version string of the VM image or host OS as defined in [Version Attributes](README.md#version-attributes). +The version string of the VM image or host OS as defined in [Version Attributes](/docs/resource/README.md#version-attributes). """ @@ -110,7 +109,6 @@ Type of host. For Cloud, this must be the machine type. """ - class HostArchValues(Enum): AMD64 = "amd64" """AMD64.""" @@ -135,4 +133,3 @@ class HostArchValues(Enum): X86 = "x86" """32-bit x86.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/http_attributes.py new file mode 100644 index 00000000000..87ecfae5771 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/http_attributes.py @@ -0,0 +1,123 @@ +# 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. + +# pylint: disable=too-many-lines + +from enum import Enum + + +HTTP_CONNECTION_STATE = "http.connection.state" +""" +State of the HTTP connection in the HTTP connection pool. +""" + + +HTTP_FLAVOR = "http.flavor" +""" +Deprecated, use `network.protocol.name` instead. +Deprecated: Replaced by `network.protocol.name`. +""" + + +HTTP_METHOD = "http.method" +""" +Deprecated, use `http.request.method` instead. +Deprecated: Replaced by `http.request.method`. +""" + + +HTTP_REQUEST_BODY_SIZE = "http.request.body.size" +""" +The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. +""" + + +HTTP_REQUEST_CONTENT_LENGTH = "http.request_content_length" +""" +Deprecated, use `http.request.header.content-length` instead. +Deprecated: Replaced by `http.request.header.content-length`. +""" + + +HTTP_RESPONSE_BODY_SIZE = "http.response.body.size" +""" +The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. +""" + + +HTTP_RESPONSE_CONTENT_LENGTH = "http.response_content_length" +""" +Deprecated, use `http.response.header.content-length` instead. +Deprecated: Replaced by `http.response.header.content-length`. +""" + + +HTTP_SCHEME = "http.scheme" +""" +Deprecated, use `url.scheme` instead. +Deprecated: Replaced by `url.scheme` instead. +""" + + +HTTP_STATUS_CODE = "http.status_code" +""" +Deprecated, use `http.response.status_code` instead. +Deprecated: Replaced by `http.response.status_code`. +""" + + +HTTP_TARGET = "http.target" +""" +Deprecated, use `url.path` and `url.query` instead. +Deprecated: Split to `url.path` and `url.query. +""" + + +HTTP_URL = "http.url" +""" +Deprecated, use `url.full` instead. +Deprecated: Replaced by `url.full`. +""" + + +HTTP_USER_AGENT = "http.user_agent" +""" +Deprecated, use `user_agent.original` instead. +Deprecated: Replaced by `user_agent.original`. +""" + +class HttpConnectionStateValues(Enum): + ACTIVE = "active" + """active state.""" + + IDLE = "idle" + """idle state.""" +class HttpFlavorValues(Enum): + HTTP_1_0 = "1.0" + """HTTP/1.0.""" + + HTTP_1_1 = "1.1" + """HTTP/1.1.""" + + HTTP_2_0 = "2.0" + """HTTP/2.""" + + HTTP_3_0 = "3.0" + """HTTP/3.""" + + SPDY = "SPDY" + """SPDY protocol.""" + + QUIC = "QUIC" + """QUIC protocol.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/http_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/http_metrics.py similarity index 65% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/http_metrics.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/http_metrics.py index a0e1a09b18d..d648ec1a86d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/http_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/http_metrics.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,6 +23,42 @@ class HttpMetrics: + """ + Number of active HTTP requests + """ + @staticmethod + def create_http_client_active_requests(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="http.client.active_requests", + description="Number of active HTTP requests.", + unit="{request}", + ) + + + """ + The duration of the successfully established outbound HTTP connections + """ + @staticmethod + def create_http_client_connection_duration(meter: Meter) -> Histogram: + return meter.create_histogram( + name="http.client.connection.duration", + description="The duration of the successfully established outbound HTTP connections.", + unit="s", + ) + + + """ + Number of outbound HTTP connections that are currently active or idle on the client + """ + @staticmethod + def create_http_client_open_connections(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="http.client.open_connections", + description="Number of outbound HTTP connections that are currently active or idle on the client.", + unit="{connection}", + ) + + """ Size of HTTP client request bodies """ @@ -37,13 +72,13 @@ def create_http_client_request_body_size(meter: Meter) -> Histogram: """ - Duration of HTTP client requests + The amount of time requests spent on a queue waiting for an available connection """ @staticmethod - def create_http_client_request_duration(meter: Meter) -> Histogram: + def create_http_client_request_time_in_queue(meter: Meter) -> Histogram: return meter.create_histogram( - name="http.client.request.duration", - description="Duration of HTTP client requests.", + name="http.client.request.time_in_queue", + description="The amount of time requests spent on a queue waiting for an available connection.", unit="s", ) @@ -84,18 +119,6 @@ def create_http_server_request_body_size(meter: Meter) -> Histogram: ) - """ - Duration of HTTP server requests - """ - @staticmethod - def create_http_server_request_duration(meter: Meter) -> Histogram: - return meter.create_histogram( - name="http.server.request.duration", - description="Duration of HTTP server requests.", - unit="s", - ) - - """ Size of HTTP server response bodies """ @@ -106,4 +129,3 @@ def create_http_server_response_body_size(meter: Meter) -> Histogram: description="Size of HTTP server response bodies.", unit="By", ) - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/ios_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/ios_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/ios_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/ios_attributes.py index 6247a683670..72396d5962e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/ios_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/ios_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +23,6 @@ Note: The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate#1656902), and from which the `OS terminology` column values are derived. """ - class IosStateValues(Enum): ACTIVE = "active" """The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`.""" @@ -40,4 +38,3 @@ class IosStateValues(Enum): TERMINATE = "terminate" """The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/jvm_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/jvm_attributes.py new file mode 100644 index 00000000000..d920d19cd4c --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/jvm_attributes.py @@ -0,0 +1,23 @@ +# 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. + +# pylint: disable=too-many-lines + + +JVM_BUFFER_POOL_NAME = "jvm.buffer.pool.name" +""" +Name of the buffer pool. +Note: Pool names are generally obtained via [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). +""" + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/jvm_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/jvm_metrics.py new file mode 100644 index 00000000000..f0d923b0fcd --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/jvm_metrics.py @@ -0,0 +1,97 @@ +# 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 opentelemetry.metrics import ( + Counter, + Histogram, + Meter, + UpDownCounter, + ObservableGauge, +) +from typing import Callable, Sequence + +class JvmMetrics: + + """ + Number of buffers in the pool + """ + @staticmethod + def create_jvm_buffer_count(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="jvm.buffer.count", + description="Number of buffers in the pool.", + unit="{buffer}", + ) + + + """ + Measure of total memory capacity of buffers + """ + @staticmethod + def create_jvm_buffer_memory_limit(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="jvm.buffer.memory.limit", + description="Measure of total memory capacity of buffers.", + unit="By", + ) + + + """ + Measure of memory used by buffers + """ + @staticmethod + def create_jvm_buffer_memory_usage(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="jvm.buffer.memory.usage", + description="Measure of memory used by buffers.", + unit="By", + ) + + + """ + Measure of initial memory requested + """ + @staticmethod + def create_jvm_memory_init(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="jvm.memory.init", + description="Measure of initial memory requested.", + unit="By", + ) + + + """ + Average CPU load of the whole system for the last minute as reported by the JVM + """ + @staticmethod + def create_jvm_system_cpu_load_1m(meter: Meter, callback: Sequence[Callable]) -> ObservableGauge: + return meter.create_observable_gauge( + name="jvm.system.cpu.load_1m", + callback=callback, + description="Average CPU load of the whole system for the last minute as reported by the JVM.", + unit="{run_queue_item}", + ) + + + """ + Recent CPU utilization for the whole system as reported by the JVM + """ + @staticmethod + def create_jvm_system_cpu_utilization(meter: Meter, callback: Sequence[Callable]) -> ObservableGauge: + return meter.create_observable_gauge( + name="jvm.system.cpu.utilization", + callback=callback, + description="Recent CPU utilization for the whole system as reported by the JVM.", + unit="1", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/k8s_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/k8s_attributes.py similarity index 91% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/k8s_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/k8s_attributes.py index 749f701ae93..83728f94333 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/k8s_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/k8s_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -128,6 +127,18 @@ """ +K8S_POD_ANNOTATION_TEMPLATE = "k8s.pod.annotation" +""" +The annotation key-value pairs placed on the Pod, the `` being the annotation name, the value being the annotation value. +""" + + +K8S_POD_LABELS_TEMPLATE = "k8s.pod.labels" +""" +The labels placed on the Pod, the `` being the label name, the value being the label value. +""" + + K8S_POD_NAME = "k8s.pod.name" """ The name of the Pod. diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/log_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/log_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/log_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/log_attributes.py index 567443235bd..40cfbb9124c 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/log_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/log_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,11 +54,9 @@ The id MAY be an [Universally Unique Lexicographically Sortable Identifier (ULID)](https://github.com/ulid/spec), but other identifiers (e.g. UUID) may be used as needed. """ - class LogIostreamValues(Enum): STDOUT = "stdout" """Logs from stdout stream.""" STDERR = "stderr" """Events from stderr stream.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/message_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/message_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/message_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/message_attributes.py index 7a3c6dac252..4c7fd0f42a7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/message_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/message_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,11 +41,9 @@ Uncompressed size of the message in bytes. """ - class MessageTypeValues(Enum): SENT = "SENT" """sent.""" RECEIVED = "RECEIVED" """received.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/messaging_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/messaging_attributes.py similarity index 89% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/messaging_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/messaging_attributes.py index 40dde311376..5f946fd3da3 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/messaging_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/messaging_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -72,6 +71,12 @@ """ +MESSAGING_GCP_PUBSUB_MESSAGE_ORDERING_KEY = "messaging.gcp_pubsub.message.ordering_key" +""" +The ordering key for a given message. If the attribute is not present, the message does not have an ordering key. +""" + + MESSAGING_KAFKA_CONSUMER_GROUP = "messaging.kafka.consumer.group" """ Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. @@ -200,10 +205,9 @@ MESSAGING_SYSTEM = "messaging.system" """ -A string identifying the messaging system. +An identifier for the messaging system being used. See below for a list of well-known identifiers. """ - class MessagingOperationValues(Enum): PUBLISH = "publish" """One or more messages are provided for publishing to an intermediary. If a single message is published, the context of the "Publish" span can be used as the creation context and no "Create" span needs to be created.""" @@ -216,16 +220,12 @@ class MessagingOperationValues(Enum): DELIVER = "deliver" """One or more messages are passed to a consumer. This operation refers to push-based scenarios, where consumer register callbacks which get called by messaging SDKs.""" - - class MessagingRocketmqConsumptionModelValues(Enum): CLUSTERING = "clustering" """Clustering consumption model.""" BROADCASTING = "broadcasting" """Broadcasting consumption model.""" - - class MessagingRocketmqMessageTypeValues(Enum): NORMAL = "normal" """Normal message.""" @@ -238,4 +238,33 @@ class MessagingRocketmqMessageTypeValues(Enum): TRANSACTION = "transaction" """Transaction message.""" +class MessagingSystemValues(Enum): + ACTIVEMQ = "activemq" + """Apache ActiveMQ.""" + + AWS_SQS = "aws_sqs" + """Amazon Simple Queue Service (SQS).""" + + AZURE_EVENTGRID = "azure_eventgrid" + """Azure Event Grid.""" + + AZURE_EVENTHUBS = "azure_eventhubs" + """Azure Event Hubs.""" + + AZURE_SERVICEBUS = "azure_servicebus" + """Azure Service Bus.""" + + GCP_PUBSUB = "gcp_pubsub" + """Google Cloud Pub/Sub.""" + + JMS = "jms" + """Java Message Service.""" + + KAFKA = "kafka" + """Apache Kafka.""" + + RABBITMQ = "rabbitmq" + """RabbitMQ.""" + ROCKETMQ = "rocketmq" + """Apache RocketMQ.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/messaging_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/messaging_metrics.py new file mode 100644 index 00000000000..ac01c33230c --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/messaging_metrics.py @@ -0,0 +1,95 @@ +# 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 opentelemetry.metrics import ( + Counter, + Histogram, + Meter, + UpDownCounter, + ObservableGauge, +) +from typing import Callable, Sequence + +class MessagingMetrics: + + """ + Measures the duration of deliver operation + """ + @staticmethod + def create_messaging_deliver_duration(meter: Meter) -> Histogram: + return meter.create_histogram( + name="messaging.deliver.duration", + description="Measures the duration of deliver operation.", + unit="s", + ) + + + """ + Measures the number of delivered messages + """ + @staticmethod + def create_messaging_deliver_messages(meter: Meter) -> Counter: + return meter.create_counter( + name="messaging.deliver.messages", + description="Measures the number of delivered messages.", + unit="{message}", + ) + + + """ + Measures the duration of publish operation + """ + @staticmethod + def create_messaging_publish_duration(meter: Meter) -> Histogram: + return meter.create_histogram( + name="messaging.publish.duration", + description="Measures the duration of publish operation.", + unit="s", + ) + + + """ + Measures the number of published messages + """ + @staticmethod + def create_messaging_publish_messages(meter: Meter) -> Counter: + return meter.create_counter( + name="messaging.publish.messages", + description="Measures the number of published messages.", + unit="{message}", + ) + + + """ + Measures the duration of receive operation + """ + @staticmethod + def create_messaging_receive_duration(meter: Meter) -> Histogram: + return meter.create_histogram( + name="messaging.receive.duration", + description="Measures the duration of receive operation.", + unit="s", + ) + + + """ + Measures the number of received messages + """ + @staticmethod + def create_messaging_receive_messages(meter: Meter) -> Counter: + return meter.create_counter( + name="messaging.receive.messages", + description="Measures the number of received messages.", + unit="{message}", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/net_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/net_attributes.py new file mode 100644 index 00000000000..e424b2c0344 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/net_attributes.py @@ -0,0 +1,133 @@ +# 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. + +# pylint: disable=too-many-lines + +from enum import Enum + + +NET_HOST_NAME = "net.host.name" +""" +Deprecated, use `server.address`. +Deprecated: Replaced by `server.address`. +""" + + +NET_HOST_PORT = "net.host.port" +""" +Deprecated, use `server.port`. +Deprecated: Replaced by `server.port`. +""" + + +NET_PEER_NAME = "net.peer.name" +""" +Deprecated, use `server.address` on client spans and `client.address` on server spans. +Deprecated: Replaced by `server.address` on client spans and `client.address` on server spans. +""" + + +NET_PEER_PORT = "net.peer.port" +""" +Deprecated, use `server.port` on client spans and `client.port` on server spans. +Deprecated: Replaced by `server.port` on client spans and `client.port` on server spans. +""" + + +NET_PROTOCOL_NAME = "net.protocol.name" +""" +Deprecated, use `network.protocol.name`. +Deprecated: Replaced by `network.protocol.name`. +""" + + +NET_PROTOCOL_VERSION = "net.protocol.version" +""" +Deprecated, use `network.protocol.version`. +Deprecated: Replaced by `network.protocol.version`. +""" + + +NET_SOCK_FAMILY = "net.sock.family" +""" +Deprecated, use `network.transport` and `network.type`. +Deprecated: Split to `network.transport` and `network.type`. +""" + + +NET_SOCK_HOST_ADDR = "net.sock.host.addr" +""" +Deprecated, use `network.local.address`. +Deprecated: Replaced by `network.local.address`. +""" + + +NET_SOCK_HOST_PORT = "net.sock.host.port" +""" +Deprecated, use `network.local.port`. +Deprecated: Replaced by `network.local.port`. +""" + + +NET_SOCK_PEER_ADDR = "net.sock.peer.addr" +""" +Deprecated, use `network.peer.address`. +Deprecated: Replaced by `network.peer.address`. +""" + + +NET_SOCK_PEER_NAME = "net.sock.peer.name" +""" +Deprecated, no replacement at this time. +Deprecated: Removed. +""" + + +NET_SOCK_PEER_PORT = "net.sock.peer.port" +""" +Deprecated, use `network.peer.port`. +Deprecated: Replaced by `network.peer.port`. +""" + + +NET_TRANSPORT = "net.transport" +""" +Deprecated, use `network.transport`. +Deprecated: Replaced by `network.transport`. +""" + +class NetSockFamilyValues(Enum): + INET = "inet" + """IPv4 address.""" + + INET6 = "inet6" + """IPv6 address.""" + + UNIX = "unix" + """Unix domain socket path.""" +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/v1_23_1/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/network_attributes.py similarity index 92% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/network_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/network_attributes.py index 1a8a0e2263e..3d40c8748e7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/network_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,6 +53,11 @@ """ +NETWORK_IO_DIRECTION = "network.io.direction" +""" +The network IO operation direction. +""" + class NetworkConnectionSubtypeValues(Enum): GPRS = "gprs" """GPRS.""" @@ -117,8 +121,6 @@ class NetworkConnectionSubtypeValues(Enum): LTE_CA = "lte_ca" """LTE CA.""" - - class NetworkConnectionTypeValues(Enum): WIFI = "wifi" """wifi.""" @@ -134,4 +136,9 @@ class NetworkConnectionTypeValues(Enum): UNKNOWN = "unknown" """unknown.""" +class NetworkIoDirectionValues(Enum): + TRANSMIT = "transmit" + """transmit.""" + RECEIVE = "receive" + """receive.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/oci_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/oci_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/oci_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/oci_attributes.py index 620c8ad105f..5e365afcddb 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/oci_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/oci_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/opentracing_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/opentracing_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/opentracing_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/opentracing_attributes.py index 2ccd79a11fc..e61edcb5cc2 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/opentracing_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/opentracing_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,11 +23,9 @@ Note: The causal relationship between a child Span and a parent Span. """ - class OpentracingRefTypeValues(Enum): CHILD_OF = "child_of" """The parent Span depends on the child Span in some capacity.""" FOLLOWS_FROM = "follows_from" """The parent Span doesn't depend in any way on the result of the child Span.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/os_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/os_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/os_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/os_attributes.py index 7565d59c60c..dd82bb10320 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/os_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/os_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -47,7 +46,6 @@ The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes). """ - class OsTypeValues(Enum): WINDOWS = "windows" """Microsoft Windows.""" @@ -81,4 +79,3 @@ class OsTypeValues(Enum): Z_OS = "z_os" """IBM z/OS.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/otel_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/otel_attributes.py similarity index 87% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/otel_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/otel_attributes.py index 7ee9e2e14df..917d242257e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/otel_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/otel_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,6 +17,18 @@ from enum import Enum +OTEL_LIBRARY_NAME = "otel.library.name" +""" +Deprecated, use the `otel.scope.name` attribute. +""" + + +OTEL_LIBRARY_VERSION = "otel.library.version" +""" +Deprecated, use the `otel.scope.version` attribute. +""" + + OTEL_SCOPE_NAME = "otel.scope.name" """ The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). @@ -41,11 +52,9 @@ Description of the Status if it has a value, otherwise not set. """ - class OtelStatusCodeValues(Enum): OK = "OK" """The operation has been validated by an Application developer or Operator to have completed successfully.""" ERROR = "ERROR" """The operation contains an error.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/other_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/other_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/other_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/other_attributes.py index b1917f1ce14..95d74f5cd93 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/other_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/other_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -23,11 +22,9 @@ The state of a connection in the pool. """ - class StateValues(Enum): IDLE = "idle" """idle.""" USED = "used" """used.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/peer_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/peer_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/peer_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/peer_attributes.py index 0ba120265e0..a3348f39c2a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/peer_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/peer_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/pool_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/pool_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/pool_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/pool_attributes.py index ea209078b84..b6f084bdf03 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/pool_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/pool_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/process_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/process_attributes.py similarity index 98% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/process_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/process_attributes.py index 21f69284bec..d70e505e41a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/process_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/process_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -54,7 +53,7 @@ PROCESS_PARENT_PID = "process.parent_pid" """ -Parent Process identifier (PID). +Parent Process identifier (PPID). """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/rpc_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/rpc_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/rpc_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/rpc_attributes.py index 76301db6729..c21494e6126 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/rpc_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/rpc_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -101,7 +100,6 @@ A string identifying the remoting system. See below for a list of well-known identifiers. """ - class RpcConnectRpcErrorCodeValues(Enum): CANCELLED = "cancelled" """cancelled.""" @@ -150,8 +148,6 @@ class RpcConnectRpcErrorCodeValues(Enum): UNAUTHENTICATED = "unauthenticated" """unauthenticated.""" - - class RpcGrpcStatusCodeValues(Enum): OK = 0 """OK.""" @@ -203,8 +199,6 @@ class RpcGrpcStatusCodeValues(Enum): UNAUTHENTICATED = 16 """UNAUTHENTICATED.""" - - class RpcSystemValues(Enum): GRPC = "grpc" """gRPC.""" @@ -220,4 +214,3 @@ class RpcSystemValues(Enum): CONNECT_RPC = "connect_rpc" """Connect RPC.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/rpc_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/rpc_metrics.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/rpc_metrics.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/rpc_metrics.py index c9c21f79493..09814dbe5a1 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/rpc_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/rpc_metrics.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -142,4 +141,3 @@ def create_rpc_server_responses_per_rpc(meter: Meter) -> Histogram: description="Measures the number of messages sent per RPC.", unit="{count}", ) - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/service_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/service_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/service_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/service_attributes.py index 1542b36e044..478fde07ddd 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/service_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/service_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/session_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/session_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/session_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/session_attributes.py index b413fa90fc0..aba3834afe8 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/session_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/session_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/signalr_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/signalr_attributes.py new file mode 100644 index 00000000000..d3ee33a4194 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/signalr_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. + +# pylint: disable=too-many-lines + +from enum import Enum + + +SIGNALR_CONNECTION_STATUS = "signalr.connection.status" +""" +SignalR HTTP connection closure status. +""" + + +SIGNALR_TRANSPORT = "signalr.transport" +""" +[SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md). +""" + +class SignalrConnectionStatusValues(Enum): + NORMAL_CLOSURE = "normal_closure" + """The connection was closed normally.""" + + TIMEOUT = "timeout" + """The connection was closed due to a timeout.""" + + APP_SHUTDOWN = "app_shutdown" + """The connection was closed because the app is shutting down.""" +class SignalrTransportValues(Enum): + SERVER_SENT_EVENTS = "server_sent_events" + """ServerSentEvents protocol.""" + + LONG_POLLING = "long_polling" + """LongPolling protocol.""" + + WEB_SOCKETS = "web_sockets" + """WebSockets protocol.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/signalr_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/signalr_metrics.py new file mode 100644 index 00000000000..e248d9ba8b6 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/signalr_metrics.py @@ -0,0 +1,47 @@ +# 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 opentelemetry.metrics import ( + Counter, + Histogram, + Meter, + UpDownCounter, + ObservableGauge, +) +from typing import Callable, Sequence + +class SignalrMetrics: + + """ + Number of connections that are currently active on the server + """ + @staticmethod + def create_signalr_server_active_connections(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name="signalr.server.active_connections", + description="Number of connections that are currently active on the server.", + unit="{connection}", + ) + + + """ + The duration of connections on the server + """ + @staticmethod + def create_signalr_server_connection_duration(meter: Meter) -> Histogram: + return meter.create_histogram( + name="signalr.server.connection.duration", + description="The duration of connections on the server.", + unit="s", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/source_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/source_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/source_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/source_attributes.py index 067f484bd81..1427f36e830 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/source_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/source_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/system_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/system_attributes.py similarity index 90% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/system_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/system_attributes.py index ded0296e7ae..e0204196f70 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/system_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/system_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,12 +35,6 @@ """ -SYSTEM_DISK_DIRECTION = "system.disk.direction" -""" -The disk operation direction. -""" - - SYSTEM_FILESYSTEM_MODE = "system.filesystem.mode" """ The filesystem mode. @@ -72,12 +65,6 @@ """ -SYSTEM_NETWORK_DIRECTION = "system.network.direction" -""" -. -""" - - SYSTEM_NETWORK_STATE = "system.network.state" """ A stateless protocol MUST NOT set this attribute. @@ -107,7 +94,6 @@ The process state, e.g., [Linux Process State Codes](https://man7.org/linux/man-pages/man1/ps.1.html#PROCESS_STATE_CODES). """ - class SystemCpuStateValues(Enum): USER = "user" """user.""" @@ -129,16 +115,6 @@ class SystemCpuStateValues(Enum): STEAL = "steal" """steal.""" - - -class SystemDiskDirectionValues(Enum): - READ = "read" - """read.""" - - WRITE = "write" - """write.""" - - class SystemFilesystemStateValues(Enum): USED = "used" """used.""" @@ -148,8 +124,6 @@ class SystemFilesystemStateValues(Enum): RESERVED = "reserved" """reserved.""" - - class SystemFilesystemTypeValues(Enum): FAT32 = "fat32" """fat32.""" @@ -168,8 +142,6 @@ class SystemFilesystemTypeValues(Enum): EXT4 = "ext4" """ext4.""" - - class SystemMemoryStateValues(Enum): USED = "used" """used.""" @@ -185,16 +157,6 @@ class SystemMemoryStateValues(Enum): CACHED = "cached" """cached.""" - - -class SystemNetworkDirectionValues(Enum): - TRANSMIT = "transmit" - """transmit.""" - - RECEIVE = "receive" - """receive.""" - - class SystemNetworkStateValues(Enum): CLOSE = "close" """close.""" @@ -231,32 +193,24 @@ class SystemNetworkStateValues(Enum): TIME_WAIT = "time_wait" """time_wait.""" - - class SystemPagingDirectionValues(Enum): IN = "in" """in.""" OUT = "out" """out.""" - - class SystemPagingStateValues(Enum): USED = "used" """used.""" FREE = "free" """free.""" - - class SystemPagingTypeValues(Enum): MAJOR = "major" """major.""" MINOR = "minor" """minor.""" - - class SystemProcessesStatusValues(Enum): RUNNING = "running" """running.""" @@ -269,4 +223,3 @@ class SystemProcessesStatusValues(Enum): DEFUNCT = "defunct" """defunct.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/system_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/system_metrics.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/system_metrics.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/system_metrics.py index 88411f9b651..32a969ef833 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/system_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/system_metrics.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -351,4 +350,3 @@ def create_system_processes_created(meter: Meter) -> Counter: description="Total number of processes created over uptime of the host", unit="{process}", ) - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/telemetry_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/telemetry_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/telemetry_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/telemetry_attributes.py index a2858ad3ec0..a880b38e70e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/telemetry_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/telemetry_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -55,7 +54,6 @@ The version string of the telemetry SDK. """ - class TelemetrySdkLanguageValues(Enum): CPP = "cpp" """cpp.""" @@ -92,4 +90,3 @@ class TelemetrySdkLanguageValues(Enum): WEBJS = "webjs" """webjs.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/thread_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/thread_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/thread_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/thread_attributes.py index 214625e5711..02697fd5a02 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/thread_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/thread_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/tls_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/tls_attributes.py new file mode 100644 index 00000000000..3995089079a --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/tls_attributes.py @@ -0,0 +1,199 @@ +# 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. + +# pylint: disable=too-many-lines + +from enum import Enum + + +TLS_CIPHER = "tls.cipher" +""" +String indicating the [cipher](https://datatracker.ietf.org/doc/html/rfc5246#appendix-A.5) used during the current connection. +Note: The values allowed for `tls.cipher` MUST be one of the `Descriptions` of the [registered TLS Cipher Suits](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#table-tls-parameters-4). +""" + + +TLS_CLIENT_CERTIFICATE = "tls.client.certificate" +""" +PEM-encoded stand-alone certificate offered by the client. This is usually mutually-exclusive of `client.certificate_chain` since this value also exists in that list. +""" + + +TLS_CLIENT_CERTIFICATE_CHAIN = "tls.client.certificate_chain" +""" +Array of PEM-encoded certificates that make up the certificate chain offered by the client. This is usually mutually-exclusive of `client.certificate` since that value should be the first certificate in the chain. +""" + + +TLS_CLIENT_HASH_MD5 = "tls.client.hash.md5" +""" +Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash. +""" + + +TLS_CLIENT_HASH_SHA1 = "tls.client.hash.sha1" +""" +Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash. +""" + + +TLS_CLIENT_HASH_SHA256 = "tls.client.hash.sha256" +""" +Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the client. For consistency with other hash values, this value should be formatted as an uppercase hash. +""" + + +TLS_CLIENT_ISSUER = "tls.client.issuer" +""" +Distinguished name of [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of the issuer of the x.509 certificate presented by the client. +""" + + +TLS_CLIENT_JA3 = "tls.client.ja3" +""" +A hash that identifies clients based on how they perform an SSL/TLS handshake. +""" + + +TLS_CLIENT_NOT_AFTER = "tls.client.not_after" +""" +Date/Time indicating when client certificate is no longer considered valid. +""" + + +TLS_CLIENT_NOT_BEFORE = "tls.client.not_before" +""" +Date/Time indicating when client certificate is first considered valid. +""" + + +TLS_CLIENT_SERVER_NAME = "tls.client.server_name" +""" +Also called an SNI, this tells the server which hostname to which the client is attempting to connect to. +""" + + +TLS_CLIENT_SUBJECT = "tls.client.subject" +""" +Distinguished name of subject of the x.509 certificate presented by the client. +""" + + +TLS_CLIENT_SUPPORTED_CIPHERS = "tls.client.supported_ciphers" +""" +Array of ciphers offered by the client during the client hello. +""" + + +TLS_CURVE = "tls.curve" +""" +String indicating the curve used for the given cipher, when applicable. +""" + + +TLS_ESTABLISHED = "tls.established" +""" +Boolean flag indicating if the TLS negotiation was successful and transitioned to an encrypted tunnel. +""" + + +TLS_NEXT_PROTOCOL = "tls.next_protocol" +""" +String indicating the protocol being tunneled. Per the values in the [IANA registry](https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids), this string should be lower case. +""" + + +TLS_PROTOCOL_NAME = "tls.protocol.name" +""" +Normalized lowercase protocol name parsed from original string of the negotiated [SSL/TLS protocol version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES). +""" + + +TLS_PROTOCOL_VERSION = "tls.protocol.version" +""" +Numeric part of the version parsed from the original string of the negotiated [SSL/TLS protocol version](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html#RETURN-VALUES). +""" + + +TLS_RESUMED = "tls.resumed" +""" +Boolean flag indicating if this TLS connection was resumed from an existing TLS negotiation. +""" + + +TLS_SERVER_CERTIFICATE = "tls.server.certificate" +""" +PEM-encoded stand-alone certificate offered by the server. This is usually mutually-exclusive of `server.certificate_chain` since this value also exists in that list. +""" + + +TLS_SERVER_CERTIFICATE_CHAIN = "tls.server.certificate_chain" +""" +Array of PEM-encoded certificates that make up the certificate chain offered by the server. This is usually mutually-exclusive of `server.certificate` since that value should be the first certificate in the chain. +""" + + +TLS_SERVER_HASH_MD5 = "tls.server.hash.md5" +""" +Certificate fingerprint using the MD5 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash. +""" + + +TLS_SERVER_HASH_SHA1 = "tls.server.hash.sha1" +""" +Certificate fingerprint using the SHA1 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash. +""" + + +TLS_SERVER_HASH_SHA256 = "tls.server.hash.sha256" +""" +Certificate fingerprint using the SHA256 digest of DER-encoded version of certificate offered by the server. For consistency with other hash values, this value should be formatted as an uppercase hash. +""" + + +TLS_SERVER_ISSUER = "tls.server.issuer" +""" +Distinguished name of [subject](https://datatracker.ietf.org/doc/html/rfc5280#section-4.1.2.6) of the issuer of the x.509 certificate presented by the client. +""" + + +TLS_SERVER_JA3S = "tls.server.ja3s" +""" +A hash that identifies servers based on how they perform an SSL/TLS handshake. +""" + + +TLS_SERVER_NOT_AFTER = "tls.server.not_after" +""" +Date/Time indicating when server certificate is no longer considered valid. +""" + + +TLS_SERVER_NOT_BEFORE = "tls.server.not_before" +""" +Date/Time indicating when server certificate is first considered valid. +""" + + +TLS_SERVER_SUBJECT = "tls.server.subject" +""" +Distinguished name of subject of the x.509 certificate presented by the server. +""" + +class TlsProtocolNameValues(Enum): + SSL = "ssl" + """ssl.""" + + TLS = "tls" + """tls.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/webengine_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/webengine_attributes.py similarity index 99% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/webengine_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/webengine_attributes.py index 39c693fc160..75ae07f2dc4 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/webengine_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/experimental/webengine_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/http_attributes.py index 42189dcd5aa..bd7f6706285 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/http_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/http_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -82,7 +81,6 @@ SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. """ - class HttpRequestMethodValues(Enum): CONNECT = "CONNECT" """CONNECT method.""" @@ -113,4 +111,3 @@ class HttpRequestMethodValues(Enum): OTHER = "_OTHER" """Any HTTP method that the instrumentation has no prior knowledge of.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/jvm_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/jvm_attributes.py similarity index 90% rename from opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/jvm_attributes.py rename to opentelemetry-semantic-conventions/src/opentelemetry/semconv/jvm_attributes.py index 0de5209de94..fa208512c2e 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/jvm_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/jvm_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -18,13 +17,6 @@ from enum import Enum -JVM_BUFFER_POOL_NAME = "jvm.buffer.pool.name" -""" -Name of the buffer pool. -Note: Pool names are generally obtained via [BufferPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/BufferPoolMXBean.html#getName()). -""" - - JVM_GC_ACTION = "jvm.gc.action" """ Name of the garbage collector action. @@ -63,15 +55,12 @@ State of the thread. """ - class JvmMemoryTypeValues(Enum): HEAP = "heap" """Heap memory.""" NON_HEAP = "non_heap" """Non-heap memory.""" - - class JvmThreadStateValues(Enum): NEW = "new" """A thread that has not yet started is in this state.""" @@ -90,4 +79,3 @@ class JvmThreadStateValues(Enum): TERMINATED = "terminated" """A thread that has exited is in this state.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py index 9cd7cee94f9..bd0e50a2a64 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/metrics/__init__.py @@ -84,9 +84,7 @@ class MetricInstruments: Unit: 1 """ - PROCESS_RUNTIME_JVM_SYSTEM_CPU_LOAD_1M = ( - "process.runtime.jvm.system.cpu.load_1m" - ) + PROCESS_RUNTIME_JVM_SYSTEM_CPU_LOAD_1M = "process.runtime.jvm.system.cpu.load_1m" """ Average CPU load of the whole system for the last minute as reported by the JVM Instrument: gauge @@ -121,9 +119,7 @@ class MetricInstruments: Unit: By """ - PROCESS_RUNTIME_JVM_MEMORY_COMMITTED = ( - "process.runtime.jvm.memory.committed" - ) + PROCESS_RUNTIME_JVM_MEMORY_COMMITTED = "process.runtime.jvm.memory.committed" """ Measure of memory committed Instrument: updowncounter @@ -167,9 +163,7 @@ class MetricInstruments: Unit: {class} """ - PROCESS_RUNTIME_JVM_CLASSES_UNLOADED = ( - "process.runtime.jvm.classes.unloaded" - ) + PROCESS_RUNTIME_JVM_CLASSES_UNLOADED = "process.runtime.jvm.classes.unloaded" """ Number of classes unloaded since JVM start Instrument: counter diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/network_attributes.py index 154e4d8e31a..491d8e5b919 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/network_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -73,7 +72,6 @@ Note: The value SHOULD be normalized to lowercase. """ - class NetworkTransportValues(Enum): TCP = "tcp" """TCP.""" @@ -86,12 +84,9 @@ class NetworkTransportValues(Enum): UNIX = "unix" """Unix domain socket.""" - - class NetworkTypeValues(Enum): IPV4 = "ipv4" """IPv4.""" IPV6 = "ipv6" """IPv6.""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py index ccfbf5a8d09..b02ebe98ccf 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py @@ -1,4 +1,29 @@ +# 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 + class Schemas(Enum): - # TODO: manual, need to automate V1_23_1 = "https://opentelemetry.io/schemas/1.23.1" - """https://opentelemetry.io/schemas/1.23.1""" + """ + The URL of the OpenTelemetry schema version 1.23.1. + """ + + V1_24_0 = "https://opentelemetry.io/schemas/v1.24.0" + """ + The URL of the OpenTelemetry schema version v1.24.0. + """ + + # when generating new semantic conventions, + # make sure to add new versions version here. \ No newline at end of file diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/server_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/server_attributes.py index 6d04161183f..19645d5bcf2 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/server_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/server_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py index 48df586dc18..9beaf0d5d98 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/trace/__init__.py @@ -691,9 +691,7 @@ class SpanAttributes: The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". """ - MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = ( - "messaging.message.payload_size_bytes" - ) + MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = "messaging.message.payload_size_bytes" """ The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. """ @@ -876,23 +874,17 @@ class SpanAttributes: The JSON-serialized value of each item in the `ConsumedCapacity` response field. """ - AWS_DYNAMODB_ITEM_COLLECTION_METRICS = ( - "aws.dynamodb.item_collection_metrics" - ) + AWS_DYNAMODB_ITEM_COLLECTION_METRICS = "aws.dynamodb.item_collection_metrics" """ The JSON-serialized value of the `ItemCollectionMetrics` response field. """ - AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = ( - "aws.dynamodb.provisioned_read_capacity" - ) + AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = "aws.dynamodb.provisioned_read_capacity" """ The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. """ - AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = ( - "aws.dynamodb.provisioned_write_capacity" - ) + AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = "aws.dynamodb.provisioned_write_capacity" """ The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. """ @@ -927,16 +919,12 @@ class SpanAttributes: The value of the `Select` request parameter. """ - AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = ( - "aws.dynamodb.global_secondary_indexes" - ) + AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = "aws.dynamodb.global_secondary_indexes" """ The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. """ - AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = ( - "aws.dynamodb.local_secondary_indexes" - ) + AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = "aws.dynamodb.local_secondary_indexes" """ The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. """ @@ -1092,9 +1080,7 @@ class SpanAttributes: Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. """ - MESSAGING_KAFKA_DESTINATION_PARTITION = ( - "messaging.kafka.destination.partition" - ) + MESSAGING_KAFKA_DESTINATION_PARTITION = "messaging.kafka.destination.partition" """ Partition the message is sent to. """ @@ -1153,9 +1139,7 @@ class SpanAttributes: Key(s) of message, another way to mark message besides message id. """ - MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = ( - "messaging.rocketmq.consumption_model" - ) + MESSAGING_ROCKETMQ_CONSUMPTION_MODEL = "messaging.rocketmq.consumption_model" """ Model of message consumption. This only applies to consumer spans. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/url_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/url_attributes.py index 990d6966c7d..fb0c6029487 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/url_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/url_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/user_agent_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/user_agent_attributes.py index 58196fca9a6..3a86c383d3f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/user_agent_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/user_agent_attributes.py @@ -1,4 +1,3 @@ - # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/http_attributes.py deleted file mode 100644 index 327dc61a053..00000000000 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/http_attributes.py +++ /dev/null @@ -1,29 +0,0 @@ - -# 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. - -# pylint: disable=too-many-lines - - -HTTP_REQUEST_BODY_SIZE = "http.request.body.size" -""" -The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. -""" - - -HTTP_RESPONSE_BODY_SIZE = "http.response.body.size" -""" -The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. -""" - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/jvm_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/jvm_metrics.py deleted file mode 100644 index 798b4b19a7d..00000000000 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/v1_23_1/jvm_metrics.py +++ /dev/null @@ -1,244 +0,0 @@ - -# 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 opentelemetry.metrics import ( - Counter, - Histogram, - Meter, - UpDownCounter, - ObservableGauge, -) -from typing import Callable, Sequence - -class JvmMetrics: - - """ - Number of buffers in the pool - """ - @staticmethod - def create_jvm_buffer_count(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.buffer.count", - description="Number of buffers in the pool.", - unit="{buffer}", - ) - - - """ - Measure of total memory capacity of buffers - """ - @staticmethod - def create_jvm_buffer_memory_limit(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.buffer.memory.limit", - description="Measure of total memory capacity of buffers.", - unit="By", - ) - - - """ - Measure of memory used by buffers - """ - @staticmethod - def create_jvm_buffer_memory_usage(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.buffer.memory.usage", - description="Measure of memory used by buffers.", - unit="By", - ) - - - """ - Number of classes currently loaded - """ - @staticmethod - def create_jvm_class_count(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.class.count", - description="Number of classes currently loaded.", - unit="{class}", - ) - - - """ - Number of classes loaded since JVM start - """ - @staticmethod - def create_jvm_class_loaded(meter: Meter) -> Counter: - return meter.create_counter( - name="jvm.class.loaded", - description="Number of classes loaded since JVM start.", - unit="{class}", - ) - - - """ - Number of classes unloaded since JVM start - """ - @staticmethod - def create_jvm_class_unloaded(meter: Meter) -> Counter: - return meter.create_counter( - name="jvm.class.unloaded", - description="Number of classes unloaded since JVM start.", - unit="{class}", - ) - - - """ - Number of processors available to the Java virtual machine - """ - @staticmethod - def create_jvm_cpu_count(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.cpu.count", - description="Number of processors available to the Java virtual machine.", - unit="{cpu}", - ) - - - """ - Recent CPU utilization for the process as reported by the JVM - """ - @staticmethod - def create_jvm_cpu_recent_utilization(meter: Meter, callback: Sequence[Callable]) -> ObservableGauge: - return meter.create_observable_gauge( - name="jvm.cpu.recent_utilization", - callback=callback, - description="Recent CPU utilization for the process as reported by the JVM.", - unit="1", - ) - - - """ - CPU time used by the process as reported by the JVM - """ - @staticmethod - def create_jvm_cpu_time(meter: Meter) -> Counter: - return meter.create_counter( - name="jvm.cpu.time", - description="CPU time used by the process as reported by the JVM.", - unit="s", - ) - - - """ - Duration of JVM garbage collection actions - """ - @staticmethod - def create_jvm_gc_duration(meter: Meter) -> Histogram: - return meter.create_histogram( - name="jvm.gc.duration", - description="Duration of JVM garbage collection actions.", - unit="s", - ) - - - """ - Measure of memory committed - """ - @staticmethod - def create_jvm_memory_committed(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.memory.committed", - description="Measure of memory committed.", - unit="By", - ) - - - """ - Measure of initial memory requested - """ - @staticmethod - def create_jvm_memory_init(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.memory.init", - description="Measure of initial memory requested.", - unit="By", - ) - - - """ - Measure of max obtainable memory - """ - @staticmethod - def create_jvm_memory_limit(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.memory.limit", - description="Measure of max obtainable memory.", - unit="By", - ) - - - """ - Measure of memory used - """ - @staticmethod - def create_jvm_memory_usage(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.memory.usage", - description="Measure of memory used.", - unit="By", - ) - - - """ - Measure of memory used, as measured after the most recent garbage collection event on this pool - """ - @staticmethod - def create_jvm_memory_usage_after_last_gc(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.memory.usage_after_last_gc", - description="Measure of memory used, as measured after the most recent garbage collection event on this pool.", - unit="By", - ) - - - """ - Average CPU load of the whole system for the last minute as reported by the JVM - """ - @staticmethod - def create_jvm_system_cpu_load_1m(meter: Meter, callback: Sequence[Callable]) -> ObservableGauge: - return meter.create_observable_gauge( - name="jvm.system.cpu.load_1m", - callback=callback, - description="Average CPU load of the whole system for the last minute as reported by the JVM.", - unit="{run_queue_item}", - ) - - - """ - Recent CPU utilization for the whole system as reported by the JVM - """ - @staticmethod - def create_jvm_system_cpu_utilization(meter: Meter, callback: Sequence[Callable]) -> ObservableGauge: - return meter.create_observable_gauge( - name="jvm.system.cpu.utilization", - callback=callback, - description="Recent CPU utilization for the whole system as reported by the JVM.", - unit="1", - ) - - - """ - Number of executing platform threads - """ - @staticmethod - def create_jvm_thread_count(meter: Meter) -> UpDownCounter: - return meter.create_up_down_counter( - name="jvm.thread.count", - description="Number of executing platform threads.", - unit="{thread}", - ) - diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index 0bcd90906ed..9dfebd55e0b 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -4,22 +4,29 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../../" # freeze the spec version to make SemanticAttributes generation reproducible -SPEC_VERSION=v1.23.1 -SPEC_VERSION_ESCAPED=v1_23_1 -SCHEMA_URL=https://opentelemetry.io/schemas/$SPEC_VERSION +SEMCONV_VERSION=v1.24.0 OTEL_SEMCONV_GEN_IMG_VERSION=feature-codegen-by-namespace - +EXPERIMENTAL_DIR=experimental cd ${SCRIPT_DIR} -rm -rf semantic-conventions || true -mkdir semantic-conventions -cd semantic-conventions +#rm -rf semantic-conventions || true +#mkdir semantic-conventions +#cd semantic-conventions -git init -git remote add origin https://github.com/open-telemetry/semantic-conventions.git -git fetch origin "$SPEC_VERSION" -git reset --hard FETCH_HEAD -cd ${SCRIPT_DIR} +#git init +#git remote add origin https://github.com/open-telemetry/semantic-conventions.git +#git fetch origin "$SEMCONV_VERSION" +#git reset --hard FETCH_HEAD +#cd ${SCRIPT_DIR} + +# Check new schema version was added to schemas.py manually +SCHEMAS_PY_PATH=${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py +CURRENT_SCHEMAS=$(cat $SCHEMAS_PY_PATH) + +if ! grep -q $SEMCONV_VERSION "$SCHEMAS_PY_PATH"; then + echo "Error: schema version $SEMCONV_VERSION is not found in $SCHEMAS_PY_PATH. Please add it manually." + exit 1 +fi # stable attributes docker run --rm \ @@ -27,22 +34,26 @@ docker run --rm \ -v ${SCRIPT_DIR}/templates:/templates \ -v ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/:/output \ otel/semconvgen:$OTEL_SEMCONV_GEN_IMG_VERSION \ - -f /source code \ + -f /source \ + --strict-validation false \ + code \ --template /templates/semantic_attributes.j2 \ --output /output/{{snake_prefix}}_attributes.py \ --file-per-group root_namespace \ -Dfilter=is_stable -mkdir -p ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/$SPEC_VERSION_ESCAPED -# experimental attributes +# experimental attributes and metrics +mkdir -p ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/$EXPERIMENTAL_DIR docker run --rm \ -v ${SCRIPT_DIR}/semantic-conventions/model:/source \ -v ${SCRIPT_DIR}/templates:/templates \ -v ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/:/output \ otel/semconvgen:$OTEL_SEMCONV_GEN_IMG_VERSION \ - -f /source code \ + -f /source \ + --strict-validation false \ + code \ --template /templates/semantic_attributes.j2 \ - --output /output/$SPEC_VERSION_ESCAPED/{{snake_prefix}}_attributes.py \ + --output /output/$EXPERIMENTAL_DIR/{{snake_prefix}}_attributes.py \ --file-per-group root_namespace \ -Dfilter=is_experimental @@ -52,9 +63,11 @@ docker run --rm \ -v ${SCRIPT_DIR}/templates:/templates \ -v ${ROOT_DIR}/opentelemetry-semantic-conventions/src/opentelemetry/semconv/:/output \ otel/semconvgen:$OTEL_SEMCONV_GEN_IMG_VERSION \ - -f /source code \ + -f /source \ + --strict-validation false \ + code \ --template /templates/semantic_metrics.j2 \ - --output /output/$SPEC_VERSION_ESCAPED/{{snake_prefix}}_metrics.py \ + --output /output/$EXPERIMENTAL_DIR/{{snake_prefix}}_metrics.py \ --file-per-group root_namespace \ -Dfilter=is_experimental diff --git a/scripts/semconv/templates/semantic_attributes.j2 b/scripts/semconv/templates/semantic_attributes.j2 index 09b88d245ca..852c166f948 100644 --- a/scripts/semconv/templates/semantic_attributes.j2 +++ b/scripts/semconv/templates/semantic_attributes.j2 @@ -1,5 +1,5 @@ -{%- set filtered_attributes = attributes_and_templates | select(filter) | list %} -{%- if filtered_attributes | count > 0 %} +{%- set filtered_attributes = attributes_and_templates | select(filter) | list -%} +{%- if filtered_attributes | count > 0 -%} # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,13 +42,13 @@ Deprecated: {{attribute.deprecated | to_doc_brief}}. {%- endfor %} {# Extra line #} {# Extra line #} -{%- for attribute in filtered_enum_attributes %} -{%- set class_name = attribute.fqn | to_camelcase(True) ~ "Values" %} +{%- for attribute in filtered_enum_attributes -%} +{%- set class_name = attribute.fqn | to_camelcase(True) ~ "Values" -%} class {{class_name}}(Enum): {%- for member in attribute.attr_type.members %} {{ member.member_id | to_const_name }} = {{ attribute | print_member_value(member) }} """{{member.brief | to_doc_brief}}.""" {# Extra line #} - {%- endfor %} + {%- endfor -%} {% endfor %} -{%- endif %} \ No newline at end of file +{%- endif -%} \ No newline at end of file diff --git a/scripts/semconv/templates/semantic_metrics.j2 b/scripts/semconv/templates/semantic_metrics.j2 index 3742150e4c1..1bb3bf1760e 100644 --- a/scripts/semconv/templates/semantic_metrics.j2 +++ b/scripts/semconv/templates/semantic_metrics.j2 @@ -20,8 +20,8 @@ ObservableGauge {%- endif -%} {%- endmacro %} -{%- set filtered_metrics = metrics | select(filter) | list %} -{%- if filtered_metrics | count > 0 %} +{%- set filtered_metrics = metrics | select(filter) | list -%} +{%- if filtered_metrics | count > 0 -%} # Copyright The OpenTelemetry Authors # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -66,4 +66,4 @@ class {{ root_namespace | to_camelcase(True) }}Metrics: unit="{{ metric.unit }}", ) {% endfor %} -{% endif %} \ No newline at end of file +{%- endif -%} \ No newline at end of file