Skip to content

Commit

Permalink
Add k8s.container.restart_count Resource attribute (#1945)
Browse files Browse the repository at this point in the history
This change adds a Resource attribute to represent number of container restarts in kubernetes. This is can be used in k8s logs collection to identify a particular container instance, where the number of container restarts is a part of a log file path.

Co-authored-by: Tigran Najaryan <4194920+tigrannajaryan@users.noreply.github.com>
  • Loading branch information
dmitryax and tigrannajaryan authored Oct 6, 2021
1 parent c68128e commit 8ebafd7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ release.
([#1890](https://github.com/open-telemetry/opentelemetry-specification/pull/1890))
- Add HTTP request and response headers semantic conventions.
([#1898](https://github.com/open-telemetry/opentelemetry-specification/pull/1898))
- Add `k8s.container.restart_count` Resource attribute.
([#1945](https://github.com/open-telemetry/opentelemetry-specification/pull/1945))

### Compatibility

Expand Down
7 changes: 7 additions & 0 deletions semantic_conventions/resource/k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ groups:
brief: >
The name of the Container in a Pod template.
examples: ['redis']
- id: restart_count
type: int
brief: >
Number of times the container was restarted. This attribute can be
used to identify a particular container (running or stopped) within a
container spec.
examples: [0, 2]

- id: k8s.replicaset
prefix: k8s.replicaset
Expand Down
1 change: 1 addition & 0 deletions specification/resource/semantic_conventions/k8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ to a running container.
| Attribute | Type | Description | Examples | Required |
|---|---|---|---|---|
| `k8s.container.name` | string | The name of the Container in a Pod template. | `redis` | No |
| `k8s.container.restart_count` | int | Number of times the container was restarted. This attribute can be used to identify a particular container (running or stopped) within a container spec. | `0`; `2` | No |
<!-- endsemconv -->

## ReplicaSet
Expand Down

0 comments on commit 8ebafd7

Please sign in to comment.