From bca57ebd55edc242e948a55f3f13c675b68f6029 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 23 Jan 2025 20:30:43 -0800 Subject: [PATCH 1/5] Generate upcoming semconv (dry run) --- .../attributes/artifact_attributes.py | 2 +- .../_incubating/attributes/aws_attributes.py | 7 +- .../_incubating/attributes/cicd_attributes.py | 53 ++ .../attributes/cloud_attributes.py | 6 + .../_incubating/attributes/code_attributes.py | 28 +- .../_incubating/attributes/db_attributes.py | 11 - .../attributes/event_attributes.py | 3 +- .../attributes/exception_attributes.py | 2 +- .../_incubating/attributes/faas_attributes.py | 2 +- .../attributes/gen_ai_attributes.py | 27 +- .../_incubating/attributes/k8s_attributes.py | 26 +- .../attributes/network_attributes.py | 31 + .../attributes/process_attributes.py | 2 +- .../attributes/profile_attributes.py | 2 + .../_incubating/attributes/rpc_attributes.py | 2 +- .../attributes/security_rule_attributes.py | 64 ++ .../attributes/system_attributes.py | 5 +- .../_incubating/attributes/vcs_attributes.py | 52 +- .../_incubating/metrics/cicd_metrics.py | 110 ++++ .../_incubating/metrics/k8s_metrics.py | 546 ++++++++++++++++++ .../_incubating/metrics/system_metrics.py | 2 + .../_incubating/metrics/vcs_metrics.py | 28 +- .../attributes/exception_attributes.py | 18 +- .../semconv/attributes/network_attributes.py | 5 - scripts/semconv/generate.sh | 2 +- 25 files changed, 963 insertions(+), 73 deletions(-) create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/artifact_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/artifact_attributes.py index 28921f7e296..4f062343e9d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/artifact_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/artifact_attributes.py @@ -21,7 +21,7 @@ ARTIFACT_ATTESTATION_HASH: Final = "artifact.attestation.hash" """ -The full [hash value (see glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), of the built attestation. Some envelopes in the software attestation space also refer to this as the [digest](https://github.com/in-toto/attestation/blob/main/spec/README.md#in-toto-attestation-framework-spec). +The full [hash value (see glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), of the built attestation. Some envelopes in the [software attestation space](https://github.com/in-toto/attestation/tree/main/spec) also refer to this as the **digest**. """ ARTIFACT_ATTESTATION_ID: Final = "artifact.attestation.id" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py index a208e56a601..70a991ccae3 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/aws_attributes.py @@ -181,6 +181,11 @@ The ARN of an EKS cluster. """ +AWS_EXTENDED_REQUEST_ID: Final = "aws.extended_request_id" +""" +The AWS extended request ID as returned in the response header `x-amz-id-2`. +""" + AWS_LAMBDA_INVOKED_ARN: Final = "aws.lambda.invoked_arn" """ The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). @@ -212,7 +217,7 @@ AWS_REQUEST_ID: Final = "aws.request_id" """ -The AWS request ID as returned in the response headers `x-amz-request-id` or `x-amz-requestid`. +The AWS request ID as returned in the response headers `x-amzn-requestid`, `x-amzn-request-id` or `x-amz-request-id`. """ AWS_S3_BUCKET: Final = "aws.s3.bucket" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cicd_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cicd_attributes.py index 674d8cfe9d3..e1a469bc307 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cicd_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cicd_attributes.py @@ -20,11 +20,21 @@ The human readable name of the pipeline within a CI/CD system. """ +CICD_PIPELINE_RESULT: Final = "cicd.pipeline.result" +""" +The result of a pipeline run. +""" + CICD_PIPELINE_RUN_ID: Final = "cicd.pipeline.run.id" """ The unique identifier of a pipeline run within a CI/CD system. """ +CICD_PIPELINE_RUN_STATE: Final = "cicd.pipeline.run.state" +""" +The pipeline run goes through these states during its lifecycle. +""" + CICD_PIPELINE_TASK_NAME: Final = "cicd.pipeline.task.name" """ The human readable name of a task within a pipeline. Task here most closely aligns with a [computing process](https://wikipedia.org/wiki/Pipeline_(computing)) in a pipeline. Other terms for tasks include commands, steps, and procedures. @@ -45,6 +55,40 @@ The type of the task within a pipeline. """ +CICD_SYSTEM_COMPONENT: Final = "cicd.system.component" +""" +The name of a component of the CICD system. +""" + +CICD_WORKER_STATE: Final = "cicd.worker.state" +""" +The state of a CICD worker / agent. +""" + + +class CicdPipelineResultValues(Enum): + SUCCESS = "success" + """The pipeline run finished successfully.""" + FAILURE = "failure" + """The pipeline run did not finish successfully, eg. due to a compile error or a failing test. Such failures are usually detected by non-zero exit codes of the tools executed in the pipeline run.""" + ERROR = "error" + """The pipeline run failed due to an error in the CICD system, eg. due to the worker being killed.""" + TIMEOUT = "timeout" + """A timeout caused the pipeline run to be interrupted.""" + CANCELLATION = "cancellation" + """The pipeline run was cancelled, eg. by a user manually cancelling the pipeline run.""" + SKIP = "skip" + """The pipeline run was skipped, eg. due to a precondition not being met.""" + + +class CicdPipelineRunStateValues(Enum): + PENDING = "pending" + """The run pending state spans from the event triggering the pipeline run until the execution of the run starts (eg. time spent in a queue, provisioning agents, creating run resources).""" + EXECUTING = "executing" + """The executing state spans the execution of any run tasks (eg. build, test).""" + FINALIZING = "finalizing" + """The finalizing state spans from when the run has finished executing (eg. cleanup of run resources).""" + class CicdPipelineTaskTypeValues(Enum): BUILD = "build" @@ -53,3 +97,12 @@ class CicdPipelineTaskTypeValues(Enum): """test.""" DEPLOY = "deploy" """deploy.""" + + +class CicdWorkerStateValues(Enum): + AVAILABLE = "available" + """The worker is not performing work for the CICD system. It is available to the CICD system to perform work on (online / idle).""" + BUSY = "busy" + """The worker is performing work for the CICD system.""" + OFFLINE = "offline" + """The worker is not available to the CICD system (disconnected / down).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py index 11b912d6605..97047a063fd 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cloud_attributes.py @@ -117,6 +117,10 @@ class CloudPlatformValues(Enum): """Red Hat OpenShift on Google Cloud.""" IBM_CLOUD_OPENSHIFT = "ibm_cloud_openshift" """Red Hat OpenShift on IBM Cloud.""" + ORACLE_CLOUD_COMPUTE = "oracle_cloud_compute" + """Compute on Oracle Cloud Infrastructure (OCI).""" + ORACLE_CLOUD_OKE = "oracle_cloud_oke" + """Kubernetes Engine (OKE) on Oracle Cloud Infrastructure (OCI).""" TENCENT_CLOUD_CVM = "tencent_cloud_cvm" """Tencent Cloud Cloud Virtual Machine (CVM).""" TENCENT_CLOUD_EKS = "tencent_cloud_eks" @@ -138,5 +142,7 @@ class CloudProviderValues(Enum): """Heroku Platform as a Service.""" IBM_CLOUD = "ibm_cloud" """IBM Cloud.""" + ORACLE_CLOUD = "oracle_cloud" + """Oracle Cloud Infrastructure (OCI).""" TENCENT_CLOUD = "tencent_cloud" """Tencent Cloud.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py index 81aacca6e93..4a058e16ede 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/code_attributes.py @@ -16,27 +16,47 @@ CODE_COLUMN: Final = "code.column" """ -The column number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. +Deprecated: Replaced by `code.column.number`. """ -CODE_FILEPATH: Final = "code.filepath" +CODE_COLUMN_NUMBER: Final = "code.column.number" +""" +The column number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. +""" + +CODE_FILE_PATH: Final = "code.file.path" """ The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). """ +CODE_FILEPATH: Final = "code.filepath" +""" +Deprecated, use `code.file.path` instead. +""" + CODE_FUNCTION: Final = "code.function" """ +Deprecated: Replaced by `code.function.name`. +""" + +CODE_FUNCTION_NAME: Final = "code.function.name" +""" The method or function name, or equivalent (usually rightmost part of the code unit's name). """ +CODE_LINE_NUMBER: Final = "code.line.number" +""" +The line number in `code.file.path` best representing the operation. It SHOULD point within the code unit named in `code.function.name`. +""" + CODE_LINENO: Final = "code.lineno" """ -The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. +Deprecated: Replaced by `code.line.number`. """ CODE_NAMESPACE: Final = "code.namespace" """ -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. +The "namespace" within which `code.function.name` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function.name` form a unique identifier for the code unit. """ CODE_STACKTRACE: Final = "code.stacktrace" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py index 85e10235e1f..2011c0be41d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py @@ -84,8 +84,6 @@ For batch operations, if the individual operations are known to have the same collection name then that collection name SHOULD be used. - -This attribute has stability level RELEASE CANDIDATE. """ DB_CONNECTION_STRING: Final = "db.connection_string" @@ -193,7 +191,6 @@ Note: If a database system has multiple namespace components, they SHOULD be concatenated (potentially using database system specific conventions) from most general to most specific namespace component, and more specific namespaces SHOULD NOT be captured without the more general namespaces, to ensure that "startswith" queries for the more general namespaces will be valid. Semantic conventions for individual database systems SHOULD document what `db.namespace` means in the context of that system. It is RECOMMENDED to capture the value as provided by the application without attempting to do any case normalization. -This attribute has stability level RELEASE CANDIDATE. """ DB_OPERATION: Final = "db.operation" @@ -205,7 +202,6 @@ """ The number of queries included in a batch operation. Note: Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` SHOULD never be `1`. -This attribute has stability level RELEASE CANDIDATE. """ DB_OPERATION_NAME: Final = "db.operation.name" @@ -221,8 +217,6 @@ then that operation name SHOULD be used prepended by `BATCH `, otherwise `db.operation.name` SHOULD be `BATCH` or some other database system specific term if more applicable. - -This attribute has stability level RELEASE CANDIDATE. """ DB_OPERATION_PARAMETER_TEMPLATE: Final = "db.operation.parameter" @@ -230,7 +224,6 @@ A database operation parameter, with `` being the parameter name, and the attribute value being a string representation of the parameter value. Note: If a parameter has no name and instead is referenced only by index, then `` SHOULD be the 0-based index. If `db.query.text` is also captured, then `db.operation.parameter.` SHOULD match up with the parameterized placeholders present in `db.query.text`. -This attribute has stability level RELEASE CANDIDATE. """ DB_QUERY_PARAMETER_TEMPLATE: Final = "db.query.parameter" @@ -243,7 +236,6 @@ Low cardinality representation of a database query text. Note: `db.query.summary` provides static summary of the query text. It describes a class of database queries and is useful as a grouping key, especially when analyzing telemetry for database calls involving complex queries. Summary may be available to the instrumentation through instrumentation hooks or other means. If it is not available, instrumentations that support query parsing SHOULD generate a summary following [Generating query summary](../../docs/database/database-spans.md#generating-a-summary-of-the-query-text) section. -This attribute has stability level RELEASE CANDIDATE. """ DB_QUERY_TEXT: Final = "db.query.text" @@ -252,7 +244,6 @@ Note: For sanitization see [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext). For batch operations, if the individual operations are known to have the same query text then that query text SHOULD be used, otherwise all of the individual query texts SHOULD be concatenated with separator `; ` or some other database system specific separator if more applicable. Even though parameterized query text can potentially have sensitive data, by using a parameterized query the user is giving a strong signal that any sensitive data will be passed as parameter values, and the benefit to observability of capturing the static part of the query text by default outweighs the risk. -This attribute has stability level RELEASE CANDIDATE. """ DB_REDIS_DATABASE_INDEX: Final = "db.redis.database_index" @@ -270,7 +261,6 @@ Database response status code. Note: The status code returned by the database. Usually it represents an error code, but may also represent partial success, warning, or differentiate between various types of successful outcomes. Semantic conventions for individual database systems SHOULD document what `db.response.status_code` means in the context of that system. -This attribute has stability level RELEASE CANDIDATE. """ DB_SQL_TABLE: Final = "db.sql.table" @@ -287,7 +277,6 @@ """ The database management system (DBMS) product as identified by the client instrumentation. Note: The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system` is set to `postgresql` based on the instrumentation's best knowledge. -This attribute has stability level RELEASE CANDIDATE. """ DB_USER: Final = "db.user" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py index 24b16cf52b7..7fa5cf490ce 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/event_attributes.py @@ -16,6 +16,5 @@ EVENT_NAME: Final = "event.name" """ -Identifies the class / type of event. -Note: Event names are subject to the same rules as [attribute names](/docs/general/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. +Deprecated: Replaced by EventName top-level field on the LogRecord. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py index 4d0a392527d..37e22148dbe 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/exception_attributes.py @@ -16,7 +16,7 @@ EXCEPTION_ESCAPED: Final = "exception.escaped" """ -Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.exception_attributes.EXCEPTION_ESCAPED`. +Deprecated: It's no longer recommended to record exceptions that are handled and do not escape the scope of a span. """ EXCEPTION_MESSAGE: Final = "exception.message" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py index 22a9b24c96b..7ba2267fa4a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/faas_attributes.py @@ -86,7 +86,7 @@ Note: This is the name of the function as configured/deployed on the FaaS platform and is usually different from the name of the callback function (which may be stored in the -[`code.namespace`/`code.function`](/docs/general/attributes.md#source-code-attributes) +[`code.namespace`/`code.function.name`](/docs/general/attributes.md#source-code-attributes) span attributes). For some cloud providers, the above definition is ambiguous. The following diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py index 46c6d1bcedb..ad88911cabb 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py @@ -29,7 +29,7 @@ GEN_AI_OPENAI_REQUEST_SEED: Final = "gen_ai.openai.request.seed" """ -Requests with same seed value more likely to return same result. +Deprecated: Replaced by `gen_ai.request.seed` attribute. """ GEN_AI_OPENAI_REQUEST_SERVICE_TIER: Final = ( @@ -90,6 +90,11 @@ The presence penalty setting for the GenAI request. """ +GEN_AI_REQUEST_SEED: Final = "gen_ai.request.seed" +""" +Requests with same seed value more likely to return same result. +""" + GEN_AI_REQUEST_STOP_SEQUENCES: Final = "gen_ai.request.stop_sequences" """ List of sequences that the model will use to stop generating further tokens. @@ -132,8 +137,10 @@ by `gen_ai.request.model` and `gen_ai.response.model` attributes. The actual GenAI product may differ from the one identified by the client. -For example, when using OpenAI client libraries to communicate with Mistral, the `gen_ai.system` -is set to `openai` based on the instrumentation's best knowledge. +Multiple systems, including Azure OpenAI and Gemini, are accessible by OpenAI client +libraries. In such cases, the `gen_ai.system` is set to `openai` based on the +instrumentation's best knowledge, instead of the actual system. The `server.address` +attribute may help identify the actual system in use for `openai`. For custom model, a custom friendly name SHOULD be used. If none of these options apply, the `gen_ai.system` SHOULD be set to `_OTHER`. @@ -195,16 +202,30 @@ class GenAiSystemValues(Enum): """OpenAI.""" VERTEX_AI = "vertex_ai" """Vertex AI.""" + GEMINI = "gemini" + """Gemini.""" ANTHROPIC = "anthropic" """Anthropic.""" COHERE = "cohere" """Cohere.""" AZ_AI_INFERENCE = "az.ai.inference" """Azure AI Inference.""" + AZ_AI_OPENAI = "az.ai.openai" + """Azure OpenAI.""" IBM_WATSONX_AI = "ibm.watsonx.ai" """IBM Watsonx AI.""" AWS_BEDROCK = "aws.bedrock" """AWS Bedrock.""" + PERPLEXITY = "perplexity" + """Perplexity.""" + XAI = "xai" + """xAI.""" + DEEPSEEK = "deepseek" + """DeepSeek.""" + GROQ = "groq" + """Groq.""" + MISTRAL_AI = "mistral_ai" + """Mistral AI.""" class GenAiTokenTypeValues(Enum): diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py index 40d824894e7..1eb92df8f4b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/k8s_attributes.py @@ -109,6 +109,13 @@ The name of the namespace that the pod is running in. """ +K8S_NAMESPACE_PHASE: Final = "k8s.namespace.phase" +""" +The phase of the K8s namespace. +Note: This attribute aligns with the `phase` field of the +[K8s NamespaceStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#namespacestatus-v1-core). +""" + K8S_NODE_NAME: Final = "k8s.node.name" """ The name of the Node. @@ -175,16 +182,23 @@ """ +class K8sNamespacePhaseValues(Enum): + ACTIVE = "active" + """Active namespace phase as described by [K8s API](https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase).""" + TERMINATING = "terminating" + """Terminating namespace phase as described by [K8s API](https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase).""" + + class K8sVolumeTypeValues(Enum): PERSISTENT_VOLUME_CLAIM = "persistentVolumeClaim" - """A [persistentVolumeClaim](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume.""" + """A [persistentVolumeClaim](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume.""" CONFIG_MAP = "configMap" - """A [configMap](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap) volume.""" + """A [configMap](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#configmap) volume.""" DOWNWARD_API = "downwardAPI" - """A [downwardAPI](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi) volume.""" + """A [downwardAPI](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#downwardapi) volume.""" EMPTY_DIR = "emptyDir" - """An [emptyDir](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir) volume.""" + """An [emptyDir](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#emptydir) volume.""" SECRET = "secret" - """A [secret](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#secret) volume.""" + """A [secret](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#secret) volume.""" LOCAL = "local" - """A [local](https://v1-29.docs.kubernetes.io/docs/concepts/storage/volumes/#local) volume.""" + """A [local](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#local) volume.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py index a569a2881a0..10de3e54dca 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/network_attributes.py @@ -37,6 +37,12 @@ The name of the mobile carrier. """ +NETWORK_CONNECTION_STATE: Final = "network.connection.state" +""" +The state of network connection. +Note: Connection states are defined as part of the [rfc9293](https://datatracker.ietf.org/doc/html/rfc9293#section-3.3.2). +""" + NETWORK_CONNECTION_SUBTYPE: Final = "network.connection.subtype" """ This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. @@ -98,6 +104,31 @@ """ +class NetworkConnectionStateValues(Enum): + CLOSED = "closed" + """closed.""" + CLOSE_WAIT = "close_wait" + """close_wait.""" + CLOSING = "closing" + """closing.""" + ESTABLISHED = "established" + """established.""" + FIN_WAIT_1 = "fin_wait_1" + """fin_wait_1.""" + FIN_WAIT_2 = "fin_wait_2" + """fin_wait_2.""" + LAST_ACK = "last_ack" + """last_ack.""" + LISTEN = "listen" + """listen.""" + SYN_RECEIVED = "syn_received" + """syn_received.""" + SYN_SENT = "syn_sent" + """syn_sent.""" + TIME_WAIT = "time_wait" + """time_wait.""" + + class NetworkConnectionSubtypeValues(Enum): GPRS = "gprs" """GPRS.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py index cc2c25481e9..113861bef61 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/process_attributes.py @@ -110,7 +110,7 @@ PROCESS_LINUX_CGROUP: Final = "process.linux.cgroup" """ The control group associated with the process. -Note: Control groups (cgroups) are a kernel feature used to organize and manage process resources. This attribute provides the path(s) to the cgroup(s) associated with the process, which should match the contents of the [/proc//cgroup](https://man7.org/linux/man-pages/man7/cgroups.7.html) file. +Note: Control groups (cgroups) are a kernel feature used to organize and manage process resources. This attribute provides the path(s) to the cgroup(s) associated with the process, which should match the contents of the [/proc/\\[PID\\]/cgroup](https://man7.org/linux/man-pages/man7/cgroups.7.html) file. """ PROCESS_OWNER: Final = "process.owner" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py index ea39cd654c2..869f2591738 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/profile_attributes.py @@ -40,3 +40,5 @@ class ProfileFrameTypeValues(Enum): """[Ruby](https://wikipedia.org/wiki/Ruby_(programming_language)).""" V8JS = "v8js" """[V8JS](https://wikipedia.org/wiki/V8_(JavaScript_engine)).""" + BEAM = "beam" + """[Erlang](https://en.wikipedia.org/wiki/BEAM_(Erlang_virtual_machine)).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py index 737ea7913f7..de037e0d385 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/rpc_attributes.py @@ -97,7 +97,7 @@ RPC_METHOD: Final = "rpc.method" """ The name of the (logical) method being called, must be equal to the $method part in the span name. -Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side). +Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function.name` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side). """ RPC_SERVICE: Final = "rpc.service" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py new file mode 100644 index 00000000000..a32db513acf --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py @@ -0,0 +1,64 @@ +# 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 typing import Final + + + + + + + +SECURITY_RULE_CATEGORY: Final = "security_rule.category" +""" +A categorization value keyword used by the entity using the rule for detection of this event. +""" + +SECURITY_RULE_DESCRIPTION: Final = "security_rule.description" +""" +The description of the rule generating the event. +""" + +SECURITY_RULE_LICENSE: Final = "security_rule.license" +""" +Name of the license under which the rule used to generate this event is made available. +""" + +SECURITY_RULE_NAME: Final = "security_rule.name" +""" +The name of the rule or signature generating the event. +""" + +SECURITY_RULE_REFERENCE: Final = "security_rule.reference" +""" +Reference URL to additional information about the rule used to generate this event. +Note: The URL can point to the vendor’s documentation about the rule. If that’s not available, it can also be a link to a more general page describing this type of alert. +""" + +SECURITY_RULE_RULESET_NAME: Final = "security_rule.ruleset.name" +""" +Name of the ruleset, policy, group, or parent category in which the rule used to generate this event is a member. +""" + +SECURITY_RULE_UUID: Final = "security_rule.uuid" +""" +A rule ID that is unique within the scope of a set or group of agents, observers, or other entities using the rule for detection of this event. +""" + +SECURITY_RULE_VERSION: Final = "security_rule.version" +""" +The version / revision of the rule being used for analysis. +""" + + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py index b224863e93b..caf1bc7d319 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/system_attributes.py @@ -59,7 +59,7 @@ SYSTEM_NETWORK_STATE: Final = "system.network.state" """ -A stateless protocol MUST NOT set this attribute. +Deprecated: Removed, report network connection state with `network.connection.state` attribute. """ SYSTEM_PAGING_DIRECTION: Final = "system.paging.direction" @@ -145,6 +145,9 @@ class SystemMemoryStateValues(Enum): """cached.""" +@deprecated( + reason="The attribute system.network.state is deprecated - Removed, report network connection state with `network.connection.state` attribute" +) # type: ignore class SystemNetworkStateValues(Enum): CLOSE = "close" """close.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/vcs_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/vcs_attributes.py index fcb1bee01b5..7ac3820a201 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/vcs_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/vcs_attributes.py @@ -40,49 +40,65 @@ VCS_REF_BASE_NAME: Final = "vcs.ref.base.name" """ The name of the [reference](https://git-scm.com/docs/gitglossary#def_ref) such as **branch** or **tag** in the repository. +Note: `base` refers to the starting point of a change. For example, `main` +would be the base reference of type branch if you've created a new +reference of type branch from it and created new commits. """ VCS_REF_BASE_REVISION: Final = "vcs.ref.base.revision" """ The revision, literally [revised version](https://www.merriam-webster.com/dictionary/revision), The revision most often refers to a commit object in Git, or a revision number in SVN. -Note: The revision can be a full [hash value (see glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), +Note: `base` refers to the starting point of a change. For example, `main` +would be the base reference of type branch if you've created a new +reference of type branch from it and created new commits. The +revision can be a full [hash value (see +glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), of the recorded change to a ref within a repository pointing to a commit [commit](https://git-scm.com/docs/git-commit) object. It does -not necessarily have to be a hash; it can simply define a -[revision number](https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html) +not necessarily have to be a hash; it can simply define a [revision +number](https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html) which is an integer that is monotonically increasing. In cases where -it is identical to the `ref.base.name`, it SHOULD still be included. It is -up to the implementer to decide which value to set as the revision -based on the VCS system and situational context. +it is identical to the `ref.base.name`, it SHOULD still be included. +It is up to the implementer to decide which value to set as the +revision based on the VCS system and situational context. """ VCS_REF_BASE_TYPE: Final = "vcs.ref.base.type" """ The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository. +Note: `base` refers to the starting point of a change. For example, `main` +would be the base reference of type branch if you've created a new +reference of type branch from it and created new commits. """ VCS_REF_HEAD_NAME: Final = "vcs.ref.head.name" """ The name of the [reference](https://git-scm.com/docs/gitglossary#def_ref) such as **branch** or **tag** in the repository. +Note: `head` refers to where you are right now; the current reference at a +given time. """ VCS_REF_HEAD_REVISION: Final = "vcs.ref.head.revision" """ The revision, literally [revised version](https://www.merriam-webster.com/dictionary/revision), The revision most often refers to a commit object in Git, or a revision number in SVN. -Note: The revision can be a full [hash value (see glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), +Note: `head` refers to where you are right now; the current reference at a +given time.The revision can be a full [hash value (see +glossary)](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-5.pdf), of the recorded change to a ref within a repository pointing to a commit [commit](https://git-scm.com/docs/git-commit) object. It does -not necessarily have to be a hash; it can simply define a -[revision number](https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html) +not necessarily have to be a hash; it can simply define a [revision +number](https://svnbook.red-bean.com/en/1.7/svn.tour.revs.specifiers.html) which is an integer that is monotonically increasing. In cases where -it is identical to the `ref.head.name`, it SHOULD still be included. It is -up to the implementer to decide which value to set as the revision -based on the VCS system and situational context. +it is identical to the `ref.head.name`, it SHOULD still be included. +It is up to the implementer to decide which value to set as the +revision based on the VCS system and situational context. """ VCS_REF_HEAD_TYPE: Final = "vcs.ref.head.type" """ The type of the [reference](https://git-scm.com/docs/gitglossary#def_ref) in the repository. +Note: `head` refers to where you are right now; the current reference at a +given time. """ VCS_REF_TYPE: Final = "vcs.ref.type" @@ -100,6 +116,14 @@ Deprecated: Deprecated, use `vcs.change.title` instead. """ +VCS_REPOSITORY_NAME: Final = "vcs.repository.name" +""" +The human readable name of the repository. It SHOULD NOT include any additional identifier like Group/SubGroup in GitLab or organization in GitHub. +Note: Due to it only being the name, it can clash with forks of the same +repository if collecting telemetry across multiple orgs or groups in +the same backends. +""" + VCS_REPOSITORY_REF_NAME: Final = "vcs.repository.ref.name" """ Deprecated: Deprecated, use `vcs.ref.head.name` instead. @@ -117,7 +141,9 @@ VCS_REPOSITORY_URL_FULL: Final = "vcs.repository.url.full" """ -The [URL](https://wikipedia.org/wiki/URL) of the repository providing the complete address in order to locate and identify the repository. +The [canonical URL](https://support.google.com/webmasters/answer/10347851?hl=en#:~:text=A%20canonical%20URL%20is%20the,Google%20chooses%20one%20as%20canonical.) of the repository providing the complete HTTP(S) address in order to locate and identify the repository through a browser. +Note: In Git Version Control Systems, the canonical URL SHOULD NOT include +the `.git` extension. """ VCS_REVISION_DELTA_DIRECTION: Final = "vcs.revision_delta.direction" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py new file mode 100644 index 00000000000..16992f0bc62 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py @@ -0,0 +1,110 @@ +# 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 typing import Final + +from opentelemetry.metrics import Meter +from opentelemetry.metrics import Counter +from opentelemetry.metrics import Histogram +from opentelemetry.metrics import UpDownCounter + +CICD_PIPELINE_RUN_ACTIVE: Final = "cicd.pipeline.run.active" +""" +The number of pipeline runs currently active in the system by state +Instrument: updowncounter +Unit: {run} +""" + + + +def create_cicd_pipeline_run_active(meter: Meter) -> UpDownCounter: + """The number of pipeline runs currently active in the system by state""" + return meter.create_up_down_counter( + name=CICD_PIPELINE_RUN_ACTIVE, + description="The number of pipeline runs currently active in the system by state.", + unit="{run}", + ) + +CICD_PIPELINE_RUN_DURATION: Final = "cicd.pipeline.run.duration" +""" +Duration of a pipeline run grouped by pipeline, state and result +Instrument: histogram +Unit: s +""" + + + +def create_cicd_pipeline_run_duration(meter: Meter) -> Histogram: + """Duration of a pipeline run grouped by pipeline, state and result""" + return meter.create_histogram( + name=CICD_PIPELINE_RUN_DURATION, + description="Duration of a pipeline run grouped by pipeline, state and result.", + unit="s", + ) + +CICD_PIPELINE_RUN_ERRORS: Final = "cicd.pipeline.run.errors" +""" +The number of errors encountered in pipeline runs (eg. compile, test failures) +Instrument: counter +Unit: {error} +Note: There might be errors in a pipeline run that are non fatal (eg. they are suppressed) or in a parallel stage multiple stages could have a fatal error. +This means that this error count might not be the same as the count of metric `cicd.pipeline.run.duration` with run result `failure`. +""" + + + +def create_cicd_pipeline_run_errors(meter: Meter) -> Counter: + """The number of errors encountered in pipeline runs (eg. compile, test failures)""" + return meter.create_counter( + name=CICD_PIPELINE_RUN_ERRORS, + description="The number of errors encountered in pipeline runs (eg. compile, test failures).", + unit="{error}", + ) + +CICD_SYSTEM_ERRORS: Final = "cicd.system.errors" +""" +The number of errors in a component of the CICD system (eg. controller, scheduler, agent) +Instrument: counter +Unit: {error} +Note: Errors in pipeline run execution are explicitly excluded. Ie a test failure is not counted in this metric. +""" + + + +def create_cicd_system_errors(meter: Meter) -> Counter: + """The number of errors in a component of the CICD system (eg. controller, scheduler, agent)""" + return meter.create_counter( + name=CICD_SYSTEM_ERRORS, + description="The number of errors in a component of the CICD system (eg. controller, scheduler, agent).", + unit="{error}", + ) + +CICD_WORKER_COUNT: Final = "cicd.worker.count" +""" +The number of workers on the CICD system by state +Instrument: updowncounter +Unit: {count} +""" + + + +def create_cicd_worker_count(meter: Meter) -> UpDownCounter: + """The number of workers on the CICD system by state""" + return meter.create_up_down_counter( + name=CICD_WORKER_COUNT, + description="The number of workers on the CICD system by state.", + unit="{count}", + ) \ No newline at end of file diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py index 38fa254e767..4017520c842 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/k8s_metrics.py @@ -29,6 +29,7 @@ Meter, ObservableGauge, Observation, + UpDownCounter, ) # pylint: disable=invalid-name @@ -37,6 +38,373 @@ Generator[Iterable[Observation], CallbackOptions, None], ] +K8S_CRONJOB_ACTIVE_JOBS: Final = "k8s.cronjob.active_jobs" +""" +The number of actively running jobs for a cronjob +Instrument: updowncounter +Unit: {job} +Note: This metric aligns with the `active` field of the +[K8s CronJobStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#cronjobstatus-v1-batch). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.cronjob`](../resource/k8s.md#cronjob) resource. +""" + + +def create_k8s_cronjob_active_jobs(meter: Meter) -> UpDownCounter: + """The number of actively running jobs for a cronjob""" + return meter.create_up_down_counter( + name=K8S_CRONJOB_ACTIVE_JOBS, + description="The number of actively running jobs for a cronjob", + unit="{job}", + ) + + +K8S_DAEMONSET_CURRENT_SCHEDULED_NODES: Final = ( + "k8s.daemonset.current_scheduled_nodes" +) +""" +Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod +Instrument: updowncounter +Unit: {node} +Note: This metric aligns with the `currentNumberScheduled` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.daemonset`](../resource/k8s.md#daemonset) resource. +""" + + +def create_k8s_daemonset_current_scheduled_nodes( + meter: Meter, +) -> UpDownCounter: + """Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod""" + return meter.create_up_down_counter( + name=K8S_DAEMONSET_CURRENT_SCHEDULED_NODES, + description="Number of nodes that are running at least 1 daemon pod and are supposed to run the daemon pod", + unit="{node}", + ) + + +K8S_DAEMONSET_DESIRED_SCHEDULED_NODES: Final = ( + "k8s.daemonset.desired_scheduled_nodes" +) +""" +Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod) +Instrument: updowncounter +Unit: {node} +Note: This metric aligns with the `desiredNumberScheduled` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.daemonset`](../resource/k8s.md#daemonset) resource. +""" + + +def create_k8s_daemonset_desired_scheduled_nodes( + meter: Meter, +) -> UpDownCounter: + """Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)""" + return meter.create_up_down_counter( + name=K8S_DAEMONSET_DESIRED_SCHEDULED_NODES, + description="Number of nodes that should be running the daemon pod (including nodes currently running the daemon pod)", + unit="{node}", + ) + + +K8S_DAEMONSET_MISSCHEDULED_NODES: Final = "k8s.daemonset.misscheduled_nodes" +""" +Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod +Instrument: updowncounter +Unit: {node} +Note: This metric aligns with the `numberMisscheduled` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.daemonset`](../resource/k8s.md#daemonset) resource. +""" + + +def create_k8s_daemonset_misscheduled_nodes(meter: Meter) -> UpDownCounter: + """Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod""" + return meter.create_up_down_counter( + name=K8S_DAEMONSET_MISSCHEDULED_NODES, + description="Number of nodes that are running the daemon pod, but are not supposed to run the daemon pod", + unit="{node}", + ) + + +K8S_DAEMONSET_READY_NODES: Final = "k8s.daemonset.ready_nodes" +""" +Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready +Instrument: updowncounter +Unit: {node} +Note: This metric aligns with the `numberReady` field of the +[K8s DaemonSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#daemonsetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.daemonset`](../resource/k8s.md#daemonset) resource. +""" + + +def create_k8s_daemonset_ready_nodes(meter: Meter) -> UpDownCounter: + """Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready""" + return meter.create_up_down_counter( + name=K8S_DAEMONSET_READY_NODES, + description="Number of nodes that should be running the daemon pod and have one or more of the daemon pod running and ready", + unit="{node}", + ) + + +K8S_DEPLOYMENT_AVAILABLE_PODS: Final = "k8s.deployment.available_pods" +""" +Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `availableReplicas` field of the +[K8s DeploymentStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.deployment`](../resource/k8s.md#deployment) resource. +""" + + +def create_k8s_deployment_available_pods(meter: Meter) -> UpDownCounter: + """Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment""" + return meter.create_up_down_counter( + name=K8S_DEPLOYMENT_AVAILABLE_PODS, + description="Total number of available replica pods (ready for at least minReadySeconds) targeted by this deployment", + unit="{pod}", + ) + + +K8S_DEPLOYMENT_DESIRED_PODS: Final = "k8s.deployment.desired_pods" +""" +Number of desired replica pods in this deployment +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `replicas` field of the +[K8s DeploymentSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#deploymentspec-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.deployment`](../resource/k8s.md#deployment) resource. +""" + + +def create_k8s_deployment_desired_pods(meter: Meter) -> UpDownCounter: + """Number of desired replica pods in this deployment""" + return meter.create_up_down_counter( + name=K8S_DEPLOYMENT_DESIRED_PODS, + description="Number of desired replica pods in this deployment", + unit="{pod}", + ) + + +K8S_HPA_CURRENT_PODS: Final = "k8s.hpa.current_pods" +""" +Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `currentReplicas` field of the +[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling). +""" + + +def create_k8s_hpa_current_pods(meter: Meter) -> UpDownCounter: + """Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler""" + return meter.create_up_down_counter( + name=K8S_HPA_CURRENT_PODS, + description="Current number of replica pods managed by this horizontal pod autoscaler, as last seen by the autoscaler", + unit="{pod}", + ) + + +K8S_HPA_DESIRED_PODS: Final = "k8s.hpa.desired_pods" +""" +Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `desiredReplicas` field of the +[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling). +""" + + +def create_k8s_hpa_desired_pods(meter: Meter) -> UpDownCounter: + """Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler""" + return meter.create_up_down_counter( + name=K8S_HPA_DESIRED_PODS, + description="Desired number of replica pods managed by this horizontal pod autoscaler, as last calculated by the autoscaler", + unit="{pod}", + ) + + +K8S_HPA_MAX_PODS: Final = "k8s.hpa.max_pods" +""" +The upper limit for the number of replica pods to which the autoscaler can scale up +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `maxReplicas` field of the +[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling). +""" + + +def create_k8s_hpa_max_pods(meter: Meter) -> UpDownCounter: + """The upper limit for the number of replica pods to which the autoscaler can scale up""" + return meter.create_up_down_counter( + name=K8S_HPA_MAX_PODS, + description="The upper limit for the number of replica pods to which the autoscaler can scale up", + unit="{pod}", + ) + + +K8S_HPA_MIN_PODS: Final = "k8s.hpa.min_pods" +""" +The lower limit for the number of replica pods to which the autoscaler can scale down +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `minReplicas` field of the +[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling). +""" + + +def create_k8s_hpa_min_pods(meter: Meter) -> UpDownCounter: + """The lower limit for the number of replica pods to which the autoscaler can scale down""" + return meter.create_up_down_counter( + name=K8S_HPA_MIN_PODS, + description="The lower limit for the number of replica pods to which the autoscaler can scale down", + unit="{pod}", + ) + + +K8S_JOB_ACTIVE_PODS: Final = "k8s.job.active_pods" +""" +The number of pending and actively running pods for a job +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `active` field of the +[K8s JobStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.job`](../resource/k8s.md#job) resource. +""" + + +def create_k8s_job_active_pods(meter: Meter) -> UpDownCounter: + """The number of pending and actively running pods for a job""" + return meter.create_up_down_counter( + name=K8S_JOB_ACTIVE_PODS, + description="The number of pending and actively running pods for a job", + unit="{pod}", + ) + + +K8S_JOB_DESIRED_SUCCESSFUL_PODS: Final = "k8s.job.desired_successful_pods" +""" +The desired number of successfully finished pods the job should be run with +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `completions` field of the +[K8s JobSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobspec-v1-batch). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.job`](../resource/k8s.md#job) resource. +""" + + +def create_k8s_job_desired_successful_pods(meter: Meter) -> UpDownCounter: + """The desired number of successfully finished pods the job should be run with""" + return meter.create_up_down_counter( + name=K8S_JOB_DESIRED_SUCCESSFUL_PODS, + description="The desired number of successfully finished pods the job should be run with", + unit="{pod}", + ) + + +K8S_JOB_FAILED_PODS: Final = "k8s.job.failed_pods" +""" +The number of pods which reached phase Failed for a job +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `failed` field of the +[K8s JobStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.job`](../resource/k8s.md#job) resource. +""" + + +def create_k8s_job_failed_pods(meter: Meter) -> UpDownCounter: + """The number of pods which reached phase Failed for a job""" + return meter.create_up_down_counter( + name=K8S_JOB_FAILED_PODS, + description="The number of pods which reached phase Failed for a job", + unit="{pod}", + ) + + +K8S_JOB_MAX_PARALLEL_PODS: Final = "k8s.job.max_parallel_pods" +""" +The max desired number of pods the job should run at any given time +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `parallelism` field of the +[K8s JobSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobspec-v1-batch. + +This metric SHOULD, at a minimum, be reported against a +[`k8s.job`](../resource/k8s.md#job) resource. +""" + + +def create_k8s_job_max_parallel_pods(meter: Meter) -> UpDownCounter: + """The max desired number of pods the job should run at any given time""" + return meter.create_up_down_counter( + name=K8S_JOB_MAX_PARALLEL_PODS, + description="The max desired number of pods the job should run at any given time", + unit="{pod}", + ) + + +K8S_JOB_SUCCESSFUL_PODS: Final = "k8s.job.successful_pods" +""" +The number of pods which reached phase Succeeded for a job +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `succeeded` field of the +[K8s JobStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#jobstatus-v1-batch). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.job`](../resource/k8s.md#job) resource. +""" + + +def create_k8s_job_successful_pods(meter: Meter) -> UpDownCounter: + """The number of pods which reached phase Succeeded for a job""" + return meter.create_up_down_counter( + name=K8S_JOB_SUCCESSFUL_PODS, + description="The number of pods which reached phase Succeeded for a job", + unit="{pod}", + ) + + +K8S_NAMESPACE_PHASE: Final = "k8s.namespace.phase" +""" +Describes number of K8s namespaces that are currently in a given phase +Instrument: updowncounter +Unit: {namespace} +Note: This metric SHOULD, at a minimum, be reported against a +[`k8s.namespace`](../resource/k8s.md#namespace) resource. +""" + + +def create_k8s_namespace_phase(meter: Meter) -> UpDownCounter: + """Describes number of K8s namespaces that are currently in a given phase""" + return meter.create_up_down_counter( + name=K8S_NAMESPACE_PHASE, + description="Describes number of K8s namespaces that are currently in a given phase.", + unit="{namespace}", + ) + + K8S_NODE_CPU_TIME: Final = "k8s.node.cpu.time" """ Total CPU time consumed @@ -267,3 +635,181 @@ def create_k8s_pod_uptime( description="The time the Pod has been running", unit="s", ) + + +K8S_REPLICASET_AVAILABLE_PODS: Final = "k8s.replicaset.available_pods" +""" +Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `availableReplicas` field of the +[K8s ReplicaSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.replicaset`](../resource/k8s.md#replicaset) resource. +""" + + +def create_k8s_replicaset_available_pods(meter: Meter) -> UpDownCounter: + """Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset""" + return meter.create_up_down_counter( + name=K8S_REPLICASET_AVAILABLE_PODS, + description="Total number of available replica pods (ready for at least minReadySeconds) targeted by this replicaset", + unit="{pod}", + ) + + +K8S_REPLICASET_DESIRED_PODS: Final = "k8s.replicaset.desired_pods" +""" +Number of desired replica pods in this replicaset +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `replicas` field of the +[K8s ReplicaSetSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicasetspec-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.replicaset`](../resource/k8s.md#replicaset) resource. +""" + + +def create_k8s_replicaset_desired_pods(meter: Meter) -> UpDownCounter: + """Number of desired replica pods in this replicaset""" + return meter.create_up_down_counter( + name=K8S_REPLICASET_DESIRED_PODS, + description="Number of desired replica pods in this replicaset", + unit="{pod}", + ) + + +K8S_REPLICATION_CONTROLLER_AVAILABLE_PODS: Final = ( + "k8s.replication_controller.available_pods" +) +""" +Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `availableReplicas` field of the +[K8s ReplicationControllerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core). +""" + + +def create_k8s_replication_controller_available_pods( + meter: Meter, +) -> UpDownCounter: + """Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller""" + return meter.create_up_down_counter( + name=K8S_REPLICATION_CONTROLLER_AVAILABLE_PODS, + description="Total number of available replica pods (ready for at least minReadySeconds) targeted by this replication controller", + unit="{pod}", + ) + + +K8S_REPLICATION_CONTROLLER_DESIRED_PODS: Final = ( + "k8s.replication_controller.desired_pods" +) +""" +Number of desired replica pods in this replication controller +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `replicas` field of the +[K8s ReplicationControllerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core). +""" + + +def create_k8s_replication_controller_desired_pods( + meter: Meter, +) -> UpDownCounter: + """Number of desired replica pods in this replication controller""" + return meter.create_up_down_counter( + name=K8S_REPLICATION_CONTROLLER_DESIRED_PODS, + description="Number of desired replica pods in this replication controller", + unit="{pod}", + ) + + +K8S_STATEFULSET_CURRENT_PODS: Final = "k8s.statefulset.current_pods" +""" +The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `currentReplicas` field of the +[K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.statefulset`](../resource/k8s.md#statefulset) resource. +""" + + +def create_k8s_statefulset_current_pods(meter: Meter) -> UpDownCounter: + """The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision""" + return meter.create_up_down_counter( + name=K8S_STATEFULSET_CURRENT_PODS, + description="The number of replica pods created by the statefulset controller from the statefulset version indicated by currentRevision", + unit="{pod}", + ) + + +K8S_STATEFULSET_DESIRED_PODS: Final = "k8s.statefulset.desired_pods" +""" +Number of desired replica pods in this statefulset +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `replicas` field of the +[K8s StatefulSetSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetspec-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.statefulset`](../resource/k8s.md#statefulset) resource. +""" + + +def create_k8s_statefulset_desired_pods(meter: Meter) -> UpDownCounter: + """Number of desired replica pods in this statefulset""" + return meter.create_up_down_counter( + name=K8S_STATEFULSET_DESIRED_PODS, + description="Number of desired replica pods in this statefulset", + unit="{pod}", + ) + + +K8S_STATEFULSET_READY_PODS: Final = "k8s.statefulset.ready_pods" +""" +The number of replica pods created for this statefulset with a Ready Condition +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `readyReplicas` field of the +[K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.statefulset`](../resource/k8s.md#statefulset) resource. +""" + + +def create_k8s_statefulset_ready_pods(meter: Meter) -> UpDownCounter: + """The number of replica pods created for this statefulset with a Ready Condition""" + return meter.create_up_down_counter( + name=K8S_STATEFULSET_READY_PODS, + description="The number of replica pods created for this statefulset with a Ready Condition", + unit="{pod}", + ) + + +K8S_STATEFULSET_UPDATED_PODS: Final = "k8s.statefulset.updated_pods" +""" +Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision +Instrument: updowncounter +Unit: {pod} +Note: This metric aligns with the `updatedReplicas` field of the +[K8s StatefulSetStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#statefulsetstatus-v1-apps). + +This metric SHOULD, at a minimum, be reported against a +[`k8s.statefulset`](../resource/k8s.md#statefulset) resource. +""" + + +def create_k8s_statefulset_updated_pods(meter: Meter) -> UpDownCounter: + """Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision""" + return meter.create_up_down_counter( + name=K8S_STATEFULSET_UPDATED_PODS, + description="Number of replica pods created by the statefulset controller from the statefulset version indicated by updateRevision", + unit="{pod}", + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py index 0c894bd2ff3..e47b963e68a 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/system_metrics.py @@ -63,6 +63,7 @@ def create_system_cpu_frequency( Reports the number of logical (virtual) processor cores created by the operating system to manage multitasking Instrument: updowncounter Unit: {cpu} +Note: Calculated by multiplying the number of sockets by the number of cores per socket, and then by the number of threads per core. """ @@ -80,6 +81,7 @@ def create_system_cpu_logical_count(meter: Meter) -> UpDownCounter: Reports the number of actual physical processor cores on the hardware Instrument: updowncounter Unit: {cpu} +Note: Calculated by multiplying the number of sockets by the number of cores per socket. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/vcs_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/vcs_metrics.py index 03e1882e724..c232751c546 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/vcs_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/vcs_metrics.py @@ -89,7 +89,27 @@ def create_vcs_change_time_to_approval( return meter.create_observable_gauge( name=VCS_CHANGE_TIME_TO_APPROVAL, callbacks=callbacks, - description="The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval", + description="The amount of time since its creation it took a change (pull request/merge request/changelist) to get the first approval.", + unit="s", + ) + + +VCS_CHANGE_TIME_TO_MERGE: Final = "vcs.change.time_to_merge" +""" +The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref +Instrument: gauge +Unit: s +""" + + +def create_vcs_change_time_to_merge( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref""" + return meter.create_observable_gauge( + name=VCS_CHANGE_TIME_TO_MERGE, + callbacks=callbacks, + description="The amount of time since its creation it took a change (pull request/merge request/changelist) to get merged into the target(base) ref.", unit="s", ) @@ -126,7 +146,7 @@ def create_vcs_ref_count(meter: Meter) -> UpDownCounter: """The number of refs of type branch or tag in a repository""" return meter.create_up_down_counter( name=VCS_REF_COUNT, - description="The number of refs of type branch or tag in a repository", + description="The number of refs of type branch or tag in a repository.", unit="{ref}", ) @@ -149,7 +169,7 @@ def create_vcs_ref_lines_delta( return meter.create_observable_gauge( name=VCS_REF_LINES_DELTA, callbacks=callbacks, - description="The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute", + description="The number of lines added/removed in a ref (branch) relative to the ref from the `vcs.ref.base.name` attribute.", unit="{line}", ) @@ -208,6 +228,6 @@ def create_vcs_repository_count(meter: Meter) -> UpDownCounter: """The number of repositories in an organization""" return meter.create_up_down_counter( name=VCS_REPOSITORY_COUNT, - description="The number of repositories in an organization", + description="The number of repositories in an organization.", unit="{repository}", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py index d51921c382d..7f396abe3be 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/exception_attributes.py @@ -16,23 +16,7 @@ EXCEPTION_ESCAPED: Final = "exception.escaped" """ -SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. -Note: An exception is considered to have escaped (or left) the scope of a span, -if that span is ended while the exception is still logically "in flight". -This may be actually "in flight" in some languages (e.g. if the exception -is passed to a Context manager's `__exit__` method in Python) but will -usually be caught at the point of recording the exception in most languages. - -It is usually not possible to determine at the point where an exception is thrown -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 for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#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, -since the event might have been recorded at a time where it was not -clear whether the exception will escape. +Deprecated: It's no longer recommended to record exceptions that are handled and do not escape the scope of a span. """ EXCEPTION_MESSAGE: Final = "exception.message" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py index b585467bfb3..c09fe2e0c6f 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/network_attributes.py @@ -15,11 +15,6 @@ from enum import Enum from typing import Final -NETWORK_INTERFACE_NAME: Final = "network.interface.name" -""" -The network interface name. -""" - NETWORK_LOCAL_ADDRESS: Final = "network.local.address" """ Local address of the network connection - IP address or Unix domain socket name. diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index 386fa0406af..c808b5ab5c4 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -6,7 +6,7 @@ ROOT_DIR="${SCRIPT_DIR}/../.." # freeze the spec version to make SemanticAttributes generation reproducible SEMCONV_VERSION=1.29.0 -SEMCONV_VERSION_TAG=v$SEMCONV_VERSION +SEMCONV_VERSION_TAG=main OTEL_WEAVER_IMG_VERSION=v0.12.0 INCUBATING_DIR=_incubating cd ${SCRIPT_DIR} From 7cad2f7db0d8b5a989c74ff6d3bcd9f515f02f37 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Thu, 23 Jan 2025 23:09:22 -0800 Subject: [PATCH 2/5] update --- .../attributes/azure_attributes.py | 77 ++++++++++ .../attributes/cassandra_attributes.py | 77 ++++++++++ .../_incubating/attributes/db_attributes.py | 136 +++++++++++++++--- .../attributes/elasticsearch_attributes.py | 28 ++++ .../attributes/security_rule_attributes.py | 8 -- .../_incubating/metrics/azure_metrics.py | 55 +++++++ .../_incubating/metrics/cicd_metrics.py | 17 +-- .../semconv/_incubating/metrics/db_metrics.py | 16 +-- 8 files changed, 367 insertions(+), 47 deletions(-) create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py create mode 100644 opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py new file mode 100644 index 00000000000..c626929694a --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py @@ -0,0 +1,77 @@ +# 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 typing import Final + + + + + +from enum import Enum + +AZURE_CLIENT_ID: Final = "azure.client.id" +""" +The unique identifier of the client instance. +""" + +AZURE_COSMOSDB_CONNECTION_MODE: Final = "azure.cosmosdb.connection.mode" +""" +Cosmos client connection mode. +""" + +AZURE_COSMOSDB_CONSISTENCY_LEVEL: Final = "azure.cosmosdb.consistency.level" +""" +Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels). +""" + +AZURE_COSMOSDB_OPERATION_CONTACTED_REGIONS: Final = "azure.cosmosdb.operation.contacted_regions" +""" +List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call. +Note: Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location). +""" + +AZURE_COSMOSDB_OPERATION_REQUEST_CHARGE: Final = "azure.cosmosdb.operation.request_charge" +""" +The number of request units consumed by the operation. +""" + +AZURE_COSMOSDB_REQUEST_BODY_SIZE: Final = "azure.cosmosdb.request.body.size" +""" +Request payload size in bytes. +""" + +AZURE_COSMOSDB_RESPONSE_SUB_STATUS_CODE: Final = "azure.cosmosdb.response.sub_status_code" +""" +Cosmos DB sub status code. +""" + + + +class AzureCosmosdbConnectionModeValues(Enum): + GATEWAY = "gateway" + """Gateway (HTTP) connection.""" + DIRECT = "direct" + """Direct connection.""" + +class AzureCosmosdbConsistencyLevelValues(Enum): + STRONG = "Strong" + """strong.""" + BOUNDED_STALENESS = "BoundedStaleness" + """bounded_staleness.""" + SESSION = "Session" + """session.""" + EVENTUAL = "Eventual" + """eventual.""" + CONSISTENT_PREFIX = "ConsistentPrefix" + """consistent_prefix.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py new file mode 100644 index 00000000000..80297a45f06 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py @@ -0,0 +1,77 @@ +# 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 typing import Final + + + + + +from enum import Enum + +CASSANDRA_CONSISTENCY_LEVEL: Final = "cassandra.consistency.level" +""" +The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). +""" + +CASSANDRA_COORDINATOR_DC: Final = "cassandra.coordinator.dc" +""" +The data center of the coordinating node for a query. +""" + +CASSANDRA_COORDINATOR_ID: Final = "cassandra.coordinator.id" +""" +The ID of the coordinating node for a query. +""" + +CASSANDRA_PAGE_SIZE: Final = "cassandra.page.size" +""" +The fetch size used for paging, i.e. how many rows will be returned at once. +""" + +CASSANDRA_QUERY_IDEMPOTENT: Final = "cassandra.query.idempotent" +""" +Whether or not the query is idempotent. +""" + +CASSANDRA_SPECULATIVE_EXECUTION_COUNT: Final = "cassandra.speculative_execution.count" +""" +The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. +""" + + + +class CassandraConsistencyLevelValues(Enum): + ALL = "all" + """all.""" + EACH_QUORUM = "each_quorum" + """each_quorum.""" + QUORUM = "quorum" + """quorum.""" + LOCAL_QUORUM = "local_quorum" + """local_quorum.""" + ONE = "one" + """one.""" + TWO = "two" + """two.""" + THREE = "three" + """three.""" + LOCAL_ONE = "local_one" + """local_one.""" + ANY = "any" + """any.""" + SERIAL = "serial" + """serial.""" + LOCAL_SERIAL = "local_serial" + """local_serial.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py index 2011c0be41d..fdbd372cea0 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/db_attributes.py @@ -19,34 +19,34 @@ DB_CASSANDRA_CONSISTENCY_LEVEL: Final = "db.cassandra.consistency_level" """ -The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). +Deprecated: Replaced by `cassandra.consistency.level`. """ DB_CASSANDRA_COORDINATOR_DC: Final = "db.cassandra.coordinator.dc" """ -The data center of the coordinating node for a query. +Deprecated: Replaced by `cassandra.coordinator.dc`. """ DB_CASSANDRA_COORDINATOR_ID: Final = "db.cassandra.coordinator.id" """ -The ID of the coordinating node for a query. +Deprecated: Replaced by `cassandra.coordinator.id`. """ DB_CASSANDRA_IDEMPOTENCE: Final = "db.cassandra.idempotence" """ -Whether or not the query is idempotent. +Deprecated: Replaced by `cassandra.query.idempotent`. """ DB_CASSANDRA_PAGE_SIZE: Final = "db.cassandra.page_size" """ -The fetch size used for paging, i.e. how many rows will be returned at once. +Deprecated: Replaced by `cassandra.page.size`. """ DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT: Final = ( "db.cassandra.speculative_execution_count" ) """ -The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. +Deprecated: Replaced by `cassandra.speculative_execution.count`. """ DB_CASSANDRA_TABLE: Final = "db.cassandra.table" @@ -93,17 +93,17 @@ DB_COSMOSDB_CLIENT_ID: Final = "db.cosmosdb.client_id" """ -Unique Cosmos client instance id. +Deprecated: Replaced by `azure.client.id`. """ DB_COSMOSDB_CONNECTION_MODE: Final = "db.cosmosdb.connection_mode" """ -Cosmos client connection mode. +Deprecated: Replaced by `azure.cosmosdb.connection.mode`. """ DB_COSMOSDB_CONSISTENCY_LEVEL: Final = "db.cosmosdb.consistency_level" """ -Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels). +Deprecated: Replaced by `azure.cosmosdb.consistency.level`. """ DB_COSMOSDB_CONTAINER: Final = "db.cosmosdb.container" @@ -118,20 +118,19 @@ DB_COSMOSDB_REGIONS_CONTACTED: Final = "db.cosmosdb.regions_contacted" """ -List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call. -Note: Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location). +Deprecated: Replaced by `azure.cosmosdb.operation.contacted_regions`. """ DB_COSMOSDB_REQUEST_CHARGE: Final = "db.cosmosdb.request_charge" """ -Request units consumed for the operation. +Deprecated: Replaced by `azure.cosmosdb.operation.request_charge`. """ DB_COSMOSDB_REQUEST_CONTENT_LENGTH: Final = ( "db.cosmosdb.request_content_length" ) """ -Request payload size in bytes. +Deprecated: Replaced by `azure.cosmosdb.request.body.size`. """ DB_COSMOSDB_STATUS_CODE: Final = "db.cosmosdb.status_code" @@ -141,7 +140,7 @@ DB_COSMOSDB_SUB_STATUS_CODE: Final = "db.cosmosdb.sub_status_code" """ -Cosmos DB sub status code. +Deprecated: Replaced by `azure.cosmosdb.response.sub_status_code`. """ DB_ELASTICSEARCH_CLUSTER_NAME: Final = "db.elasticsearch.cluster.name" @@ -151,13 +150,12 @@ DB_ELASTICSEARCH_NODE_NAME: Final = "db.elasticsearch.node.name" """ -Represents the human-readable identifier of the node/instance to which a request was routed. +Deprecated: Replaced by `elasticsearch.node.name`. """ DB_ELASTICSEARCH_PATH_PARTS_TEMPLATE: Final = "db.elasticsearch.path_parts" """ -A dynamic value in the url path. -Note: Many Elasticsearch url paths allow dynamic values. These SHOULD be recorded in span attributes in the format `db.elasticsearch.path_parts.`, where `` is the url path part name. The implementation SHOULD reference the [elasticsearch schema](https://raw.githubusercontent.com/elastic/elasticsearch-specification/main/output/schema/schema.json) in order to map the path part values to their names. +Deprecated: Replaced by `db.operation.parameter`. """ DB_INSTANCE_ID: Final = "db.instance.id" @@ -275,8 +273,13 @@ DB_SYSTEM: Final = "db.system" """ +Deprecated: Replaced by `db.system.name`. +""" + +DB_SYSTEM_NAME: Final = "db.system.name" +""" The database management system (DBMS) product as identified by the client instrumentation. -Note: The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system` is set to `postgresql` based on the instrumentation's best knowledge. +Note: The actual DBMS may differ from the one identified by the client. For example, when using PostgreSQL client libraries to connect to a CockroachDB, the `db.system.name` is set to `postgresql` based on the instrumentation's best knowledge. """ DB_USER: Final = "db.user" @@ -285,6 +288,9 @@ """ +@deprecated( + reason="The attribute db.cassandra.consistency_level is deprecated - Replaced by `cassandra.consistency.level`" +) # type: ignore class DbCassandraConsistencyLevelValues(Enum): ALL = "all" """all.""" @@ -327,6 +333,9 @@ class DbClientConnectionsStateValues(Enum): """used.""" +@deprecated( + reason="The attribute db.cosmosdb.connection_mode is deprecated - Replaced by `azure.cosmosdb.connection.mode`" +) # type: ignore class DbCosmosdbConnectionModeValues(Enum): GATEWAY = "gateway" """Gateway (HTTP) connection.""" @@ -334,6 +343,9 @@ class DbCosmosdbConnectionModeValues(Enum): """Direct connection.""" +@deprecated( + reason="The attribute db.cosmosdb.consistency_level is deprecated - Replaced by `azure.cosmosdb.consistency.level`" +) # type: ignore class DbCosmosdbConsistencyLevelValues(Enum): STRONG = "Strong" """strong.""" @@ -383,6 +395,9 @@ class DbCosmosdbOperationTypeValues(Enum): """upsert.""" +@deprecated( + reason="The attribute db.system is deprecated - Replaced by `db.system.name`" +) # type: ignore class DbSystemValues(Enum): OTHER_SQL = "other_sql" """Some other SQL database. Fallback only. See notes.""" @@ -492,3 +507,88 @@ class DbSystemValues(Enum): """Trino.""" VERTICA = "vertica" """Vertica.""" + + +class DbSystemNameValues(Enum): + OTHER_SQL = "other_sql" + """Some other SQL database. Fallback only.""" + SOFTWAREAG_ADABAS = "softwareag.adabas" + """[Adabas (Adaptable Database System)](https://documentation.softwareag.com/?pf=adabas).""" + ACTIAN_INGRES = "actian.ingres" + """[Actian Ingres](https://www.actian.com/databases/ingres/).""" + AWS_DYNAMODB = "aws.dynamodb" + """[Amazon DynamoDB](https://aws.amazon.com/pm/dynamodb/).""" + AWS_REDSHIFT = "aws.redshift" + """[Amazon Redshift](https://aws.amazon.com/redshift/).""" + AZURE_COSMOSDB = "azure.cosmosdb" + """[Azure Cosmos DB](https://learn.microsoft.com/azure/cosmos-db).""" + INTERSYSTEMS_CACHE = "intersystems.cache" + """[InterSystems Caché](https://www.intersystems.com/products/cache/).""" + CASSANDRA = "cassandra" + """[Apache Cassandra](https://cassandra.apache.org/).""" + CLICKHOUSE = "clickhouse" + """[ClickHouse](https://clickhouse.com/).""" + COCKROACHDB = "cockroachdb" + """[CockroachDB](https://www.cockroachlabs.com/).""" + COUCHBASE = "couchbase" + """[Couchbase](https://www.couchbase.com/).""" + COUCHDB = "couchdb" + """[Apache CouchDB](https://couchdb.apache.org/).""" + DERBY = "derby" + """[Apache Derby](https://db.apache.org/derby/).""" + ELASTICSEARCH = "elasticsearch" + """[Elasticsearch](https://www.elastic.co/elasticsearch).""" + FIREBIRDSQL = "firebirdsql" + """[Firebird](https://www.firebirdsql.org/).""" + GCP_SPANNER = "gcp.spanner" + """[Google Cloud Spanner](https://cloud.google.com/spanner).""" + GEODE = "geode" + """[Apache Geode](https://geode.apache.org/).""" + H2DATABASE = "h2database" + """[H2 Database](https://h2database.com/).""" + HBASE = "hbase" + """[Apache HBase](https://hbase.apache.org/).""" + HIVE = "hive" + """[Apache Hive](https://hive.apache.org/).""" + HSQLDB = "hsqldb" + """[HyperSQL Database](https://hsqldb.org/).""" + IBM_DB2 = "ibm.db2" + """[IBM Db2](https://www.ibm.com/db2).""" + IBM_INFORMIX = "ibm.informix" + """[IBM Informix](https://www.ibm.com/products/informix).""" + IBM_NETEZZA = "ibm.netezza" + """[IBM Netezza](https://www.ibm.com/products/netezza).""" + INFLUXDB = "influxdb" + """[InfluxDB](https://www.influxdata.com/).""" + INSTANTDB = "instantdb" + """[Instant](https://www.instantdb.com/).""" + MARIADB = "mariadb" + """[MariaDB](https://mariadb.org/).""" + MEMCACHED = "memcached" + """[Memcached](https://memcached.org/).""" + MONGODB = "mongodb" + """[MongoDB](https://www.mongodb.com/).""" + MICROSOFT_SQL_SERVER = "microsoft.sql_server" + """[Microsoft SQL Server](https://www.microsoft.com/sql-server).""" + MYSQL = "mysql" + """[MySQL](https://www.mysql.com/).""" + NEO4J = "neo4j" + """[Neo4j](https://neo4j.com/).""" + OPENSEARCH = "opensearch" + """[OpenSearch](https://opensearch.org/).""" + ORACLE_DB = "oracle.db" + """[Oracle Database](https://www.oracle.com/database/).""" + POSTGRESQL = "postgresql" + """[PostgreSQL](https://www.postgresql.org/).""" + REDIS = "redis" + """[Redis](https://redis.io/).""" + SAP_HANA = "sap.hana" + """[SAP HANA](https://www.sap.com/products/technology-platform/hana/what-is-sap-hana.html).""" + SAP_MAXDB = "sap.maxdb" + """[SAP MaxDB](https://maxdb.sap.com/).""" + SQLITE = "sqlite" + """[SQLite](https://www.sqlite.org/).""" + TERADATA = "teradata" + """[Teradata](https://www.teradata.com/).""" + TRINO = "trino" + """[Trino](https://trino.io/).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py new file mode 100644 index 00000000000..89ab63bbd74 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py @@ -0,0 +1,28 @@ +# 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 typing import Final + + + + + + + +ELASTICSEARCH_NODE_NAME: Final = "elasticsearch.node.name" +""" +Represents the human-readable identifier of the node/instance to which a request was routed. +""" + + diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py index a32db513acf..f6fbd0e34c7 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/security_rule_attributes.py @@ -14,12 +14,6 @@ from typing import Final - - - - - - SECURITY_RULE_CATEGORY: Final = "security_rule.category" """ A categorization value keyword used by the entity using the rule for detection of this event. @@ -60,5 +54,3 @@ """ The version / revision of the rule being used for analysis. """ - - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py new file mode 100644 index 00000000000..2e1db447e43 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py @@ -0,0 +1,55 @@ +# 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 typing import Final + +from opentelemetry.metrics import Meter +from opentelemetry.metrics import Histogram +from opentelemetry.metrics import UpDownCounter + +AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT: Final = "azure.cosmosdb.client.active_instance.count" +""" +Number of active client instances +Instrument: updowncounter +Unit: {instance} +""" + + + +def create_azure_cosmosdb_client_active_instance_count(meter: Meter) -> UpDownCounter: + """Number of active client instances""" + return meter.create_up_down_counter( + name=AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT, + description="Number of active client instances", + unit="{instance}", + ) + +AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE: Final = "azure.cosmosdb.client.operation.request_charge" +""" +[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation +Instrument: histogram +Unit: {request_unit} +""" + + + +def create_azure_cosmosdb_client_operation_request_charge(meter: Meter) -> Histogram: + """[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation""" + return meter.create_histogram( + name=AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE, + description="[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation", + unit="{request_unit}", + ) \ No newline at end of file diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py index 16992f0bc62..53fbfacafbe 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cicd_metrics.py @@ -13,13 +13,9 @@ # limitations under the License. - from typing import Final -from opentelemetry.metrics import Meter -from opentelemetry.metrics import Counter -from opentelemetry.metrics import Histogram -from opentelemetry.metrics import UpDownCounter +from opentelemetry.metrics import Counter, Histogram, Meter, UpDownCounter CICD_PIPELINE_RUN_ACTIVE: Final = "cicd.pipeline.run.active" """ @@ -29,7 +25,6 @@ """ - def create_cicd_pipeline_run_active(meter: Meter) -> UpDownCounter: """The number of pipeline runs currently active in the system by state""" return meter.create_up_down_counter( @@ -38,6 +33,7 @@ def create_cicd_pipeline_run_active(meter: Meter) -> UpDownCounter: unit="{run}", ) + CICD_PIPELINE_RUN_DURATION: Final = "cicd.pipeline.run.duration" """ Duration of a pipeline run grouped by pipeline, state and result @@ -46,7 +42,6 @@ def create_cicd_pipeline_run_active(meter: Meter) -> UpDownCounter: """ - def create_cicd_pipeline_run_duration(meter: Meter) -> Histogram: """Duration of a pipeline run grouped by pipeline, state and result""" return meter.create_histogram( @@ -55,6 +50,7 @@ def create_cicd_pipeline_run_duration(meter: Meter) -> Histogram: unit="s", ) + CICD_PIPELINE_RUN_ERRORS: Final = "cicd.pipeline.run.errors" """ The number of errors encountered in pipeline runs (eg. compile, test failures) @@ -65,7 +61,6 @@ def create_cicd_pipeline_run_duration(meter: Meter) -> Histogram: """ - def create_cicd_pipeline_run_errors(meter: Meter) -> Counter: """The number of errors encountered in pipeline runs (eg. compile, test failures)""" return meter.create_counter( @@ -74,6 +69,7 @@ def create_cicd_pipeline_run_errors(meter: Meter) -> Counter: unit="{error}", ) + CICD_SYSTEM_ERRORS: Final = "cicd.system.errors" """ The number of errors in a component of the CICD system (eg. controller, scheduler, agent) @@ -83,7 +79,6 @@ def create_cicd_pipeline_run_errors(meter: Meter) -> Counter: """ - def create_cicd_system_errors(meter: Meter) -> Counter: """The number of errors in a component of the CICD system (eg. controller, scheduler, agent)""" return meter.create_counter( @@ -92,6 +87,7 @@ def create_cicd_system_errors(meter: Meter) -> Counter: unit="{error}", ) + CICD_WORKER_COUNT: Final = "cicd.worker.count" """ The number of workers on the CICD system by state @@ -100,11 +96,10 @@ def create_cicd_system_errors(meter: Meter) -> Counter: """ - def create_cicd_worker_count(meter: Meter) -> UpDownCounter: """The number of workers on the CICD system by state""" return meter.create_up_down_counter( name=CICD_WORKER_COUNT, description="The number of workers on the CICD system by state.", unit="{count}", - ) \ No newline at end of file + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py index 24ac4527ef0..32c0f55ff13 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/db_metrics.py @@ -317,19 +317,17 @@ def create_db_client_connections_wait_time(meter: Meter) -> Histogram: "db.client.cosmosdb.active_instance.count" ) """ -Number of active client instances -Instrument: updowncounter -Unit: {instance} +Deprecated: Replaced by `azure.cosmosdb.client.active_instance.count`. """ def create_db_client_cosmosdb_active_instance_count( meter: Meter, ) -> UpDownCounter: - """Number of active client instances""" + """Deprecated, use `azure.cosmosdb.client.active_instance.count` instead""" return meter.create_up_down_counter( name=DB_CLIENT_COSMOSDB_ACTIVE_INSTANCE_COUNT, - description="Number of active client instances", + description="Deprecated, use `azure.cosmosdb.client.active_instance.count` instead.", unit="{instance}", ) @@ -338,19 +336,17 @@ def create_db_client_cosmosdb_active_instance_count( "db.client.cosmosdb.operation.request_charge" ) """ -[Request charge](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation -Instrument: histogram -Unit: {request_unit} +Deprecated: Replaced by `azure.cosmosdb.client.operation.request_charge`. """ def create_db_client_cosmosdb_operation_request_charge( meter: Meter, ) -> Histogram: - """[Request charge](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation""" + """Deprecated, use `azure.cosmosdb.client.operation.request_charge` instead""" return meter.create_histogram( name=DB_CLIENT_COSMOSDB_OPERATION_REQUEST_CHARGE, - description="[Request charge](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation", + description="Deprecated, use `azure.cosmosdb.client.operation.request_charge` instead.", unit="{request_unit}", ) From 8f025003b2c452751f3fd592e3c3fcde85c80520 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Fri, 24 Jan 2025 15:08:52 -0800 Subject: [PATCH 3/5] released --- .../attributes/azure_attributes.py | 21 ++++++++------- .../attributes/cassandra_attributes.py | 12 +++------ .../attributes/elasticsearch_attributes.py | 8 ------ .../_incubating/metrics/azure_metrics.py | 26 +++++++++++-------- .../src/opentelemetry/semconv/schemas.py | 4 +++ scripts/semconv/generate.sh | 4 +-- 6 files changed, 36 insertions(+), 39 deletions(-) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py index c626929694a..2f9d13725e1 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/azure_attributes.py @@ -12,13 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Final - - - - - from enum import Enum +from typing import Final AZURE_CLIENT_ID: Final = "azure.client.id" """ @@ -35,13 +30,17 @@ Account or request [consistency level](https://learn.microsoft.com/azure/cosmos-db/consistency-levels). """ -AZURE_COSMOSDB_OPERATION_CONTACTED_REGIONS: Final = "azure.cosmosdb.operation.contacted_regions" +AZURE_COSMOSDB_OPERATION_CONTACTED_REGIONS: Final = ( + "azure.cosmosdb.operation.contacted_regions" +) """ List of regions contacted during operation in the order that they were contacted. If there is more than one region listed, it indicates that the operation was performed on multiple regions i.e. cross-regional call. Note: Region name matches the format of `displayName` in [Azure Location API](https://learn.microsoft.com/rest/api/subscription/subscriptions/list-locations?view=rest-subscription-2021-10-01&tabs=HTTP#location). """ -AZURE_COSMOSDB_OPERATION_REQUEST_CHARGE: Final = "azure.cosmosdb.operation.request_charge" +AZURE_COSMOSDB_OPERATION_REQUEST_CHARGE: Final = ( + "azure.cosmosdb.operation.request_charge" +) """ The number of request units consumed by the operation. """ @@ -51,19 +50,21 @@ Request payload size in bytes. """ -AZURE_COSMOSDB_RESPONSE_SUB_STATUS_CODE: Final = "azure.cosmosdb.response.sub_status_code" +AZURE_COSMOSDB_RESPONSE_SUB_STATUS_CODE: Final = ( + "azure.cosmosdb.response.sub_status_code" +) """ Cosmos DB sub status code. """ - class AzureCosmosdbConnectionModeValues(Enum): GATEWAY = "gateway" """Gateway (HTTP) connection.""" DIRECT = "direct" """Direct connection.""" + class AzureCosmosdbConsistencyLevelValues(Enum): STRONG = "Strong" """strong.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py index 80297a45f06..17fbd4ca224 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/cassandra_attributes.py @@ -12,13 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Final - - - - - from enum import Enum +from typing import Final CASSANDRA_CONSISTENCY_LEVEL: Final = "cassandra.consistency.level" """ @@ -45,13 +40,14 @@ Whether or not the query is idempotent. """ -CASSANDRA_SPECULATIVE_EXECUTION_COUNT: Final = "cassandra.speculative_execution.count" +CASSANDRA_SPECULATIVE_EXECUTION_COUNT: Final = ( + "cassandra.speculative_execution.count" +) """ The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. """ - class CassandraConsistencyLevelValues(Enum): ALL = "all" """all.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py index 89ab63bbd74..242437428e5 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/elasticsearch_attributes.py @@ -14,15 +14,7 @@ from typing import Final - - - - - - ELASTICSEARCH_NODE_NAME: Final = "elasticsearch.node.name" """ Represents the human-readable identifier of the node/instance to which a request was routed. """ - - diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py index 2e1db447e43..2e45a2cab72 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/azure_metrics.py @@ -13,14 +13,13 @@ # limitations under the License. - from typing import Final -from opentelemetry.metrics import Meter -from opentelemetry.metrics import Histogram -from opentelemetry.metrics import UpDownCounter +from opentelemetry.metrics import Histogram, Meter, UpDownCounter -AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT: Final = "azure.cosmosdb.client.active_instance.count" +AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT: Final = ( + "azure.cosmosdb.client.active_instance.count" +) """ Number of active client instances Instrument: updowncounter @@ -28,8 +27,9 @@ """ - -def create_azure_cosmosdb_client_active_instance_count(meter: Meter) -> UpDownCounter: +def create_azure_cosmosdb_client_active_instance_count( + meter: Meter, +) -> UpDownCounter: """Number of active client instances""" return meter.create_up_down_counter( name=AZURE_COSMOSDB_CLIENT_ACTIVE_INSTANCE_COUNT, @@ -37,7 +37,10 @@ def create_azure_cosmosdb_client_active_instance_count(meter: Meter) -> UpDownCo unit="{instance}", ) -AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE: Final = "azure.cosmosdb.client.operation.request_charge" + +AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE: Final = ( + "azure.cosmosdb.client.operation.request_charge" +) """ [Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation Instrument: histogram @@ -45,11 +48,12 @@ def create_azure_cosmosdb_client_active_instance_count(meter: Meter) -> UpDownCo """ - -def create_azure_cosmosdb_client_operation_request_charge(meter: Meter) -> Histogram: +def create_azure_cosmosdb_client_operation_request_charge( + meter: Meter, +) -> Histogram: """[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation""" return meter.create_histogram( name=AZURE_COSMOSDB_CLIENT_OPERATION_REQUEST_CHARGE, description="[Request units](https://learn.microsoft.com/azure/cosmos-db/request-units) consumed by the operation", unit="{request_unit}", - ) \ No newline at end of file + ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py index 8171ef67e32..edb05a563da 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py @@ -46,5 +46,9 @@ class Schemas(Enum): The URL of the OpenTelemetry schema version 1.29.0. """ + V1_30_0 = "https://opentelemetry.io/schemas/1.30.0" + """ + The URL of the OpenTelemetry schema version 1.30.0. + """ # when generating new semantic conventions, # make sure to add new versions version here. diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index c808b5ab5c4..e2c2142ebfa 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -5,8 +5,8 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../.." # freeze the spec version to make SemanticAttributes generation reproducible -SEMCONV_VERSION=1.29.0 -SEMCONV_VERSION_TAG=main +SEMCONV_VERSION=1.30.0 +SEMCONV_VERSION_TAG=v1.30.0 OTEL_WEAVER_IMG_VERSION=v0.12.0 INCUBATING_DIR=_incubating cd ${SCRIPT_DIR} From 06ad51b33094a4aa56ebcf1aa9771426c6c5e349 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Fri, 24 Jan 2025 15:09:38 -0800 Subject: [PATCH 4/5] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 325b288ccfc..24aa9f45165 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#4371](https://github.com/open-telemetry/opentelemetry-python/pull/4371)) - Fix span context manager typing by using ParamSpec from typing_extensions ([#4389](https://github.com/open-telemetry/opentelemetry-python/pull/4389)) +- semantic-conventions: Bump to 1.30.0 + ([#4337](https://github.com/open-telemetry/opentelemetry-python/pull/4397)) ## Version 1.29.0/0.50b0 (2024-12-11) From 232a364b38d04c7b0bf5c5c01255a4e07139e8c4 Mon Sep 17 00:00:00 2001 From: Liudmila Molkova Date: Fri, 24 Jan 2025 15:11:23 -0800 Subject: [PATCH 5/5] up --- scripts/semconv/generate.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/semconv/generate.sh b/scripts/semconv/generate.sh index e2c2142ebfa..0525f6ced1f 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -6,7 +6,7 @@ ROOT_DIR="${SCRIPT_DIR}/../.." # freeze the spec version to make SemanticAttributes generation reproducible SEMCONV_VERSION=1.30.0 -SEMCONV_VERSION_TAG=v1.30.0 +SEMCONV_VERSION_TAG=v$SEMCONV_VERSION OTEL_WEAVER_IMG_VERSION=v0.12.0 INCUBATING_DIR=_incubating cd ${SCRIPT_DIR}