[k8s] add k8s.persistentvolume and k8s.persistentvolumeclaim entities & metrics#3376
Merged
trask merged 6 commits intoopen-telemetry:mainfrom Apr 13, 2026
Merged
Conversation
0f00880 to
ab57f7c
Compare
jinja2
commented
Feb 2, 2026
jinja2
commented
Feb 3, 2026
dmitryax
reviewed
Feb 6, 2026
af1c841 to
906eaaa
Compare
dmitryax
reviewed
Feb 17, 2026
906eaaa to
597ea3a
Compare
dmitryax
approved these changes
Feb 24, 2026
dashpole
reviewed
Feb 25, 2026
dashpole
reviewed
Feb 25, 2026
dashpole
reviewed
Feb 25, 2026
ChrsMark
reviewed
Feb 25, 2026
8aeb4ad to
bc8d7bc
Compare
|
This PR has been labeled as stale due to lack of activity. It will be automatically closed if there is no further activity over the next 7 days. |
bc8d7bc to
04db772
Compare
Contributor
Author
dashpole
approved these changes
Apr 1, 2026
Contributor
Author
|
@open-telemetry/specs-semconv-approvers this one is approved by the SIG, please take a look. Thank you! |
ChrsMark
approved these changes
Apr 7, 2026
kamphaus
approved these changes
Apr 11, 2026
Member
|
@open-telemetry/semconv-k8s-approvers is this good to be merged? thanks |
Contributor
|
yes, good to merge |
ChrsMark
pushed a commit
to open-telemetry/opentelemetry-collector-contrib
that referenced
this pull request
Apr 21, 2026
#### Description
Adds Kubernetes PersistentVolume (PV) and PersistentVolumeClaim (PVC)
support to the k8s_cluster receiver, including metrics, entity events,
and metadata.
**New metrics** (all disabled by default, `development` stability):
| Metric | Type | Unit | Description |
|--------|------|------|-------------|
| `k8s.persistentvolume.status.phase` | Sum (non-monotonic) |
`{persistentvolume}` | Current phase (1 for active, 0 for others).
Phases: Pending, Available, Bound, Released, Failed |
| `k8s.persistentvolume.storage.capacity` | Sum (non-monotonic) | `By` |
Storage capacity in bytes |
| `k8s.persistentvolumeclaim.status.phase` | Sum (non-monotonic) |
`{persistentvolumeclaim}` | Current phase (1 for active, 0 for others).
Phases: Pending, Bound, Lost |
| `k8s.persistentvolumeclaim.storage.request` | Sum (non-monotonic) |
`By` | Requested storage in bytes |
| `k8s.persistentvolumeclaim.storage.capacity` | Sum (non-monotonic) |
`By` | Provisioned capacity in bytes (only when bound) |
References for enums -
- **PV phase:**
[`PersistentVolumePhase`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumePhase)
- Pending, Available, Bound, Released, Failed (noticed that the
[concepts
doc](https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase)
omits Pending, but it is defined in the API)
- **PVC phase:**
[`PersistentVolumeClaimPhase`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumeClaimPhase)
- Pending, Bound, Lost
- **PV reclaim policy:**
[`PersistentVolumeReclaimPolicy`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumeReclaimPolicy)
- Delete, Recycle, Retain
**New entities** (`development` stability):
- `k8s.persistentvolume` - identity: `uid`, description: name,
storageclass, reclaim_policy
- `k8s.persistentvolumeclaim` - identity: `uid`, description: name,
extra: namespace, storageclass
**RBAC:** Requires `persistentvolumes` and `persistentvolumeclaims`
verbs `get`, `list`, `watch` in the collector's ClusterRole.
Semantic conventions:
open-telemetry/semantic-conventions#3376
Additional implementation details -
- Labels, annotations, and creation timestamp are emitted as entity
event attributes and via metadata, not as metric resource attributes -
following the existing pattern for other resource types. PVC entities
also include `k8s.persistentvolume.name` when bound.
- Informers are only activated when at least one metric is enabled or
metadata/entity exporters are configured.
- `storage.capacity` for PVC is only emitted when bound
(`Status.Capacity` is populated).
- `k8s.storageclass.name` is omitted when no StorageClass is set (e.g.,
manually provisioned static PVs or stuck/pending PVCs in clusters
without a default StorageClass).
- `Transform()` strips the
`kubectl.kubernetes.io/last-applied-configuration` annotation (contains
a full JSON copy of the manifest).
#### Link to tracking issue
Fixes
#47453
#### Testing
- **Unit tests:** Golden file tests for PV (default, optional attrs with
`reclaim_policy`, no-capacity) and PVC (default bound, pending).
`RecordMetrics` and `GetMetadata` coverage for all phases and edge
cases.
- **Watcher tests:** `TestObjMetadata` entries for PV and PVC.
`TestSyncMetadataAndEmitEntityEventsForPV` and
`TestSyncMetadataAndEmitEntityEventsForPVC` verify
entity_state/entity_delete lifecycle.
- **E2E metrics:** PV/PVC metrics validated in `TestE2EClusterScoped`
(cluster-wide: PV + PVC) and `TestE2ENamespaceScoped` (namespace-scoped:
PVC only) against golden files.
- **E2E entities:** `TestE2EPVCEntity` creates a PVC in Kind and
validates entity event log output against a golden file.
#### Documentation
- `documentation.md` updated automatically by mdatagen with new metrics,
resource attributes, and entity definitions.
- `README.md` updated with PV/PVC RBAC requirements.
AndrewCharlesHay
pushed a commit
to AndrewCharlesHay/opentelemetry-collector-contrib
that referenced
this pull request
Apr 23, 2026
…metry#47555) #### Description Adds Kubernetes PersistentVolume (PV) and PersistentVolumeClaim (PVC) support to the k8s_cluster receiver, including metrics, entity events, and metadata. **New metrics** (all disabled by default, `development` stability): | Metric | Type | Unit | Description | |--------|------|------|-------------| | `k8s.persistentvolume.status.phase` | Sum (non-monotonic) | `{persistentvolume}` | Current phase (1 for active, 0 for others). Phases: Pending, Available, Bound, Released, Failed | | `k8s.persistentvolume.storage.capacity` | Sum (non-monotonic) | `By` | Storage capacity in bytes | | `k8s.persistentvolumeclaim.status.phase` | Sum (non-monotonic) | `{persistentvolumeclaim}` | Current phase (1 for active, 0 for others). Phases: Pending, Bound, Lost | | `k8s.persistentvolumeclaim.storage.request` | Sum (non-monotonic) | `By` | Requested storage in bytes | | `k8s.persistentvolumeclaim.storage.capacity` | Sum (non-monotonic) | `By` | Provisioned capacity in bytes (only when bound) | References for enums - - **PV phase:** [`PersistentVolumePhase`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumePhase) - Pending, Available, Bound, Released, Failed (noticed that the [concepts doc](https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase) omits Pending, but it is defined in the API) - **PVC phase:** [`PersistentVolumeClaimPhase`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumeClaimPhase) - Pending, Bound, Lost - **PV reclaim policy:** [`PersistentVolumeReclaimPolicy`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumeReclaimPolicy) - Delete, Recycle, Retain **New entities** (`development` stability): - `k8s.persistentvolume` - identity: `uid`, description: name, storageclass, reclaim_policy - `k8s.persistentvolumeclaim` - identity: `uid`, description: name, extra: namespace, storageclass **RBAC:** Requires `persistentvolumes` and `persistentvolumeclaims` verbs `get`, `list`, `watch` in the collector's ClusterRole. Semantic conventions: open-telemetry/semantic-conventions#3376 Additional implementation details - - Labels, annotations, and creation timestamp are emitted as entity event attributes and via metadata, not as metric resource attributes - following the existing pattern for other resource types. PVC entities also include `k8s.persistentvolume.name` when bound. - Informers are only activated when at least one metric is enabled or metadata/entity exporters are configured. - `storage.capacity` for PVC is only emitted when bound (`Status.Capacity` is populated). - `k8s.storageclass.name` is omitted when no StorageClass is set (e.g., manually provisioned static PVs or stuck/pending PVCs in clusters without a default StorageClass). - `Transform()` strips the `kubectl.kubernetes.io/last-applied-configuration` annotation (contains a full JSON copy of the manifest). #### Link to tracking issue Fixes open-telemetry#47453 #### Testing - **Unit tests:** Golden file tests for PV (default, optional attrs with `reclaim_policy`, no-capacity) and PVC (default bound, pending). `RecordMetrics` and `GetMetadata` coverage for all phases and edge cases. - **Watcher tests:** `TestObjMetadata` entries for PV and PVC. `TestSyncMetadataAndEmitEntityEventsForPV` and `TestSyncMetadataAndEmitEntityEventsForPVC` verify entity_state/entity_delete lifecycle. - **E2E metrics:** PV/PVC metrics validated in `TestE2EClusterScoped` (cluster-wide: PV + PVC) and `TestE2ENamespaceScoped` (namespace-scoped: PVC only) against golden files. - **E2E entities:** `TestE2EPVCEntity` creates a PVC in Kind and validates entity event log output against a golden file. #### Documentation - `documentation.md` updated automatically by mdatagen with new metrics, resource attributes, and entity definitions. - `README.md` updated with PV/PVC RBAC requirements.
gracewehner
pushed a commit
to gracewehner/opentelemetry-collector-contrib
that referenced
this pull request
Apr 29, 2026
…metry#47555) #### Description Adds Kubernetes PersistentVolume (PV) and PersistentVolumeClaim (PVC) support to the k8s_cluster receiver, including metrics, entity events, and metadata. **New metrics** (all disabled by default, `development` stability): | Metric | Type | Unit | Description | |--------|------|------|-------------| | `k8s.persistentvolume.status.phase` | Sum (non-monotonic) | `{persistentvolume}` | Current phase (1 for active, 0 for others). Phases: Pending, Available, Bound, Released, Failed | | `k8s.persistentvolume.storage.capacity` | Sum (non-monotonic) | `By` | Storage capacity in bytes | | `k8s.persistentvolumeclaim.status.phase` | Sum (non-monotonic) | `{persistentvolumeclaim}` | Current phase (1 for active, 0 for others). Phases: Pending, Bound, Lost | | `k8s.persistentvolumeclaim.storage.request` | Sum (non-monotonic) | `By` | Requested storage in bytes | | `k8s.persistentvolumeclaim.storage.capacity` | Sum (non-monotonic) | `By` | Provisioned capacity in bytes (only when bound) | References for enums - - **PV phase:** [`PersistentVolumePhase`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumePhase) - Pending, Available, Bound, Released, Failed (noticed that the [concepts doc](https://kubernetes.io/docs/concepts/storage/persistent-volumes#phase) omits Pending, but it is defined in the API) - **PVC phase:** [`PersistentVolumeClaimPhase`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumeClaimPhase) - Pending, Bound, Lost - **PV reclaim policy:** [`PersistentVolumeReclaimPolicy`](https://pkg.go.dev/k8s.io/[email protected]/core/v1#PersistentVolumeReclaimPolicy) - Delete, Recycle, Retain **New entities** (`development` stability): - `k8s.persistentvolume` - identity: `uid`, description: name, storageclass, reclaim_policy - `k8s.persistentvolumeclaim` - identity: `uid`, description: name, extra: namespace, storageclass **RBAC:** Requires `persistentvolumes` and `persistentvolumeclaims` verbs `get`, `list`, `watch` in the collector's ClusterRole. Semantic conventions: open-telemetry/semantic-conventions#3376 Additional implementation details - - Labels, annotations, and creation timestamp are emitted as entity event attributes and via metadata, not as metric resource attributes - following the existing pattern for other resource types. PVC entities also include `k8s.persistentvolume.name` when bound. - Informers are only activated when at least one metric is enabled or metadata/entity exporters are configured. - `storage.capacity` for PVC is only emitted when bound (`Status.Capacity` is populated). - `k8s.storageclass.name` is omitted when no StorageClass is set (e.g., manually provisioned static PVs or stuck/pending PVCs in clusters without a default StorageClass). - `Transform()` strips the `kubectl.kubernetes.io/last-applied-configuration` annotation (contains a full JSON copy of the manifest). #### Link to tracking issue Fixes open-telemetry#47453 #### Testing - **Unit tests:** Golden file tests for PV (default, optional attrs with `reclaim_policy`, no-capacity) and PVC (default bound, pending). `RecordMetrics` and `GetMetadata` coverage for all phases and edge cases. - **Watcher tests:** `TestObjMetadata` entries for PV and PVC. `TestSyncMetadataAndEmitEntityEventsForPV` and `TestSyncMetadataAndEmitEntityEventsForPVC` verify entity_state/entity_delete lifecycle. - **E2E metrics:** PV/PVC metrics validated in `TestE2EClusterScoped` (cluster-wide: PV + PVC) and `TestE2ENamespaceScoped` (namespace-scoped: PVC only) against golden files. - **E2E entities:** `TestE2EPVCEntity` creates a PVC in Kind and validates entity event log output against a golden file. #### Documentation - `documentation.md` updated automatically by mdatagen with new metrics, resource attributes, and entity definitions. - `README.md` updated with PV/PVC RBAC requirements.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3375
Changes
Adds semantic conventions for Kubernetes storage resources - PersistentVolumes (pv) and PersistentVolumeClaims (pvc).
More details available in linked issue.
Important
Pull requests acceptance are subject to the triage process as described in Issue and PR Triage Management.
PRs that do not follow the guidance above, may be automatically rejected and closed.
Merge requirement checklist
[chore]