diff --git a/.chloggen/add_k8s_uptime_metrics.yaml b/.chloggen/add_k8s_uptime_metrics.yaml new file mode 100755 index 0000000000..b0507f1d2b --- /dev/null +++ b/.chloggen/add_k8s_uptime_metrics.yaml @@ -0,0 +1,22 @@ +# Use this changelog template to create an entry for release notes. +# +# If your change doesn't affect end users you should instead start +# your pull request title with [chore] or use the "Skip Changelog" label. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db) +component: k8s + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Add uptime metrics for container, K8s Pod and K8s Node + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +# The values here must be integers. +issues: [1486] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/docs/system/container-metrics.md b/docs/system/container-metrics.md index 8d7faa892c..11f046c837 100644 --- a/docs/system/container-metrics.md +++ b/docs/system/container-metrics.md @@ -12,6 +12,29 @@ This document describes instruments and attributes for common container level metrics in OpenTelemetry. These metrics are collected from technology-specific, well-defined APIs (e.g. Kubelet's API or container runtimes). +### Metric: `container.uptime` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `container.uptime` | Gauge | `s` | The time the container has been running [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available. +The actual accuracy would depend on the instrumentation and operating system. + + + + + + ### Metric: `container.cpu.time` This metric is [opt-in][MetricOptIn]. @@ -198,3 +221,4 @@ This metric is [opt-in][MetricOptIn]. [DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status [MetricOptIn]: /docs/general/metric-requirement-level.md#opt-in +[MetricRecommended]: /docs/general/metric-requirement-level.md#recommended diff --git a/docs/system/k8s-metrics.md b/docs/system/k8s-metrics.md index a94eac4050..9187ddf2db 100644 --- a/docs/system/k8s-metrics.md +++ b/docs/system/k8s-metrics.md @@ -15,6 +15,29 @@ well-defined APIs (e.g. Kubelet's API). Metrics in `k8s.` instruments SHOULD be attached to a [K8s Resource](/docs/resource/k8s.md) and therefore inherit its attributes, like `k8s.pod.name` and `k8s.pod.uid`. +### Metric: `k8s.pod.uptime` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.pod.uptime` | Gauge | `s` | The time the Pod has been running [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available. +The actual accuracy would depend on the instrumentation and operating system. + + + + + + ### Metric: `k8s.pod.cpu.time` This metric is [recommended][MetricRecommended]. @@ -149,6 +172,29 @@ This metric is [recommended][MetricRecommended]. +### Metric: `k8s.node.uptime` + +This metric is [recommended][MetricRecommended]. + + + + + + + + +| Name | Instrument Type | Unit (UCUM) | Description | Stability | +| -------- | --------------- | ----------- | -------------- | --------- | +| `k8s.node.uptime` | Gauge | `s` | The time the Node has been running [1] | ![Experimental](https://img.shields.io/badge/-experimental-blue) | + +**[1]:** Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available. +The actual accuracy would depend on the instrumentation and operating system. + + + + + + ### Metric: `k8s.node.cpu.time` This metric is [recommended][MetricRecommended]. diff --git a/model/container/metrics.yaml b/model/container/metrics.yaml index d59d6845fd..a1af10deff 100644 --- a/model/container/metrics.yaml +++ b/model/container/metrics.yaml @@ -1,4 +1,15 @@ groups: + # container.* metrics + - id: metric.container.uptime + type: metric + metric_name: container.uptime + stability: experimental + brief: "The time the container has been running" + note: | + Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available. + The actual accuracy would depend on the instrumentation and operating system. + instrument: gauge + unit: "s" # container.cpu.* metrics and attribute group - id: metric.container.cpu.time type: metric diff --git a/model/k8s/metrics.yaml b/model/k8s/metrics.yaml index 2e59cef71e..7afd7ec20d 100644 --- a/model/k8s/metrics.yaml +++ b/model/k8s/metrics.yaml @@ -1,4 +1,15 @@ groups: + # k8s.pod.* metrics + - id: metric.k8s.pod.uptime + type: metric + metric_name: k8s.pod.uptime + stability: experimental + brief: "The time the Pod has been running" + note: | + Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available. + The actual accuracy would depend on the instrumentation and operating system. + instrument: gauge + unit: "s" # k8s.pod.cpu.* metrics - id: metric.k8s.pod.cpu.time type: metric @@ -52,6 +63,17 @@ groups: - ref: network.interface.name - ref: network.io.direction + # k8s.node.* metrics + - id: metric.k8s.node.uptime + type: metric + metric_name: k8s.node.uptime + stability: experimental + brief: "The time the Node has been running" + note: | + Instrumentations SHOULD use a gauge with type `double` and measure uptime in seconds as a floating point number with the highest precision available. + The actual accuracy would depend on the instrumentation and operating system. + instrument: gauge + unit: "s" # k8s.node.cpu.* metrics - id: metric.k8s.node.cpu.time type: metric