diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ad3ae2efd8..98c755d9123 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#4649](https://github.com/open-telemetry/opentelemetry-python/pull/4649)) - proto: relax protobuf version requirement to support v6 ([#4620](https://github.com/open-telemetry/opentelemetry-python/pull/4620)) +- Bump semantic-conventions to 1.36.0 + ([#4669](https://github.com/open-telemetry/opentelemetry-python/pull/4669)) - Set expected User-Agent in HTTP headers for grpc OTLP exporter ([#4658](https://github.com/open-telemetry/opentelemetry-python/pull/4658)) diff --git a/opentelemetry-semantic-conventions/.pylintrc b/opentelemetry-semantic-conventions/.pylintrc new file mode 100644 index 00000000000..1ac1d17821e --- /dev/null +++ b/opentelemetry-semantic-conventions/.pylintrc @@ -0,0 +1,492 @@ +[MASTER] + +# A comma-separated list of package or module names from where C extensions may +# be loaded. Extensions are loading into the active Python interpreter and may +# run arbitrary code. +extension-pkg-whitelist= + +# Add list of files or directories to be excluded. They should be base names, not +# paths. +ignore=CVS,gen,proto + +# Add files or directories matching the regex patterns to be excluded. The +# regex matches against base names, not paths. +ignore-patterns= + +# Python code to execute, usually for sys.path manipulation such as +# pygtk.require(). +#init-hook= + +# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the +# number of processors available to use. +jobs=0 + +# Control the amount of potential inferred values when inferring a single +# object. This can help the performance when dealing with large functions or +# complex, nested conditions. +limit-inference-results=100 + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +load-plugins=pylint.extensions.no_self_use + +# Pickle collected data for later comparisons. +persistent=yes + +# Specify a configuration file. +#rcfile= + +# When enabled, pylint would attempt to guess common misconfiguration and emit +# user-friendly hints instead of false-positive error messages. +suggestion-mode=yes + +# Allow loading of arbitrary C extensions. Extensions are imported into the +# active Python interpreter and may run arbitrary code. +unsafe-load-any-extension=no + +# Run python dependant checks considering the baseline version +py-version=3.9 + + +[MESSAGES CONTROL] + +# Only show warnings with the listed confidence levels. Leave empty to show +# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED. +confidence= + +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once). You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use "--disable=all --enable=classes +# --disable=W". +disable=missing-docstring, + fixme, # Warns about FIXME, TODO, etc. comments. + too-few-public-methods, # Might be good to re-enable this later. + too-many-instance-attributes, + too-many-arguments, + too-many-positional-arguments, + duplicate-code, + ungrouped-imports, # Leave this up to isort + wrong-import-order, # Leave this up to isort + line-too-long, # Leave this up to black + exec-used, + super-with-arguments, # temp-pylint-upgrade + isinstance-second-argument-not-valid-type, # temp-pylint-upgrade + raise-missing-from, # temp-pylint-upgrade + unused-argument, # temp-pylint-upgrade + redefined-builtin, + cyclic-import, + too-many-lines, + +# Enable the message, report, category or checker with the given id(s). You can +# either give multiple identifier separated by comma (,) or put this option +# multiple time (only on the command line, not in the configuration file where +# it should appear only once). See also the "--disable" option for examples. +# enable=c-extension-no-member + + +[REPORTS] + +# Python expression which should return a note less than 10 (10 is the highest +# note). You have access to the variables errors warning, statement which +# respectively contain the number of errors / warnings messages and the total +# number of statements analyzed. This is used by the global evaluation report +# (RP0004). +#evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) + +# Template used to display messages. This is a python new-style format string +# used to format the message information. See doc for all details. +#msg-template= + +# Set the output format. Available formats are text, parseable, colorized, json +# and msvs (visual studio). You can also give a reporter class, e.g. +# mypackage.mymodule.MyReporterClass. +#output-format=text + +# Tells whether to display a full report or only the messages. +#reports=no + +# Activate the evaluation score. +score=yes + + +[REFACTORING] + +# Maximum number of nested blocks for function / method body +max-nested-blocks=5 + +# Complete name of functions that never returns. When checking for +# inconsistent-return-statements if a never returning function is called then +# it will be considered as an explicit return statement and no message will be +# printed. +never-returning-functions=sys.exit + + +[LOGGING] + +# Format style used to check logging format string. `old` means using % +# formatting, while `new` is for `{}` formatting. +logging-format-style=old + +# Logging modules to check that the string format arguments are in logging +# function parameter format. +logging-modules=logging + + +[SPELLING] + +# Limits count of emitted suggestions for spelling mistakes. +max-spelling-suggestions=4 + +# Spelling dictionary name. Available dictionaries: none. To make it working +# install python-enchant package.. +spelling-dict= + +# List of comma separated words that should not be checked. +spelling-ignore-words= + +# A path to a file that contains private dictionary; one word per line. +spelling-private-dict-file= + +# Tells whether to store unknown words to indicated private dictionary in +# --spelling-private-dict-file option instead of raising a message. +spelling-store-unknown-words=no + + +[MISCELLANEOUS] + +# List of note tags to take in consideration, separated by a comma. +notes=FIXME, + XXX, + TODO + + +[TYPECHECK] + +# List of decorators that produce context managers, such as +# contextlib.contextmanager. Add to this list to register other decorators that +# produce valid context managers. +contextmanager-decorators=contextlib.contextmanager, _agnosticcontextmanager + +# List of members which are set dynamically and missed by pylint inference +# system, and so shouldn't trigger E1101 when accessed. Python regular +# expressions are accepted. +generated-members=zipkin_pb2.* + +# Tells whether missing members accessed in mixin class should be ignored. A +# mixin class is detected if its name ends with "mixin" (case insensitive). +#ignore-mixin-members=yes + +# Tells whether to warn about missing members when the owner of the attribute +# is inferred to be None. +#ignore-none=yes + +# This flag controls whether pylint should warn about no-member and similar +# checks whenever an opaque object is returned when inferring. The inference +# can return multiple potential results while evaluating a Python object, but +# some branches might not be evaluated, which results in partial inference. In +# that case, it might be useful to still emit no-member and other checks for +# the rest of the inferred objects. +#ignore-on-opaque-inference=yes + +# List of class names for which member attributes should not be checked (useful +# for classes with dynamically set attributes). This supports the use of +# qualified names. +ignored-classes=optparse.Values,thread._local,_thread._local + +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +ignored-modules= + +# Show a hint with possible names when a member name was not found. The aspect +# of finding the hint is based on edit distance. +missing-member-hint=yes + +# The minimum edit distance a name should have in order to be considered a +# similar match for a missing member name. +missing-member-hint-distance=1 + +# The total number of similar names that should be taken in consideration when +# showing a hint for a missing member. +missing-member-max-choices=1 + + +[VARIABLES] + +# List of additional names supposed to be defined in builtins. Remember that +# you should avoid defining new builtins when possible. +additional-builtins= + +# Tells whether unused global variables should be treated as a violation. +allow-global-unused-variables=yes + +# List of strings which can identify a callback function by name. A callback +# name must start or end with one of those strings. +callbacks=cb_, + _cb + +# A regular expression matching the name of dummy variables (i.e. expected to +# not be used). +dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ + +# Argument names that match this expression will be ignored. Default to name +# with leading underscore. +ignored-argument-names=_.*|^ignored_|^unused_|^kwargs|^args + +# Tells whether we should check for unused import in __init__ files. +init-import=no + +# List of qualified module names which can have objects that can redefine +# builtins. +redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io + + +[FORMAT] + +# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. +expected-line-ending-format=LF + +# Regexp for a line that is allowed to be longer than the limit. +ignore-long-lines=^\s*(# )??$ + +# Number of spaces of indent required inside a hanging or continued line. +indent-after-paren=4 + +# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 +# tab). +indent-string=' ' + +# Maximum number of characters on a single line. +max-line-length=79 + +# Maximum number of lines in a module. +max-module-lines=1000 + +# Allow the body of a class to be on the same line as the declaration if body +# contains single statement. +single-line-class-stmt=no + +# Allow the body of an if to be on the same line as the test if there is no +# else. +single-line-if-stmt=no + + +[SIMILARITIES] + +# Ignore comments when computing similarities. +ignore-comments=yes + +# Ignore docstrings when computing similarities. +ignore-docstrings=yes + +# Ignore imports when computing similarities. +ignore-imports=no + +# Minimum lines number of a similarity. +min-similarity-lines=4 + + +[BASIC] + +# Naming style matching correct argument names. +argument-naming-style=snake_case + +# Regular expression matching correct argument names. Overrides argument- +# naming-style. +#argument-rgx= + +# Naming style matching correct attribute names. +attr-naming-style=snake_case + +# Regular expression matching correct attribute names. Overrides attr-naming- +# style. +#attr-rgx= + +# Bad variable names which should always be refused, separated by a comma. +bad-names=foo, + bar, + baz, + toto, + tutu, + tata + +# Naming style matching correct class attribute names. +class-attribute-naming-style=any + +# Regular expression matching correct class attribute names. Overrides class- +# attribute-naming-style. +#class-attribute-rgx= + +# Naming style matching correct class names. +class-naming-style=PascalCase + +# Regular expression matching correct class names. Overrides class-naming- +# style. +#class-rgx= + +# Naming style matching correct constant names. +const-naming-style=any + +# Regular expression matching correct constant names. Overrides const-naming- +# style. +#const-rgx= + +# Minimum line length for functions/classes that require docstrings, shorter +# ones are exempt. +docstring-min-length=-1 + +# Naming style matching correct function names. +function-naming-style=snake_case + +# Regular expression matching correct function names. Overrides function- +# naming-style. +#function-rgx= + +# Good variable names which should always be accepted, separated by a comma. +good-names=_, + log, + logger + +# Include a hint for the correct naming format with invalid-name. +include-naming-hint=yes + +# Naming style matching correct inline iteration names. +inlinevar-naming-style=any + +# Regular expression matching correct inline iteration names. Overrides +# inlinevar-naming-style. +#inlinevar-rgx= + +# Naming style matching correct method names. +method-naming-style=snake_case + +# Regular expression matching correct method names. Overrides method-naming- +# style. +#method-rgx= + +# Naming style matching correct module names. +module-naming-style=snake_case + +# Regular expression matching correct module names. Overrides module-naming- +# style. +#module-rgx= + +# Colon-delimited sets of names that determine each other's naming style when +# the name regexes allow several styles. +name-group= + +# Regular expression which should only match function or class names that do +# not require a docstring. +no-docstring-rgx=^_ + +# List of decorators that produce properties, such as abc.abstractproperty. Add +# to this list to register other decorators that produce valid properties. +# These decorators are taken in consideration only for invalid-name. +property-classes=abc.abstractproperty + +# Naming style matching correct variable names. +variable-naming-style=snake_case + +# Regular expression matching correct variable names. Overrides variable- +# naming-style. +variable-rgx=(([a-z_][a-z0-9_]{1,})|(_[a-z0-9_]*)|(__[a-z][a-z0-9_]+__))$ + + +[IMPORTS] + +# Allow wildcard imports from modules that define __all__. +allow-wildcard-with-all=no + +# Analyse import fallback blocks. This can be used to support both Python 2 and +# 3 compatible code, which means that the block might have code that exists +# only in one or another interpreter, leading to false positives when analysed. +analyse-fallback-blocks=yes + +# Deprecated modules which should not be used, separated by a comma. +deprecated-modules=optparse,tkinter.tix + +# Create a graph of external dependencies in the given file (report RP0402 must +# not be disabled). +ext-import-graph= + +# Create a graph of every (i.e. internal and external) dependencies in the +# given file (report RP0402 must not be disabled). +import-graph= + +# Create a graph of internal dependencies in the given file (report RP0402 must +# not be disabled). +int-import-graph= + +# Force import order to recognize a module as part of the standard +# compatibility libraries. +known-standard-library=six + +# Force import order to recognize a module as part of a third party library. +known-third-party=enchant + + +[CLASSES] + +# List of method names used to declare (i.e. assign) instance attributes. +defining-attr-methods=__init__, + __new__, + setUp + +# List of member names, which should be excluded from the protected access +# warning. +exclude-protected=_asdict, + _fields, + _replace, + _source, + _make, + _Span + +# List of valid names for the first argument in a class method. +valid-classmethod-first-arg=cls + +# List of valid names for the first argument in a metaclass class method. +valid-metaclass-classmethod-first-arg=cls + + +[DESIGN] + +# Maximum number of arguments for function / method. +max-args=5 + +# Maximum number of attributes for a class (see R0902). +max-attributes=7 + +# Maximum number of boolean expressions in an if statement. +max-bool-expr=5 + +# Maximum number of branch for function / method body. +max-branches=12 + +# Maximum number of locals for function / method body. +max-locals=15 + +# Maximum number of parents for a class (see R0901). +max-parents=7 + +# Maximum number of public methods for a class (see R0904). +max-public-methods=20 + +# Maximum number of return / yield for function / method body. +max-returns=6 + +# Maximum number of statements in function / method body. +max-statements=50 + +# Minimum number of public methods for a class (see R0903). +min-public-methods=2 + +[EXCEPTIONS] + +# Exceptions that will emit a warning when being caught. +overgeneral-exceptions=builtins.Exception diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py index f55696535ac..7e3813b35dd 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/az_attributes.py @@ -16,10 +16,10 @@ AZ_NAMESPACE: Final = "az.namespace" """ -[Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client. +Deprecated: Replaced by `azure.resource_provider.namespace`. """ AZ_SERVICE_REQUEST_ID: Final = "az.service_request_id" """ -The unique identifier of the service request. It's generated by the Azure service and returned with the response. +Deprecated: Replaced by `azure.service.request.id`. """ 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 2f9d13725e1..eb883d222c8 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 @@ -57,6 +57,16 @@ Cosmos DB sub status code. """ +AZURE_RESOURCE_PROVIDER_NAMESPACE: Final = "azure.resource_provider.namespace" +""" +[Azure Resource Provider Namespace](https://learn.microsoft.com/azure/azure-resource-manager/management/azure-services-resource-providers) as recognized by the client. +""" + +AZURE_SERVICE_REQUEST_ID: Final = "azure.service.request.id" +""" +The unique identifier of the service request. It's generated by the Azure service and returned with the response. +""" + class AzureCosmosdbConnectionModeValues(Enum): GATEWAY = "gateway" 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 faed11b093e..04e9d4a2982 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 @@ -58,7 +58,7 @@ with the resolved function version, as the same runtime instance may be invocable with multiple different aliases. - **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) -- **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/rest/api/resources/resources/get-by-id) of the invoked function, +- **Azure:** The [Fully Qualified Resource ID](https://learn.microsoft.com/rest/api/resources/resources/get-by-id) of the invoked function, *not* the function app, having the form `/subscriptions//resourceGroups//providers/Microsoft.Web/sites//functions/`. This means that a span attribute MUST be used, as an Azure function app can host multiple functions that would usually share @@ -87,19 +87,19 @@ class CloudPlatformValues(Enum): """AWS App Runner.""" AWS_OPENSHIFT = "aws_openshift" """Red Hat OpenShift on AWS (ROSA).""" - AZURE_VM = "azure_vm" + AZURE_VM = "azure.vm" """Azure Virtual Machines.""" - AZURE_CONTAINER_APPS = "azure_container_apps" + AZURE_CONTAINER_APPS = "azure.container_apps" """Azure Container Apps.""" - AZURE_CONTAINER_INSTANCES = "azure_container_instances" + AZURE_CONTAINER_INSTANCES = "azure.container_instances" """Azure Container Instances.""" - AZURE_AKS = "azure_aks" + AZURE_AKS = "azure.aks" """Azure Kubernetes Service.""" - AZURE_FUNCTIONS = "azure_functions" + AZURE_FUNCTIONS = "azure.functions" """Azure Functions.""" - AZURE_APP_SERVICE = "azure_app_service" + AZURE_APP_SERVICE = "azure.app_service" """Azure App Service.""" - AZURE_OPENSHIFT = "azure_openshift" + AZURE_OPENSHIFT = "azure.openshift" """Azure Red Hat OpenShift.""" GCP_BARE_METAL_SOLUTION = "gcp_bare_metal_solution" """Google Bare Metal Solution (BMS).""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py index cfb00bcf307..ca162d42e3b 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/dns_attributes.py @@ -14,6 +14,11 @@ from typing import Final +DNS_ANSWERS: Final = "dns.answers" +""" +The list of IPv4 or IPv6 addresses resolved during DNS lookup. +""" + DNS_QUESTION_NAME: Final = "dns.question.name" """ The name being queried. 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 7a4c95dc5f2..67c91d988dc 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 @@ -302,10 +302,14 @@ class GenAiSystemValues(Enum): """Anthropic.""" COHERE = "cohere" """Cohere.""" - AZ_AI_INFERENCE = "az.ai.inference" + AZURE_AI_INFERENCE = "azure.ai.inference" """Azure AI Inference.""" - AZ_AI_OPENAI = "az.ai.openai" + AZURE_AI_OPENAI = "azure.ai.openai" """Azure OpenAI.""" + AZ_AI_INFERENCE = "az.ai.inference" + """Deprecated: Replaced by azure.ai.inference.""" + AZ_AI_OPENAI = "azure.ai.openai" + """Deprecated: Replaced by azure.ai.openai.""" IBM_WATSONX_AI = "ibm.watsonx.ai" """IBM Watsonx AI.""" AWS_BEDROCK = "aws.bedrock" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py index e31e5c227c3..e97f5ce507d 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/http_attributes.py @@ -106,7 +106,7 @@ HTTP_RESPONSE_CONTENT_LENGTH: Final = "http.response_content_length" """ -Deprecated: hp.response.header.content-length. +Deprecated: Replaced by `http.response.header.content-length`. """ HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED: Final = ( 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 9247dcae1a0..557d333d697 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 @@ -64,6 +64,16 @@ Last terminated reason of the Container. """ +K8S_CONTAINER_STATUS_REASON: Final = "k8s.container.status.reason" +""" +The reason for the container state. Corresponds to the `reason` field of the: [K8s ContainerStateWaiting](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatewaiting-v1-core) or [K8s ContainerStateTerminated](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstateterminated-v1-core). +""" + +K8S_CONTAINER_STATUS_STATE: Final = "k8s.container.status.state" +""" +The state of the container. [K8s ContainerState](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstate-v1-core). +""" + K8S_CRONJOB_ANNOTATION_TEMPLATE: Final = "k8s.cronjob.annotation" """ The cronjob annotation placed on the CronJob, the `` being the annotation name, the value being the annotation value. @@ -98,14 +108,24 @@ K8S_DAEMONSET_ANNOTATION_TEMPLATE: Final = "k8s.daemonset.annotation" """ -The annotation key-value pairs placed on the DaemonSet. -Note: The `` being the annotation name, the value being the annotation value, even if the value is empty. +The annotation placed on the DaemonSet, the `` being the annotation name, the value being the annotation value, even if the value is empty. +Note: Examples: + +- A label `replicas` with value `1` SHOULD be recorded + as the `k8s.daemonset.annotation.replicas` attribute with value `"1"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.daemonset.annotation.data` attribute with value `""`. """ K8S_DAEMONSET_LABEL_TEMPLATE: Final = "k8s.daemonset.label" """ -The label key-value pairs placed on the DaemonSet. -Note: The `` being the label name, the value being the label value, even if the value is empty. +The label placed on the DaemonSet, the `` being the label name, the value being the label value, even if the value is empty. +Note: Examples: + +- A label `app` with value `guestbook` SHOULD be recorded + as the `k8s.daemonset.label.app` attribute with value `"guestbook"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.daemonset.label.injected` attribute with value `""`. """ K8S_DAEMONSET_NAME: Final = "k8s.daemonset.name" @@ -120,14 +140,24 @@ K8S_DEPLOYMENT_ANNOTATION_TEMPLATE: Final = "k8s.deployment.annotation" """ -The annotation key-value pairs placed on the Deployment. -Note: The `` being the annotation name, the value being the annotation value, even if the value is empty. +The annotation placed on the Deployment, the `` being the annotation name, the value being the annotation value, even if the value is empty. +Note: Examples: + +- A label `replicas` with value `1` SHOULD be recorded + as the `k8s.deployment.annotation.replicas` attribute with value `"1"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.deployment.annotation.data` attribute with value `""`. """ K8S_DEPLOYMENT_LABEL_TEMPLATE: Final = "k8s.deployment.label" """ -The label key-value pairs placed on the Deployment. -Note: The `` being the label name, the value being the label value, even if the value is empty. +The label placed on the Deployment, the `` being the label name, the value being the label value, even if the value is empty. +Note: Examples: + +- A label `replicas` with value `0` SHOULD be recorded + as the `k8s.deployment.label.app` attribute with value `"guestbook"`. +- A label `injected` with empty string value SHOULD be recorded as + the `k8s.deployment.label.injected` attribute with value `""`. """ K8S_DEPLOYMENT_NAME: Final = "k8s.deployment.name" @@ -140,26 +170,67 @@ The UID of the Deployment. """ +K8S_HPA_METRIC_TYPE: Final = "k8s.hpa.metric.type" +""" +The type of metric source for the horizontal pod autoscaler. +Note: This attribute reflects the `type` field of spec.metrics[] in the HPA. +""" + K8S_HPA_NAME: Final = "k8s.hpa.name" """ The name of the horizontal pod autoscaler. """ +K8S_HPA_SCALETARGETREF_API_VERSION: Final = ( + "k8s.hpa.scaletargetref.api_version" +) +""" +The API version of the target resource to scale for the HorizontalPodAutoscaler. +Note: This maps to the `apiVersion` field in the `scaleTargetRef` of the HPA spec. +""" + +K8S_HPA_SCALETARGETREF_KIND: Final = "k8s.hpa.scaletargetref.kind" +""" +The kind of the target resource to scale for the HorizontalPodAutoscaler. +Note: This maps to the `kind` field in the `scaleTargetRef` of the HPA spec. +""" + +K8S_HPA_SCALETARGETREF_NAME: Final = "k8s.hpa.scaletargetref.name" +""" +The name of the target resource to scale for the HorizontalPodAutoscaler. +Note: This maps to the `name` field in the `scaleTargetRef` of the HPA spec. +""" + K8S_HPA_UID: Final = "k8s.hpa.uid" """ The UID of the horizontal pod autoscaler. """ +K8S_HUGEPAGE_SIZE: Final = "k8s.hugepage.size" +""" +The size (identifier) of the K8s huge page. +""" + K8S_JOB_ANNOTATION_TEMPLATE: Final = "k8s.job.annotation" """ -The annotation key-value pairs placed on the Job. -Note: The `` being the annotation name, the value being the annotation value, even if the value is empty. +The annotation placed on the Job, the `` being the annotation name, the value being the annotation value, even if the value is empty. +Note: Examples: + +- A label `number` with value `1` SHOULD be recorded + as the `k8s.job.annotation.number` attribute with value `"1"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.job.annotation.data` attribute with value `""`. """ K8S_JOB_LABEL_TEMPLATE: Final = "k8s.job.label" """ -The label key-value pairs placed on the Job. -Note: The `` being the label name, the value being the label value, even if the value is empty. +The label placed on the Job, the `` being the label name, the value being the label value, even if the value is empty. +Note: Examples: + +- A label `jobtype` with value `ci` SHOULD be recorded + as the `k8s.job.label.jobtype` attribute with value `"ci"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.job.label.automated` attribute with value `""`. """ K8S_JOB_NAME: Final = "k8s.job.name" @@ -174,14 +245,24 @@ K8S_NAMESPACE_ANNOTATION_TEMPLATE: Final = "k8s.namespace.annotation" """ -The annotation key-value pairs placed on the Namespace. -Note: The `` being the annotation name, the value being the annotation value, even if the value is empty. +The annotation placed on the Namespace, the `` being the annotation name, the value being the annotation value, even if the value is empty. +Note: Examples: + +- A label `ttl` with value `0` SHOULD be recorded + as the `k8s.namespace.annotation.ttl` attribute with value `"0"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.namespace.annotation.data` attribute with value `""`. """ K8S_NAMESPACE_LABEL_TEMPLATE: Final = "k8s.namespace.label" """ -The label key-value pairs placed on the Namespace. -Note: The `` being the label name, the value being the label value, even if the value is empty. +The label placed on the Namespace, the `` being the label name, the value being the label value, even if the value is empty. +Note: Examples: + +- A label `kubernetes.io/metadata.name` with value `default` SHOULD be recorded + as the `k8s.namespace.label.kubernetes.io/metadata.name` attribute with value `"default"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.namespace.label.data` attribute with value `""`. """ K8S_NAMESPACE_NAME: Final = "k8s.namespace.name" @@ -207,6 +288,27 @@ the `k8s.node.annotation.data` attribute with value `""`. """ +K8S_NODE_CONDITION_STATUS: Final = "k8s.node.condition.status" +""" +The status of the condition, one of True, False, Unknown. +Note: This attribute aligns with the `status` field of the +[NodeCondition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core). +""" + +K8S_NODE_CONDITION_TYPE: Final = "k8s.node.condition.type" +""" +The condition type of a K8s Node. +Note: K8s Node conditions as described +by [K8s documentation](https://v1-32.docs.kubernetes.io/docs/reference/node/node-status/#condition). + +This attribute aligns with the `type` field of the +[NodeCondition](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#nodecondition-v1-core) + +The set of possible values is not limited to those listed here. Managed Kubernetes environments, +or custom controllers MAY introduce additional node condition types. +When this occurs, the exact value as reported by the Kubernetes API SHOULD be used. +""" + K8S_NODE_LABEL_TEMPLATE: Final = "k8s.node.label" """ The label placed on the Node, the `` being the label name, the value being the label value, even if the value is empty. @@ -271,14 +373,24 @@ K8S_REPLICASET_ANNOTATION_TEMPLATE: Final = "k8s.replicaset.annotation" """ -The annotation key-value pairs placed on the ReplicaSet. -Note: The `` being the annotation name, the value being the annotation value, even if the value is empty. +The annotation placed on the ReplicaSet, the `` being the annotation name, the value being the annotation value, even if the value is empty. +Note: Examples: + +- A label `replicas` with value `0` SHOULD be recorded + as the `k8s.replicaset.annotation.replicas` attribute with value `"0"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.replicaset.annotation.data` attribute with value `""`. """ K8S_REPLICASET_LABEL_TEMPLATE: Final = "k8s.replicaset.label" """ -The label key-value pairs placed on the ReplicaSet. -Note: The `` being the label name, the value being the label value, even if the value is empty. +The label placed on the ReplicaSet, the `` being the label name, the value being the label value, even if the value is empty. +Note: Examples: + +- A label `app` with value `guestbook` SHOULD be recorded + as the `k8s.replicaset.label.app` attribute with value `"guestbook"`. +- A label `injected` with empty string value SHOULD be recorded as + the `k8s.replicaset.label.injected` attribute with value `""`. """ K8S_REPLICASET_NAME: Final = "k8s.replicaset.name" @@ -306,6 +418,12 @@ The name of the resource quota. """ +K8S_RESOURCEQUOTA_RESOURCE_NAME: Final = "k8s.resourcequota.resource_name" +""" +The name of the K8s resource a resource quota defines. +Note: The value for this attribute can be either the full `count/[.]` string (e.g., count/deployments.apps, count/pods), or, for certain core Kubernetes resources, just the resource name (e.g., pods, services, configmaps). Both forms are supported by Kubernetes for object count quotas. See [Kubernetes Resource Quotas documentation](https://kubernetes.io/docs/concepts/policy/resource-quotas/#object-count-quota) for more details. +""" + K8S_RESOURCEQUOTA_UID: Final = "k8s.resourcequota.uid" """ The UID of the resource quota. @@ -313,14 +431,24 @@ K8S_STATEFULSET_ANNOTATION_TEMPLATE: Final = "k8s.statefulset.annotation" """ -The annotation key-value pairs placed on the StatefulSet. -Note: The `` being the annotation name, the value being the annotation value, even if the value is empty. +The annotation placed on the StatefulSet, the `` being the annotation name, the value being the annotation value, even if the value is empty. +Note: Examples: + +- A label `replicas` with value `1` SHOULD be recorded + as the `k8s.statefulset.annotation.replicas` attribute with value `"1"`. +- A label `data` with empty string value SHOULD be recorded as + the `k8s.statefulset.annotation.data` attribute with value `""`. """ K8S_STATEFULSET_LABEL_TEMPLATE: Final = "k8s.statefulset.label" """ -The label key-value pairs placed on the StatefulSet. -Note: The `` being the label name, the value being the label value, even if the value is empty. +The label placed on the StatefulSet, the `` being the label name, the value being the label value, even if the value is empty. +Note: Examples: + +- A label `replicas` with value `0` SHOULD be recorded + as the `k8s.statefulset.label.app` attribute with value `"guestbook"`. +- A label `injected` with empty string value SHOULD be recorded as + the `k8s.statefulset.label.injected` attribute with value `""`. """ K8S_STATEFULSET_NAME: Final = "k8s.statefulset.name" @@ -333,6 +461,11 @@ The UID of the StatefulSet. """ +K8S_STORAGECLASS_NAME: Final = "k8s.storageclass.name" +""" +The name of K8s [StorageClass](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#storageclass-v1-storage-k8s-io) object. +""" + K8S_VOLUME_NAME: Final = "k8s.volume.name" """ The name of the K8s volume. @@ -344,6 +477,36 @@ """ +class K8sContainerStatusReasonValues(Enum): + CONTAINER_CREATING = "ContainerCreating" + """The container is being created.""" + CRASH_LOOP_BACK_OFF = "CrashLoopBackOff" + """The container is in a crash loop back off state.""" + CREATE_CONTAINER_CONFIG_ERROR = "CreateContainerConfigError" + """There was an error creating the container configuration.""" + ERR_IMAGE_PULL = "ErrImagePull" + """There was an error pulling the container image.""" + IMAGE_PULL_BACK_OFF = "ImagePullBackOff" + """The container image pull is in back off state.""" + OOM_KILLED = "OOMKilled" + """The container was killed due to out of memory.""" + COMPLETED = "Completed" + """The container has completed execution.""" + ERROR = "Error" + """There was an error with the container.""" + CONTAINER_CANNOT_RUN = "ContainerCannotRun" + """The container cannot run.""" + + +class K8sContainerStatusStateValues(Enum): + TERMINATED = "terminated" + """The container has terminated.""" + RUNNING = "running" + """The container is running.""" + WAITING = "waiting" + """The container is waiting.""" + + 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).""" @@ -351,6 +514,28 @@ class K8sNamespacePhaseValues(Enum): """Terminating namespace phase as described by [K8s API](https://pkg.go.dev/k8s.io/api@v0.31.3/core/v1#NamespacePhase).""" +class K8sNodeConditionStatusValues(Enum): + CONDITION_TRUE = "true" + """condition_true.""" + CONDITION_FALSE = "false" + """condition_false.""" + CONDITION_UNKNOWN = "unknown" + """condition_unknown.""" + + +class K8sNodeConditionTypeValues(Enum): + READY = "Ready" + """The node is healthy and ready to accept pods.""" + DISK_PRESSURE = "DiskPressure" + """Pressure exists on the disk size—that is, if the disk capacity is low.""" + MEMORY_PRESSURE = "MemoryPressure" + """Pressure exists on the node memory—that is, if the node memory is low.""" + PID_PRESSURE = "PIDPressure" + """Pressure exists on the processes—that is, if there are too many processes on the node.""" + NETWORK_UNAVAILABLE = "NetworkUnavailable" + """The network for the node is not correctly configured.""" + + class K8sVolumeTypeValues(Enum): PERSISTENT_VOLUME_CLAIM = "persistentVolumeClaim" """A [persistentVolumeClaim](https://v1-30.docs.kubernetes.io/docs/concepts/storage/volumes/#persistentvolumeclaim) volume.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/mainframe_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/mainframe_attributes.py new file mode 100644 index 00000000000..96df4803c10 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/mainframe_attributes.py @@ -0,0 +1,20 @@ +# 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 + +MAINFRAME_LPAR_NAME: Final = "mainframe.lpar.name" +""" +Name of the logical partition that hosts a systems with a mainframe operating system. +""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py index 0e899fe2123..cebfe19eab3 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/os_attributes.py @@ -63,4 +63,6 @@ class OsTypeValues(Enum): SOLARIS = "solaris" """SunOS, Oracle Solaris.""" Z_OS = "z_os" + """Deprecated: Replaced by `zos`.""" + ZOS = "zos" """IBM z/OS.""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py index eebacacb998..7f580842d78 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/otel_attributes.py @@ -62,6 +62,11 @@ Deprecated in favor of stable :py:const:`opentelemetry.semconv.attributes.otel_attributes.OTEL_SCOPE_VERSION`. """ +OTEL_SPAN_PARENT_ORIGIN: Final = "otel.span.parent.origin" +""" +Determines whether the span has a parent span, and if so, [whether it is a remote parent](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote). +""" + OTEL_SPAN_SAMPLING_RESULT: Final = "otel.span.sampling_result" """ The result value of the sampler for this span. @@ -93,6 +98,8 @@ class OtelComponentTypeValues(Enum): """OTLP span exporter over HTTP with protobuf serialization.""" OTLP_HTTP_JSON_SPAN_EXPORTER = "otlp_http_json_span_exporter" """OTLP span exporter over HTTP with JSON serialization.""" + ZIPKIN_HTTP_SPAN_EXPORTER = "zipkin_http_span_exporter" + """Zipkin span exporter over HTTP.""" OTLP_GRPC_LOG_EXPORTER = "otlp_grpc_log_exporter" """OTLP log record exporter over gRPC with protobuf serialization.""" OTLP_HTTP_LOG_EXPORTER = "otlp_http_log_exporter" @@ -107,6 +114,19 @@ class OtelComponentTypeValues(Enum): """OTLP metric exporter over HTTP with protobuf serialization.""" OTLP_HTTP_JSON_METRIC_EXPORTER = "otlp_http_json_metric_exporter" """OTLP metric exporter over HTTP with JSON serialization.""" + PROMETHEUS_HTTP_TEXT_METRIC_EXPORTER = ( + "prometheus_http_text_metric_exporter" + ) + """Prometheus metric exporter over HTTP with the default text-based format.""" + + +class OtelSpanParentOriginValues(Enum): + NONE = "none" + """The span does not have a parent, it is a root span.""" + LOCAL = "local" + """The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is false.""" + REMOTE = "remote" + """The span has a parent and the parent's span context [isRemote()](https://opentelemetry.io/docs/specs/otel/trace/api/#isremote) is true.""" class OtelSpanSamplingResultValues(Enum): 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 2391cbffb37..4472bba7a0f 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 @@ -55,7 +55,7 @@ PROCESS_ENVIRONMENT_VARIABLE_TEMPLATE: Final = "process.environment_variable" """ -Process environment variables, being the environment variable name, the value being the environment variable value. +Process environment variables, `` being the environment variable name, the value being the environment variable value. Note: Examples: - an environment variable `USER` with value `"ubuntu"` SHOULD be recorded diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/zos_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/zos_attributes.py new file mode 100644 index 00000000000..195177f0256 --- /dev/null +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/zos_attributes.py @@ -0,0 +1,25 @@ +# 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 + +ZOS_SMF_ID: Final = "zos.smf.id" +""" +The System Management Facility (SMF) Identifier uniquely identified a z/OS system within a SYSPLEX or mainframe environment and is used for system and performance analysis. +""" + +ZOS_SYSPLEX_NAME: Final = "zos.sysplex.name" +""" +The name of the SYSPLEX to which the z/OS system belongs too. +""" diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cpu_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cpu_metrics.py index 86bc5a678cd..9d388c84b0c 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cpu_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/cpu_metrics.py @@ -39,56 +39,50 @@ CPU_FREQUENCY: Final = "cpu.frequency" """ -Operating frequency of the logical CPU in Hertz -Instrument: gauge -Unit: Hz +Deprecated: Replaced by `system.cpu.frequency`. """ def create_cpu_frequency( meter: Meter, callbacks: Optional[Sequence[CallbackT]] ) -> ObservableGauge: - """Operating frequency of the logical CPU in Hertz""" + """Deprecated. Use `system.cpu.frequency` instead""" return meter.create_observable_gauge( name=CPU_FREQUENCY, callbacks=callbacks, - description="Operating frequency of the logical CPU in Hertz.", - unit="Hz", + description="Deprecated. Use `system.cpu.frequency` instead.", + unit="{Hz}", ) CPU_TIME: Final = "cpu.time" """ -Seconds each logical CPU spent on each mode -Instrument: counter -Unit: s +Deprecated: Replaced by `system.cpu.time`. """ def create_cpu_time(meter: Meter) -> Counter: - """Seconds each logical CPU spent on each mode""" + """Deprecated. Use `system.cpu.time` instead""" return meter.create_counter( name=CPU_TIME, - description="Seconds each logical CPU spent on each mode", + description="Deprecated. Use `system.cpu.time` instead.", unit="s", ) CPU_UTILIZATION: Final = "cpu.utilization" """ -For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time -Instrument: gauge -Unit: 1 +Deprecated: Replaced by `system.cpu.utilization`. """ def create_cpu_utilization( meter: Meter, callbacks: Optional[Sequence[CallbackT]] ) -> ObservableGauge: - """For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time""" + """Deprecated. Use `system.cpu.utilization` instead""" return meter.create_observable_gauge( name=CPU_UTILIZATION, callbacks=callbacks, - description="For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time.", + description="Deprecated. Use `system.cpu.utilization` instead.", unit="1", ) 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 760d4d55c7c..e88ea8254d0 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 @@ -38,6 +38,237 @@ Generator[Iterable[Observation], CallbackOptions, None], ] +K8S_CONTAINER_CPU_LIMIT: Final = "k8s.container.cpu.limit" +""" +Maximum CPU resource limit set for the container +Instrument: updowncounter +Unit: {cpu} +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_cpu_limit(meter: Meter) -> UpDownCounter: + """Maximum CPU resource limit set for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_CPU_LIMIT, + description="Maximum CPU resource limit set for the container", + unit="{cpu}", + ) + + +K8S_CONTAINER_CPU_REQUEST: Final = "k8s.container.cpu.request" +""" +CPU resource requested for the container +Instrument: updowncounter +Unit: {cpu} +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_cpu_request(meter: Meter) -> UpDownCounter: + """CPU resource requested for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_CPU_REQUEST, + description="CPU resource requested for the container", + unit="{cpu}", + ) + + +K8S_CONTAINER_EPHEMERAL_STORAGE_LIMIT: Final = ( + "k8s.container.ephemeral_storage.limit" +) +""" +Maximum ephemeral storage resource limit set for the container +Instrument: updowncounter +Unit: By +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_ephemeral_storage_limit( + meter: Meter, +) -> UpDownCounter: + """Maximum ephemeral storage resource limit set for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_EPHEMERAL_STORAGE_LIMIT, + description="Maximum ephemeral storage resource limit set for the container", + unit="By", + ) + + +K8S_CONTAINER_EPHEMERAL_STORAGE_REQUEST: Final = ( + "k8s.container.ephemeral_storage.request" +) +""" +Ephemeral storage resource requested for the container +Instrument: updowncounter +Unit: By +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_ephemeral_storage_request( + meter: Meter, +) -> UpDownCounter: + """Ephemeral storage resource requested for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_EPHEMERAL_STORAGE_REQUEST, + description="Ephemeral storage resource requested for the container", + unit="By", + ) + + +K8S_CONTAINER_MEMORY_LIMIT: Final = "k8s.container.memory.limit" +""" +Maximum memory resource limit set for the container +Instrument: updowncounter +Unit: By +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_memory_limit(meter: Meter) -> UpDownCounter: + """Maximum memory resource limit set for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_MEMORY_LIMIT, + description="Maximum memory resource limit set for the container", + unit="By", + ) + + +K8S_CONTAINER_MEMORY_REQUEST: Final = "k8s.container.memory.request" +""" +Memory resource requested for the container +Instrument: updowncounter +Unit: By +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_memory_request(meter: Meter) -> UpDownCounter: + """Memory resource requested for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_MEMORY_REQUEST, + description="Memory resource requested for the container", + unit="By", + ) + + +K8S_CONTAINER_READY: Final = "k8s.container.ready" +""" +Indicates whether the container is currently marked as ready to accept traffic, based on its readiness probe (1 = ready, 0 = not ready) +Instrument: updowncounter +Unit: {container} +Note: This metric SHOULD reflect the value of the `ready` field in the +[K8s ContainerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#containerstatus-v1-core). +""" + + +def create_k8s_container_ready(meter: Meter) -> UpDownCounter: + """Indicates whether the container is currently marked as ready to accept traffic, based on its readiness probe (1 = ready, 0 = not ready)""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_READY, + description="Indicates whether the container is currently marked as ready to accept traffic, based on its readiness probe (1 = ready, 0 = not ready)", + unit="{container}", + ) + + +K8S_CONTAINER_RESTART_COUNT: Final = "k8s.container.restart.count" +""" +Describes how many times the container has restarted (since the last counter reset) +Instrument: updowncounter +Unit: {restart} +Note: This value is pulled directly from the K8s API and the value can go indefinitely high and be reset to 0 +at any time depending on how your kubelet is configured to prune dead containers. +It is best to not depend too much on the exact value but rather look at it as +either == 0, in which case you can conclude there were no restarts in the recent past, or > 0, in which case +you can conclude there were restarts in the recent past, and not try and analyze the value beyond that. +""" + + +def create_k8s_container_restart_count(meter: Meter) -> UpDownCounter: + """Describes how many times the container has restarted (since the last counter reset)""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_RESTART_COUNT, + description="Describes how many times the container has restarted (since the last counter reset)", + unit="{restart}", + ) + + +K8S_CONTAINER_STATUS_REASON: Final = "k8s.container.status.reason" +""" +Describes the number of K8s containers that are currently in a state for a given reason +Instrument: updowncounter +Unit: {container} +Note: All possible container state reasons will be reported at each time interval to avoid missing metrics. +Only the value corresponding to the current state reason will be non-zero. +""" + + +def create_k8s_container_status_reason(meter: Meter) -> UpDownCounter: + """Describes the number of K8s containers that are currently in a state for a given reason""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_STATUS_REASON, + description="Describes the number of K8s containers that are currently in a state for a given reason", + unit="{container}", + ) + + +K8S_CONTAINER_STATUS_STATE: Final = "k8s.container.status.state" +""" +Describes the number of K8s containers that are currently in a given state +Instrument: updowncounter +Unit: {container} +Note: All possible container states will be reported at each time interval to avoid missing metrics. +Only the value corresponding to the current state will be non-zero. +""" + + +def create_k8s_container_status_state(meter: Meter) -> UpDownCounter: + """Describes the number of K8s containers that are currently in a given state""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_STATUS_STATE, + description="Describes the number of K8s containers that are currently in a given state", + unit="{container}", + ) + + +K8S_CONTAINER_STORAGE_LIMIT: Final = "k8s.container.storage.limit" +""" +Maximum storage resource limit set for the container +Instrument: updowncounter +Unit: By +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_storage_limit(meter: Meter) -> UpDownCounter: + """Maximum storage resource limit set for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_STORAGE_LIMIT, + description="Maximum storage resource limit set for the container", + unit="By", + ) + + +K8S_CONTAINER_STORAGE_REQUEST: Final = "k8s.container.storage.request" +""" +Storage resource requested for the container +Instrument: updowncounter +Unit: By +Note: See https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#resourcerequirements-v1-core for details. +""" + + +def create_k8s_container_storage_request(meter: Meter) -> UpDownCounter: + """Storage resource requested for the container""" + return meter.create_up_down_counter( + name=K8S_CONTAINER_STORAGE_REQUEST, + description="Storage resource requested for the container", + unit="By", + ) + + K8S_CRONJOB_ACTIVE_JOBS: Final = "k8s.cronjob.active_jobs" """ The number of actively running jobs for a cronjob @@ -45,9 +276,6 @@ 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. """ @@ -69,9 +297,6 @@ def create_k8s_cronjob_active_jobs(meter: Meter) -> 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. """ @@ -95,9 +320,6 @@ def create_k8s_daemonset_current_scheduled_nodes( 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. """ @@ -119,9 +341,6 @@ def create_k8s_daemonset_desired_scheduled_nodes( 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. """ @@ -141,9 +360,6 @@ def create_k8s_daemonset_misscheduled_nodes(meter: Meter) -> 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. """ @@ -163,9 +379,6 @@ def create_k8s_daemonset_ready_nodes(meter: Meter) -> 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. """ @@ -185,9 +398,6 @@ def create_k8s_deployment_available_pods(meter: Meter) -> 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. """ @@ -206,10 +416,7 @@ def create_k8s_deployment_desired_pods(meter: Meter) -> UpDownCounter: 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) - -This metric SHOULD, at a minimum, be reported against a -[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource. +[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling). """ @@ -228,10 +435,7 @@ def create_k8s_hpa_current_pods(meter: Meter) -> UpDownCounter: 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) - -This metric SHOULD, at a minimum, be reported against a -[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource. +[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling). """ @@ -250,10 +454,7 @@ def create_k8s_hpa_desired_pods(meter: Meter) -> UpDownCounter: 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) - -This metric SHOULD, at a minimum, be reported against a -[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource. +[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling). """ @@ -266,16 +467,89 @@ def create_k8s_hpa_max_pods(meter: Meter) -> UpDownCounter: ) +K8S_HPA_METRIC_TARGET_CPU_AVERAGE_UTILIZATION: Final = ( + "k8s.hpa.metric.target.cpu.average_utilization" +) +""" +Target average utilization, in percentage, for CPU resource in HPA config +Instrument: gauge +Unit: 1 +Note: This metric aligns with the `averageUtilization` field of the +[K8s HPA MetricTarget](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling). +If the type of the metric is [`ContainerResource`](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis), +the `k8s.container.name` attribute MUST be set to identify the specific container within the pod to which the metric applies. +""" + + +def create_k8s_hpa_metric_target_cpu_average_utilization( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Target average utilization, in percentage, for CPU resource in HPA config""" + return meter.create_observable_gauge( + name=K8S_HPA_METRIC_TARGET_CPU_AVERAGE_UTILIZATION, + callbacks=callbacks, + description="Target average utilization, in percentage, for CPU resource in HPA config.", + unit="1", + ) + + +K8S_HPA_METRIC_TARGET_CPU_AVERAGE_VALUE: Final = ( + "k8s.hpa.metric.target.cpu.average_value" +) +""" +Target average value for CPU resource in HPA config +Instrument: gauge +Unit: {cpu} +Note: This metric aligns with the `averageValue` field of the +[K8s HPA MetricTarget](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling). +If the type of the metric is [`ContainerResource`](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis), +the `k8s.container.name` attribute MUST be set to identify the specific container within the pod to which the metric applies. +""" + + +def create_k8s_hpa_metric_target_cpu_average_value( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Target average value for CPU resource in HPA config""" + return meter.create_observable_gauge( + name=K8S_HPA_METRIC_TARGET_CPU_AVERAGE_VALUE, + callbacks=callbacks, + description="Target average value for CPU resource in HPA config.", + unit="{cpu}", + ) + + +K8S_HPA_METRIC_TARGET_CPU_VALUE: Final = "k8s.hpa.metric.target.cpu.value" +""" +Target value for CPU resource in HPA config +Instrument: gauge +Unit: {cpu} +Note: This metric aligns with the `value` field of the +[K8s HPA MetricTarget](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#metrictarget-v2-autoscaling). +If the type of the metric is [`ContainerResource`](https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/#support-for-metrics-apis), +the `k8s.container.name` attribute MUST be set to identify the specific container within the pod to which the metric applies. +""" + + +def create_k8s_hpa_metric_target_cpu_value( + meter: Meter, callbacks: Optional[Sequence[CallbackT]] +) -> ObservableGauge: + """Target value for CPU resource in HPA config""" + return meter.create_observable_gauge( + name=K8S_HPA_METRIC_TARGET_CPU_VALUE, + callbacks=callbacks, + description="Target value for CPU resource in HPA config.", + unit="{cpu}", + ) + + 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) - -This metric SHOULD, at a minimum, be reported against a -[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource. +[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling). """ @@ -295,9 +569,6 @@ def create_k8s_hpa_min_pods(meter: Meter) -> 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. """ @@ -317,9 +588,6 @@ def create_k8s_job_active_pods(meter: Meter) -> 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. """ @@ -339,9 +607,6 @@ def create_k8s_job_desired_successful_pods(meter: Meter) -> 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. """ @@ -361,9 +626,6 @@ def create_k8s_job_failed_pods(meter: Meter) -> 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. """ @@ -383,9 +645,6 @@ def create_k8s_job_max_parallel_pods(meter: Meter) -> 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. """ @@ -403,8 +662,6 @@ def create_k8s_job_successful_pods(meter: Meter) -> UpDownCounter: 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. """ @@ -417,6 +674,96 @@ def create_k8s_namespace_phase(meter: Meter) -> UpDownCounter: ) +K8S_NODE_ALLOCATABLE_CPU: Final = "k8s.node.allocatable.cpu" +""" +Amount of cpu allocatable on the node +Instrument: updowncounter +Unit: {cpu} +""" + + +def create_k8s_node_allocatable_cpu(meter: Meter) -> UpDownCounter: + """Amount of cpu allocatable on the node""" + return meter.create_up_down_counter( + name=K8S_NODE_ALLOCATABLE_CPU, + description="Amount of cpu allocatable on the node", + unit="{cpu}", + ) + + +K8S_NODE_ALLOCATABLE_EPHEMERAL_STORAGE: Final = ( + "k8s.node.allocatable.ephemeral_storage" +) +""" +Amount of ephemeral-storage allocatable on the node +Instrument: updowncounter +Unit: By +""" + + +def create_k8s_node_allocatable_ephemeral_storage( + meter: Meter, +) -> UpDownCounter: + """Amount of ephemeral-storage allocatable on the node""" + return meter.create_up_down_counter( + name=K8S_NODE_ALLOCATABLE_EPHEMERAL_STORAGE, + description="Amount of ephemeral-storage allocatable on the node", + unit="By", + ) + + +K8S_NODE_ALLOCATABLE_MEMORY: Final = "k8s.node.allocatable.memory" +""" +Amount of memory allocatable on the node +Instrument: updowncounter +Unit: By +""" + + +def create_k8s_node_allocatable_memory(meter: Meter) -> UpDownCounter: + """Amount of memory allocatable on the node""" + return meter.create_up_down_counter( + name=K8S_NODE_ALLOCATABLE_MEMORY, + description="Amount of memory allocatable on the node", + unit="By", + ) + + +K8S_NODE_ALLOCATABLE_PODS: Final = "k8s.node.allocatable.pods" +""" +Amount of pods allocatable on the node +Instrument: updowncounter +Unit: {pod} +""" + + +def create_k8s_node_allocatable_pods(meter: Meter) -> UpDownCounter: + """Amount of pods allocatable on the node""" + return meter.create_up_down_counter( + name=K8S_NODE_ALLOCATABLE_PODS, + description="Amount of pods allocatable on the node", + unit="{pod}", + ) + + +K8S_NODE_CONDITION_STATUS: Final = "k8s.node.condition.status" +""" +Describes the condition of a particular Node +Instrument: updowncounter +Unit: {node} +Note: All possible node condition pairs (type and status) will be reported at each time interval to avoid missing metrics. Condition pairs corresponding to the current conditions' statuses will be non-zero. +""" + + +def create_k8s_node_condition_status(meter: Meter) -> UpDownCounter: + """Describes the condition of a particular Node""" + return meter.create_up_down_counter( + name=K8S_NODE_CONDITION_STATUS, + description="Describes the condition of a particular Node.", + unit="{node}", + ) + + K8S_NODE_CPU_TIME: Final = "k8s.node.cpu.time" """ Total CPU time consumed @@ -656,9 +1003,6 @@ def create_k8s_pod_uptime( 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. """ @@ -678,9 +1022,6 @@ def create_k8s_replicaset_available_pods(meter: Meter) -> 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. """ @@ -739,10 +1080,7 @@ def create_k8s_replication_controller_desired_pods( 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) - -This metric SHOULD, at a minimum, be reported against a -[`k8s.replicationcontroller`](../resource/k8s.md#replicationcontroller) resource. +[K8s ReplicationControllerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core). """ @@ -765,10 +1103,7 @@ def create_k8s_replicationcontroller_available_pods( 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) - -This metric SHOULD, at a minimum, be reported against a -[`k8s.replicationcontroller`](../resource/k8s.md#replicationcontroller) resource. +[K8s ReplicationControllerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core). """ @@ -783,6 +1118,498 @@ def create_k8s_replicationcontroller_desired_pods( ) +K8S_RESOURCEQUOTA_CPU_LIMIT_HARD: Final = "k8s.resourcequota.cpu.limit.hard" +""" +The CPU limits in a specific namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: {cpu} +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_cpu_limit_hard(meter: Meter) -> UpDownCounter: + """The CPU limits in a specific namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_CPU_LIMIT_HARD, + description="The CPU limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="{cpu}", + ) + + +K8S_RESOURCEQUOTA_CPU_LIMIT_USED: Final = "k8s.resourcequota.cpu.limit.used" +""" +The CPU limits in a specific namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: {cpu} +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_cpu_limit_used(meter: Meter) -> UpDownCounter: + """The CPU limits in a specific namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_CPU_LIMIT_USED, + description="The CPU limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="{cpu}", + ) + + +K8S_RESOURCEQUOTA_CPU_REQUEST_HARD: Final = ( + "k8s.resourcequota.cpu.request.hard" +) +""" +The CPU requests in a specific namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: {cpu} +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_cpu_request_hard(meter: Meter) -> UpDownCounter: + """The CPU requests in a specific namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_CPU_REQUEST_HARD, + description="The CPU requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="{cpu}", + ) + + +K8S_RESOURCEQUOTA_CPU_REQUEST_USED: Final = ( + "k8s.resourcequota.cpu.request.used" +) +""" +The CPU requests in a specific namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: {cpu} +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_cpu_request_used(meter: Meter) -> UpDownCounter: + """The CPU requests in a specific namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_CPU_REQUEST_USED, + description="The CPU requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="{cpu}", + ) + + +K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_LIMIT_HARD: Final = ( + "k8s.resourcequota.ephemeral_storage.limit.hard" +) +""" +The sum of local ephemeral storage limits in the namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_ephemeral_storage_limit_hard( + meter: Meter, +) -> UpDownCounter: + """The sum of local ephemeral storage limits in the namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_LIMIT_HARD, + description="The sum of local ephemeral storage limits in the namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_LIMIT_USED: Final = ( + "k8s.resourcequota.ephemeral_storage.limit.used" +) +""" +The sum of local ephemeral storage limits in the namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_ephemeral_storage_limit_used( + meter: Meter, +) -> UpDownCounter: + """The sum of local ephemeral storage limits in the namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_LIMIT_USED, + description="The sum of local ephemeral storage limits in the namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_REQUEST_HARD: Final = ( + "k8s.resourcequota.ephemeral_storage.request.hard" +) +""" +The sum of local ephemeral storage requests in the namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_ephemeral_storage_request_hard( + meter: Meter, +) -> UpDownCounter: + """The sum of local ephemeral storage requests in the namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_REQUEST_HARD, + description="The sum of local ephemeral storage requests in the namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_REQUEST_USED: Final = ( + "k8s.resourcequota.ephemeral_storage.request.used" +) +""" +The sum of local ephemeral storage requests in the namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_ephemeral_storage_request_used( + meter: Meter, +) -> UpDownCounter: + """The sum of local ephemeral storage requests in the namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_EPHEMERAL_STORAGE_REQUEST_USED, + description="The sum of local ephemeral storage requests in the namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_HUGEPAGE_COUNT_REQUEST_HARD: Final = ( + "k8s.resourcequota.hugepage_count.request.hard" +) +""" +The huge page requests in a specific namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: {hugepage} +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_hugepage_count_request_hard( + meter: Meter, +) -> UpDownCounter: + """The huge page requests in a specific namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_HUGEPAGE_COUNT_REQUEST_HARD, + description="The huge page requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="{hugepage}", + ) + + +K8S_RESOURCEQUOTA_HUGEPAGE_COUNT_REQUEST_USED: Final = ( + "k8s.resourcequota.hugepage_count.request.used" +) +""" +The huge page requests in a specific namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: {hugepage} +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_hugepage_count_request_used( + meter: Meter, +) -> UpDownCounter: + """The huge page requests in a specific namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_HUGEPAGE_COUNT_REQUEST_USED, + description="The huge page requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="{hugepage}", + ) + + +K8S_RESOURCEQUOTA_MEMORY_LIMIT_HARD: Final = ( + "k8s.resourcequota.memory.limit.hard" +) +""" +The memory limits in a specific namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_memory_limit_hard(meter: Meter) -> UpDownCounter: + """The memory limits in a specific namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_MEMORY_LIMIT_HARD, + description="The memory limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_MEMORY_LIMIT_USED: Final = ( + "k8s.resourcequota.memory.limit.used" +) +""" +The memory limits in a specific namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_memory_limit_used(meter: Meter) -> UpDownCounter: + """The memory limits in a specific namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_MEMORY_LIMIT_USED, + description="The memory limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_MEMORY_REQUEST_HARD: Final = ( + "k8s.resourcequota.memory.request.hard" +) +""" +The memory requests in a specific namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_memory_request_hard( + meter: Meter, +) -> UpDownCounter: + """The memory requests in a specific namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_MEMORY_REQUEST_HARD, + description="The memory requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_MEMORY_REQUEST_USED: Final = ( + "k8s.resourcequota.memory.request.used" +) +""" +The memory requests in a specific namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_memory_request_used( + meter: Meter, +) -> UpDownCounter: + """The memory requests in a specific namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_MEMORY_REQUEST_USED, + description="The memory requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_OBJECT_COUNT_HARD: Final = ( + "k8s.resourcequota.object_count.hard" +) +""" +The object count limits in a specific namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: {object} +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_object_count_hard(meter: Meter) -> UpDownCounter: + """The object count limits in a specific namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_OBJECT_COUNT_HARD, + description="The object count limits in a specific namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="{object}", + ) + + +K8S_RESOURCEQUOTA_OBJECT_COUNT_USED: Final = ( + "k8s.resourcequota.object_count.used" +) +""" +The object count limits in a specific namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: {object} +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). +""" + + +def create_k8s_resourcequota_object_count_used(meter: Meter) -> UpDownCounter: + """The object count limits in a specific namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_OBJECT_COUNT_USED, + description="The object count limits in a specific namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="{object}", + ) + + +K8S_RESOURCEQUOTA_PERSISTENTVOLUMECLAIM_COUNT_HARD: Final = ( + "k8s.resourcequota.persistentvolumeclaim_count.hard" +) +""" +The total number of PersistentVolumeClaims that can exist in the namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: {persistentvolumeclaim} +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). + +The `k8s.storageclass.name` should be required when a resource quota is defined for a specific +storage class. +""" + + +def create_k8s_resourcequota_persistentvolumeclaim_count_hard( + meter: Meter, +) -> UpDownCounter: + """The total number of PersistentVolumeClaims that can exist in the namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_PERSISTENTVOLUMECLAIM_COUNT_HARD, + description="The total number of PersistentVolumeClaims that can exist in the namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="{persistentvolumeclaim}", + ) + + +K8S_RESOURCEQUOTA_PERSISTENTVOLUMECLAIM_COUNT_USED: Final = ( + "k8s.resourcequota.persistentvolumeclaim_count.used" +) +""" +The total number of PersistentVolumeClaims that can exist in the namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: {persistentvolumeclaim} +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). + +The `k8s.storageclass.name` should be required when a resource quota is defined for a specific +storage class. +""" + + +def create_k8s_resourcequota_persistentvolumeclaim_count_used( + meter: Meter, +) -> UpDownCounter: + """The total number of PersistentVolumeClaims that can exist in the namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_PERSISTENTVOLUMECLAIM_COUNT_USED, + description="The total number of PersistentVolumeClaims that can exist in the namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="{persistentvolumeclaim}", + ) + + +K8S_RESOURCEQUOTA_STORAGE_REQUEST_HARD: Final = ( + "k8s.resourcequota.storage.request.hard" +) +""" +The storage requests in a specific namespace. +The value represents the configured quota limit of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `hard` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). + +The `k8s.storageclass.name` should be required when a resource quota is defined for a specific +storage class. +""" + + +def create_k8s_resourcequota_storage_request_hard( + meter: Meter, +) -> UpDownCounter: + """The storage requests in a specific namespace. + The value represents the configured quota limit of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_STORAGE_REQUEST_HARD, + description="The storage requests in a specific namespace. The value represents the configured quota limit of the resource in the namespace.", + unit="By", + ) + + +K8S_RESOURCEQUOTA_STORAGE_REQUEST_USED: Final = ( + "k8s.resourcequota.storage.request.used" +) +""" +The storage requests in a specific namespace. +The value represents the current observed total usage of the resource in the namespace +Instrument: updowncounter +Unit: By +Note: This metric is retrieved from the `used` field of the +[K8s ResourceQuotaStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#resourcequotastatus-v1-core). + +The `k8s.storageclass.name` should be required when a resource quota is defined for a specific +storage class. +""" + + +def create_k8s_resourcequota_storage_request_used( + meter: Meter, +) -> UpDownCounter: + """The storage requests in a specific namespace. + The value represents the current observed total usage of the resource in the namespace""" + return meter.create_up_down_counter( + name=K8S_RESOURCEQUOTA_STORAGE_REQUEST_USED, + description="The storage requests in a specific namespace. The value represents the current observed total usage of the resource in the namespace.", + unit="By", + ) + + 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 @@ -790,9 +1617,6 @@ def create_k8s_replicationcontroller_desired_pods( 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. """ @@ -812,9 +1636,6 @@ def create_k8s_statefulset_current_pods(meter: Meter) -> 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. """ @@ -834,9 +1655,6 @@ def create_k8s_statefulset_desired_pods(meter: Meter) -> 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. """ @@ -856,9 +1674,6 @@ def create_k8s_statefulset_ready_pods(meter: Meter) -> 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. """ diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/otel_metrics.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/otel_metrics.py index 045f63b32e0..8290065b8a9 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/otel_metrics.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/metrics/otel_metrics.py @@ -381,53 +381,47 @@ def create_otel_sdk_processor_span_queue_size(meter: Meter) -> UpDownCounter: OTEL_SDK_SPAN_ENDED: Final = "otel.sdk.span.ended" """ -The number of created spans for which the end operation was called -Instrument: counter -Unit: {span} -Note: For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`. -For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.live`. +Deprecated: Obsoleted. """ def create_otel_sdk_span_ended(meter: Meter) -> Counter: - """The number of created spans for which the end operation was called""" + """Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value""" return meter.create_counter( name=OTEL_SDK_SPAN_ENDED, - description="The number of created spans for which the end operation was called", + description="Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value.", unit="{span}", ) OTEL_SDK_SPAN_ENDED_COUNT: Final = "otel.sdk.span.ended.count" """ -Deprecated: Replaced by `otel.sdk.span.ended`. +Deprecated: Obsoleted. """ def create_otel_sdk_span_ended_count(meter: Meter) -> Counter: - """Deprecated, use `otel.sdk.span.ended` instead""" + """Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value""" return meter.create_counter( name=OTEL_SDK_SPAN_ENDED_COUNT, - description="Deprecated, use `otel.sdk.span.ended` instead.", + description="Use `otel.sdk.span.started` minus `otel.sdk.span.live` to derive this value.", unit="{span}", ) OTEL_SDK_SPAN_LIVE: Final = "otel.sdk.span.live" """ -The number of created spans for which the end operation has not been called yet +The number of created spans with `recording=true` for which the end operation has not been called yet Instrument: updowncounter Unit: {span} -Note: For spans with `recording=true`: Implementations MUST record both `otel.sdk.span.live` and `otel.sdk.span.ended`. -For spans with `recording=false`: If implementations decide to record this metric, they MUST also record `otel.sdk.span.ended`. """ def create_otel_sdk_span_live(meter: Meter) -> UpDownCounter: - """The number of created spans for which the end operation has not been called yet""" + """The number of created spans with `recording=true` for which the end operation has not been called yet""" return meter.create_up_down_counter( name=OTEL_SDK_SPAN_LIVE, - description="The number of created spans for which the end operation has not been called yet", + description="The number of created spans with `recording=true` for which the end operation has not been called yet", unit="{span}", ) @@ -445,3 +439,21 @@ def create_otel_sdk_span_live_count(meter: Meter) -> UpDownCounter: description="Deprecated, use `otel.sdk.span.live` instead.", unit="{span}", ) + + +OTEL_SDK_SPAN_STARTED: Final = "otel.sdk.span.started" +""" +The number of created spans +Instrument: counter +Unit: {span} +Note: Implementations MUST record this metric for all spans, even for non-recording ones. +""" + + +def create_otel_sdk_span_started(meter: Meter) -> Counter: + """The number of created spans""" + return meter.create_counter( + name=OTEL_SDK_SPAN_STARTED, + description="The number of created spans", + unit="{span}", + ) 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 df2a6571801..e0ec178a7b7 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 @@ -40,19 +40,21 @@ SYSTEM_CPU_FREQUENCY: Final = "system.cpu.frequency" """ -Deprecated: Replaced by `cpu.frequency`. +Operating frequency of the logical CPU in Hertz +Instrument: gauge +Unit: Hz """ def create_system_cpu_frequency( meter: Meter, callbacks: Optional[Sequence[CallbackT]] ) -> ObservableGauge: - """Deprecated. Use `cpu.frequency` instead""" + """Operating frequency of the logical CPU in Hertz""" return meter.create_observable_gauge( name=SYSTEM_CPU_FREQUENCY, callbacks=callbacks, - description="Deprecated. Use `cpu.frequency` instead.", - unit="{Hz}", + description="Operating frequency of the logical CPU in Hertz.", + unit="Hz", ) @@ -94,33 +96,37 @@ def create_system_cpu_physical_count(meter: Meter) -> UpDownCounter: SYSTEM_CPU_TIME: Final = "system.cpu.time" """ -Deprecated: Replaced by `cpu.time`. +Seconds each logical CPU spent on each mode +Instrument: counter +Unit: s """ def create_system_cpu_time(meter: Meter) -> Counter: - """Deprecated. Use `cpu.time` instead""" + """Seconds each logical CPU spent on each mode""" return meter.create_counter( name=SYSTEM_CPU_TIME, - description="Deprecated. Use `cpu.time` instead.", + description="Seconds each logical CPU spent on each mode", unit="s", ) SYSTEM_CPU_UTILIZATION: Final = "system.cpu.utilization" """ -Deprecated: Replaced by `cpu.utilization`. +For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time +Instrument: gauge +Unit: 1 """ def create_system_cpu_utilization( meter: Meter, callbacks: Optional[Sequence[CallbackT]] ) -> ObservableGauge: - """Deprecated. Use `cpu.utilization` instead""" + """For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time""" return meter.create_observable_gauge( name=SYSTEM_CPU_UTILIZATION, callbacks=callbacks, - description="Deprecated. Use `cpu.utilization` instead.", + description="For each logical CPU, the utilization is calculated as the change in cumulative CPU time (cpu.time) over a measurement interval, divided by the elapsed time.", unit="1", ) @@ -401,17 +407,32 @@ def create_system_memory_utilization( ) -SYSTEM_NETWORK_CONNECTIONS: Final = "system.network.connections" +SYSTEM_NETWORK_CONNECTION_COUNT: Final = "system.network.connection.count" """ Instrument: updowncounter Unit: {connection} """ +def create_system_network_connection_count(meter: Meter) -> UpDownCounter: + return meter.create_up_down_counter( + name=SYSTEM_NETWORK_CONNECTION_COUNT, + description="", + unit="{connection}", + ) + + +SYSTEM_NETWORK_CONNECTIONS: Final = "system.network.connections" +""" +Deprecated: Replaced by `system.network.connection.count`. +""" + + def create_system_network_connections(meter: Meter) -> UpDownCounter: + """Deprecated, use `system.network.connection.count` instead""" return meter.create_up_down_counter( name=SYSTEM_NETWORK_CONNECTIONS, - description="", + description="Deprecated, use `system.network.connection.count` instead", unit="{connection}", ) diff --git a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/db_attributes.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/db_attributes.py index 3ebee2ed230..2edf3468169 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/db_attributes.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/attributes/db_attributes.py @@ -109,85 +109,11 @@ 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/schemas.py b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py index 373bd143f27..59d25ae6b05 100644 --- a/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py +++ b/opentelemetry-semantic-conventions/src/opentelemetry/semconv/schemas.py @@ -70,5 +70,10 @@ class Schemas(Enum): """ The URL of the OpenTelemetry schema version 1.34.0. """ + V1_36_0 = "https://opentelemetry.io/schemas/1.36.0" + """ + The URL of the OpenTelemetry schema version 1.36.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 323c0474b65..0fdaa6f81b1 100755 --- a/scripts/semconv/generate.sh +++ b/scripts/semconv/generate.sh @@ -5,9 +5,9 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" ROOT_DIR="${SCRIPT_DIR}/../.." # freeze the spec version to make SemanticAttributes generation reproducible -SEMCONV_VERSION=1.34.0 +SEMCONV_VERSION=1.36.0 SEMCONV_VERSION_TAG=v$SEMCONV_VERSION -OTEL_WEAVER_IMG_VERSION=v0.15.0 +OTEL_WEAVER_IMG_VERSION=v0.16.1 INCUBATING_DIR=_incubating cd ${SCRIPT_DIR} diff --git a/scripts/semconv/templates/registry/semantic_metrics.j2 b/scripts/semconv/templates/registry/semantic_metrics.j2 index e720125651d..0724f33d8cb 100644 --- a/scripts/semconv/templates/registry/semantic_metrics.j2 +++ b/scripts/semconv/templates/registry/semantic_metrics.j2 @@ -88,7 +88,7 @@ def create_{{ metric_name }}(meter: Meter) -> {{metric.instrument | map_text("py {%- if metric.instrument == "gauge" %} callbacks=callbacks, {%- endif %} - description="{{ c.str_or_empty(metric.brief|trim) }}", + description="{{ c.str_or_empty(metric.brief|trim)|replace('\n', ' ')}}", unit="{{ metric.unit }}", ) {%- endif -%} diff --git a/tox.ini b/tox.ini index c33e0d89567..997436f7d03 100644 --- a/tox.ini +++ b/tox.ini @@ -175,7 +175,7 @@ commands = lint-opentelemetry-proto-gen: pylint {toxinidir}/opentelemetry-proto test-opentelemetry-semantic-conventions: pytest {toxinidir}/opentelemetry-semantic-conventions/tests {posargs} - lint-opentelemetry-semantic-conventions: pylint {toxinidir}/opentelemetry-semantic-conventions + lint-opentelemetry-semantic-conventions: pylint --rcfile {toxinidir}/opentelemetry-semantic-conventions/.pylintrc {toxinidir}/opentelemetry-semantic-conventions test-opentelemetry-getting-started: pytest {toxinidir}/docs/getting_started/tests {posargs} lint-opentelemetry-getting-started: pylint {toxinidir}/docs/getting_started