Skip to content

Commit

Permalink
[k8sclusterreceiver] refactor k8s.container.restarts metric units (#2…
Browse files Browse the repository at this point in the history
…7051)

**Description:** 

Refactor k8s.container.restarts metric unit to be `{restart}`

**Link to tracking Issue:**
#10553
  • Loading branch information
povilasv committed Sep 22, 2023
1 parent ccfd8b1 commit 00739eb
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 17 deletions.
27 changes: 27 additions & 0 deletions .chloggen/refactor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: k8sclusterreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "change k8s.container.restarts unit from 1 to {restart}"

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [10553]

# (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:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
2 changes: 1 addition & 1 deletion receiver/k8sclusterreceiver/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ How many times the container has restarted in the recent past. This value is pul

| Unit | Metric Type | Value Type |
| ---- | ----------- | ---------- |
| 1 | Gauge | Int |
| {restart} | Gauge | Int |

### k8s.container.storage_limit

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ resourceMetrics:
dataPoints:
- asInt: "3"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand All @@ -86,4 +86,4 @@ resourceMetrics:
unit: "{cpu}"
scope:
name: otelcol/k8sclusterreceiver
version: latest
version: latest
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ resourceMetrics:
dataPoints:
- asInt: "3"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down
2 changes: 1 addition & 1 deletion receiver/k8sclusterreceiver/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ metrics:
k8s.container.restarts:
enabled: true
description: How many times the container has restarted in the recent past. 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.
unit: 1
unit: "{restart}"
gauge:
value_type: int
k8s.container.ready:
Expand Down
20 changes: 10 additions & 10 deletions receiver/k8sclusterreceiver/testdata/e2e/expected.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -844,7 +844,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -921,7 +921,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -977,7 +977,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -1033,7 +1033,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -1089,7 +1089,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -1138,7 +1138,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -1208,7 +1208,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -1285,7 +1285,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down Expand Up @@ -1334,7 +1334,7 @@ resourceMetrics:
- asInt: "0"
timeUnixNano: "1686772769034865545"
name: k8s.container.restarts
unit: "1"
unit: "{restart}"
- description: Whether a container has passed its readiness probe (0 for no, 1 for yes)
gauge:
dataPoints:
Expand Down

0 comments on commit 00739eb

Please sign in to comment.