Skip to content

Commit b865f63

Browse files
ChrsMarklmolkova
andauthored
Add hpa, resource_quota, replication_controller k8s attributes (open-telemetry#1742)
Signed-off-by: ChrsMark <[email protected]> Co-authored-by: Liudmila Molkova <[email protected]>
1 parent 7639732 commit b865f63

File tree

7 files changed

+215
-0
lines changed

7 files changed

+215
-0
lines changed

.chloggen/add_k8s_resources.yaml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type: enhancement
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component: k8s
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Add `k8s.hpa`, `k8s.resourcequota` and `k8s.replicationcontroller` attributes and resources
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
# The values here must be integers.
17+
issues: [1656]
18+
19+
# (Optional) One or more lines of additional information to render under the primary note.
20+
# These lines will be padded with 2 spaces and then inserted directly into the document.
21+
# Use pipe (|) for multiline entries.
22+
subtext:

docs/attributes-registry/k8s.md

+6
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Kubernetes resource attributes.
2323
| <a id="k8s-daemonset-uid" href="#k8s-daemonset-uid">`k8s.daemonset.uid`</a> | string | The UID of the DaemonSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2424
| <a id="k8s-deployment-name" href="#k8s-deployment-name">`k8s.deployment.name`</a> | string | The name of the Deployment. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2525
| <a id="k8s-deployment-uid" href="#k8s-deployment-uid">`k8s.deployment.uid`</a> | string | The UID of the Deployment. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
26+
| <a id="k8s-hpa-name" href="#k8s-hpa-name">`k8s.hpa.name`</a> | string | The name of the horizontal pod autoscaler. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
27+
| <a id="k8s-hpa-uid" href="#k8s-hpa-uid">`k8s.hpa.uid`</a> | string | The UID of the horizontal pod autoscaler. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2628
| <a id="k8s-job-name" href="#k8s-job-name">`k8s.job.name`</a> | string | The name of the Job. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2729
| <a id="k8s-job-uid" href="#k8s-job-uid">`k8s.job.uid`</a> | string | The UID of the Job. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
2830
| <a id="k8s-namespace-name" href="#k8s-namespace-name">`k8s.namespace.name`</a> | string | The name of the namespace that the pod is running in. | `default` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
@@ -35,6 +37,10 @@ Kubernetes resource attributes.
3537
| <a id="k8s-pod-uid" href="#k8s-pod-uid">`k8s.pod.uid`</a> | string | The UID of the Pod. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3638
| <a id="k8s-replicaset-name" href="#k8s-replicaset-name">`k8s.replicaset.name`</a> | string | The name of the ReplicaSet. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3739
| <a id="k8s-replicaset-uid" href="#k8s-replicaset-uid">`k8s.replicaset.uid`</a> | string | The UID of the ReplicaSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
40+
| <a id="k8s-replicationcontroller-name" href="#k8s-replicationcontroller-name">`k8s.replicationcontroller.name`</a> | string | The name of the replication controller. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
41+
| <a id="k8s-replicationcontroller-uid" href="#k8s-replicationcontroller-uid">`k8s.replicationcontroller.uid`</a> | string | The UID of the replication controller. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
42+
| <a id="k8s-resourcequota-name" href="#k8s-resourcequota-name">`k8s.resourcequota.name`</a> | string | The name of the resource quota. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
43+
| <a id="k8s-resourcequota-uid" href="#k8s-resourcequota-uid">`k8s.resourcequota.uid`</a> | string | The UID of the resource quota. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3844
| <a id="k8s-statefulset-name" href="#k8s-statefulset-name">`k8s.statefulset.name`</a> | string | The name of the StatefulSet. | `opentelemetry` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
3945
| <a id="k8s-statefulset-uid" href="#k8s-statefulset-uid">`k8s.statefulset.uid`</a> | string | The UID of the StatefulSet. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
4046
| <a id="k8s-volume-name" href="#k8s-volume-name">`k8s.volume.name`</a> | string | The name of the K8s volume. | `volume0` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |

docs/resource/k8s.md

+85
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,89 @@ A CronJob creates Jobs on a repeating schedule.
353353
<!-- END AUTOGENERATED TEXT -->
354354
<!-- endsemconv -->
355355

356+
## ReplicationController
357+
358+
A ReplicationController ensures that a specified number of pod replicas are running at any one time.
359+
360+
<!-- semconv resource.k8s.replicationcontroller -->
361+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
362+
<!-- see templates/registry/markdown/snippet.md.j2 -->
363+
<!-- prettier-ignore-start -->
364+
<!-- markdownlint-capture -->
365+
<!-- markdownlint-disable -->
366+
367+
368+
**Status:** ![Experimental](https://img.shields.io/badge/-experimental-blue)
369+
370+
**type:** `k8s.replicationcontroller`
371+
372+
**Description:** A Kubernetes ReplicationController object.
373+
374+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
375+
|---|---|---|---|---|---|
376+
| [`k8s.replicationcontroller.name`](/docs/attributes-registry/k8s.md) | string | The name of the replication controller. | `opentelemetry` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
377+
| [`k8s.replicationcontroller.uid`](/docs/attributes-registry/k8s.md) | string | The UID of the replication controller. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
378+
379+
<!-- markdownlint-restore -->
380+
<!-- prettier-ignore-end -->
381+
<!-- END AUTOGENERATED TEXT -->
382+
<!-- endsemconv -->
383+
384+
## HorizontalPodAutoscaler
385+
386+
A HorizontalPodAutoscaler (HPA for short) automatically updates a workload resource
387+
(such as a Deployment or StatefulSet), with the aim of automatically scaling the workload to match demand.
388+
389+
<!-- semconv resource.k8s.hpa -->
390+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
391+
<!-- see templates/registry/markdown/snippet.md.j2 -->
392+
<!-- prettier-ignore-start -->
393+
<!-- markdownlint-capture -->
394+
<!-- markdownlint-disable -->
395+
396+
397+
**Status:** ![Experimental](https://img.shields.io/badge/-experimental-blue)
398+
399+
**type:** `k8s.hpa`
400+
401+
**Description:** A Kubernetes HorizontalPodAutoscaler object.
402+
403+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
404+
|---|---|---|---|---|---|
405+
| [`k8s.hpa.name`](/docs/attributes-registry/k8s.md) | string | The name of the horizontal pod autoscaler. | `opentelemetry` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
406+
| [`k8s.hpa.uid`](/docs/attributes-registry/k8s.md) | string | The UID of the horizontal pod autoscaler. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
407+
408+
<!-- markdownlint-restore -->
409+
<!-- prettier-ignore-end -->
410+
<!-- END AUTOGENERATED TEXT -->
411+
<!-- endsemconv -->
412+
413+
## ResourceQuota
414+
415+
A ResourceQuota provides constraints that limit aggregate resource consumption per namespace.
416+
417+
<!-- semconv resource.k8s.resourcequota -->
418+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
419+
<!-- see templates/registry/markdown/snippet.md.j2 -->
420+
<!-- prettier-ignore-start -->
421+
<!-- markdownlint-capture -->
422+
<!-- markdownlint-disable -->
423+
424+
425+
**Status:** ![Experimental](https://img.shields.io/badge/-experimental-blue)
426+
427+
**type:** `k8s.resourcequota`
428+
429+
**Description:** A Kubernetes ResourceQuota object.
430+
431+
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
432+
|---|---|---|---|---|---|
433+
| [`k8s.resourcequota.name`](/docs/attributes-registry/k8s.md) | string | The name of the resource quota. | `opentelemetry` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
434+
| [`k8s.resourcequota.uid`](/docs/attributes-registry/k8s.md) | string | The UID of the resource quota. | `275ecb36-5aa8-4c2a-9c47-d8bb681b9aff` | `Recommended` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
435+
436+
<!-- markdownlint-restore -->
437+
<!-- prettier-ignore-end -->
438+
<!-- END AUTOGENERATED TEXT -->
439+
<!-- endsemconv -->
440+
356441
[DocumentStatus]: https://opentelemetry.io/docs/specs/otel/document-status

docs/system/k8s-metrics.md

+18
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,9 @@ This metric is [recommended][MetricRecommended].
524524
**[1]:** This metric aligns with the `replicas` field of the
525525
[K8s ReplicationControllerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core)
526526

527+
This metric SHOULD, at a minimum, be reported against a
528+
[`k8s.replicationcontroller`](../resource/k8s.md#replicationcontroller) resource.
529+
527530
<!-- markdownlint-restore -->
528531
<!-- prettier-ignore-end -->
529532
<!-- END AUTOGENERATED TEXT -->
@@ -547,6 +550,9 @@ This metric is [recommended][MetricRecommended].
547550
**[1]:** This metric aligns with the `availableReplicas` field of the
548551
[K8s ReplicationControllerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core)
549552

553+
This metric SHOULD, at a minimum, be reported against a
554+
[`k8s.replicationcontroller`](../resource/k8s.md#replicationcontroller) resource.
555+
550556
<!-- markdownlint-restore -->
551557
<!-- prettier-ignore-end -->
552558
<!-- END AUTOGENERATED TEXT -->
@@ -682,6 +688,9 @@ This metric is [recommended][MetricRecommended].
682688
**[1]:** This metric aligns with the `desiredReplicas` field of the
683689
[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling)
684690

691+
This metric SHOULD, at a minimum, be reported against a
692+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
693+
685694
<!-- markdownlint-restore -->
686695
<!-- prettier-ignore-end -->
687696
<!-- END AUTOGENERATED TEXT -->
@@ -705,6 +714,9 @@ This metric is [recommended][MetricRecommended].
705714
**[1]:** This metric aligns with the `currentReplicas` field of the
706715
[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling)
707716

717+
This metric SHOULD, at a minimum, be reported against a
718+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
719+
708720
<!-- markdownlint-restore -->
709721
<!-- prettier-ignore-end -->
710722
<!-- END AUTOGENERATED TEXT -->
@@ -728,6 +740,9 @@ This metric is [recommended][MetricRecommended].
728740
**[1]:** This metric aligns with the `maxReplicas` field of the
729741
[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling)
730742

743+
This metric SHOULD, at a minimum, be reported against a
744+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
745+
731746
<!-- markdownlint-restore -->
732747
<!-- prettier-ignore-end -->
733748
<!-- END AUTOGENERATED TEXT -->
@@ -751,6 +766,9 @@ This metric is [recommended][MetricRecommended].
751766
**[1]:** This metric aligns with the `minReplicas` field of the
752767
[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling)
753768

769+
This metric SHOULD, at a minimum, be reported against a
770+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
771+
754772
<!-- markdownlint-restore -->
755773
<!-- prettier-ignore-end -->
756774
<!-- END AUTOGENERATED TEXT -->

model/k8s/metrics.yaml

+18
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ groups:
193193
note: |
194194
This metric aligns with the `replicas` field of the
195195
[K8s ReplicationControllerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerspec-v1-core)
196+
197+
This metric SHOULD, at a minimum, be reported against a
198+
[`k8s.replicationcontroller`](../resource/k8s.md#replicationcontroller) resource.
196199
instrument: updowncounter
197200
unit: "{pod}"
198201
- id: metric.k8s.replication_controller.available_pods
@@ -204,6 +207,9 @@ groups:
204207
note: |
205208
This metric aligns with the `availableReplicas` field of the
206209
[K8s ReplicationControllerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#replicationcontrollerstatus-v1-core)
210+
211+
This metric SHOULD, at a minimum, be reported against a
212+
[`k8s.replicationcontroller`](../resource/k8s.md#replicationcontroller) resource.
207213
instrument: updowncounter
208214
unit: "{pod}"
209215

@@ -271,6 +277,9 @@ groups:
271277
note: |
272278
This metric aligns with the `desiredReplicas` field of the
273279
[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling)
280+
281+
This metric SHOULD, at a minimum, be reported against a
282+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
274283
instrument: updowncounter
275284
unit: "{pod}"
276285
- id: metric.k8s.hpa.current_pods
@@ -282,6 +291,9 @@ groups:
282291
note: |
283292
This metric aligns with the `currentReplicas` field of the
284293
[K8s HorizontalPodAutoscalerStatus](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerstatus-v2-autoscaling)
294+
295+
This metric SHOULD, at a minimum, be reported against a
296+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
285297
instrument: updowncounter
286298
unit: "{pod}"
287299
- id: metric.k8s.hpa.max_pods
@@ -293,6 +305,9 @@ groups:
293305
note: |
294306
This metric aligns with the `maxReplicas` field of the
295307
[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling)
308+
309+
This metric SHOULD, at a minimum, be reported against a
310+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
296311
instrument: updowncounter
297312
unit: "{pod}"
298313
- id: metric.k8s.hpa.min_pods
@@ -304,6 +319,9 @@ groups:
304319
note: |
305320
This metric aligns with the `minReplicas` field of the
306321
[K8s HorizontalPodAutoscalerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.30/#horizontalpodautoscalerspec-v2-autoscaling)
322+
323+
This metric SHOULD, at a minimum, be reported against a
324+
[`k8s.hpa`](../resource/k8s.md#horizontalpodautoscaler) resource.
307325
instrument: updowncounter
308326
unit: "{pod}"
309327

model/k8s/registry.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,30 @@ groups:
117117
brief: >
118118
The name of the ReplicaSet.
119119
examples: ['opentelemetry']
120+
- id: k8s.replicationcontroller.uid
121+
type: string
122+
stability: experimental
123+
brief: >
124+
The UID of the replication controller.
125+
examples: [ '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' ]
126+
- id: k8s.replicationcontroller.name
127+
type: string
128+
stability: experimental
129+
brief: >
130+
The name of the replication controller.
131+
examples: [ 'opentelemetry' ]
132+
- id: k8s.resourcequota.uid
133+
type: string
134+
stability: experimental
135+
brief: >
136+
The UID of the resource quota.
137+
examples: [ '275ecb36-5aa8-4c2a-9c47-d8bb681b9aff' ]
138+
- id: k8s.resourcequota.name
139+
type: string
140+
stability: experimental
141+
brief: >
142+
The name of the resource quota.
143+
examples: [ 'opentelemetry' ]
120144
- id: k8s.deployment.uid
121145
type: string
122146
stability: experimental
@@ -153,6 +177,18 @@ groups:
153177
brief: >
154178
The name of the DaemonSet.
155179
examples: ['opentelemetry']
180+
- id: k8s.hpa.uid
181+
type: string
182+
stability: experimental
183+
brief: >
184+
The UID of the horizontal pod autoscaler.
185+
examples: ['275ecb36-5aa8-4c2a-9c47-d8bb681b9aff']
186+
- id: k8s.hpa.name
187+
type: string
188+
stability: experimental
189+
brief: >
190+
The name of the horizontal pod autoscaler.
191+
examples: ['opentelemetry']
156192
- id: k8s.job.uid
157193
type: string
158194
stability: experimental

model/k8s/resources.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,33 @@ groups:
111111
attributes:
112112
- ref: k8s.cronjob.uid
113113
- ref: k8s.cronjob.name
114+
115+
- id: resource.k8s.replicationcontroller
116+
type: resource
117+
stability: experimental
118+
name: k8s.replicationcontroller
119+
brief: >
120+
A Kubernetes ReplicationController object.
121+
attributes:
122+
- ref: k8s.replicationcontroller.uid
123+
- ref: k8s.replicationcontroller.name
124+
125+
- id: resource.k8s.hpa
126+
type: resource
127+
stability: experimental
128+
name: k8s.hpa
129+
brief: >
130+
A Kubernetes HorizontalPodAutoscaler object.
131+
attributes:
132+
- ref: k8s.hpa.uid
133+
- ref: k8s.hpa.name
134+
135+
- id: resource.k8s.resourcequota
136+
type: resource
137+
stability: experimental
138+
name: k8s.resourcequota
139+
brief: >
140+
A Kubernetes ResourceQuota object.
141+
attributes:
142+
- ref: k8s.resourcequota.uid
143+
- ref: k8s.resourcequota.name

0 commit comments

Comments
 (0)