Skip to content

Commit 695e516

Browse files
johnlesliebraydonkkamphauslmolkova
authored
Add support for filesystem locks and their metrics (#3612)
Co-authored-by: Braydon Kains <93549768+braydonk@users.noreply.github.com> Co-authored-by: Christophe Kamphaus <christophe.kamphaus@gmail.com> Co-authored-by: Liudmila Molkova <neskazu@gmail.com>
1 parent 06e5c78 commit 695e516

5 files changed

Lines changed: 129 additions & 0 deletions

File tree

.chloggen/filesystem-locks.yaml

Lines changed: 22 additions & 0 deletions
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: system, file
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note: Add support for filesystem lock counts
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: [3611]
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/registry/attributes/file.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
# File
55

6+
- [File Attributes](#file-attributes)
7+
- [File Lock Attributes](#file-lock-attributes)
8+
69
## File Attributes
710

811
Describes file attributes.
@@ -44,3 +47,24 @@ Describes file attributes.
4447
On NTFS, this is analogous to an Alternate Data Stream (ADS), and the default data stream for a file is just called $DATA. Zone.Identifier is commonly used by Windows to track contents downloaded from the Internet. An ADS is typically of the form: C:\path\to\filename.extension:some_fork_name, and some_fork_name is the value that should populate `fork_name`. `filename.extension` should populate `file.name`, and `extension` should populate `file.extension`. The full path, `file.path`, will include the fork name.
4548

4649
**[7] `file.symbolic_link.target_path`:** This attribute is only applicable to symbolic links.
50+
51+
## File Lock Attributes
52+
53+
These attributes may be used for any filesystem lock or related operation
54+
55+
**Attributes:**
56+
57+
| Key | Stability | Value Type | Description | Example Values |
58+
| --- | --- | --- | --- | --- |
59+
| <a id="file-lock-mechanism" href="#file-lock-mechanism">`file.lock.mechanism`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | The lock mechanism such as noted by [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html) | `POSIX`; `FLOCK`; `DELEG`; `LEASE` |
60+
| <a id="file-lock-mode" href="#file-lock-mode">`file.lock.mode`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | Mode of lock or operation such as documented by [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html) | `ADVISORY`; `MANDATORY`; `BREAKING`; `ACTIVE`; `BREAKER` |
61+
| <a id="file-lock-type" href="#file-lock-type">`file.lock.type`</a> | ![Development](https://img.shields.io/badge/-development-blue) | string | The lock type as represented by i.e. [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html)'s l_type. | `read` |
62+
63+
---
64+
65+
`file.lock.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
66+
67+
| Value | Description | Stability |
68+
| --- | --- | --- |
69+
| `read` | read | ![Development](https://img.shields.io/badge/-development-blue) |
70+
| `write` | write | ![Development](https://img.shields.io/badge/-development-blue) |

docs/system/system-metrics.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Resource attributes related to a host, SHOULD be reported under the `host.*` nam
4747
- [Metric: `system.filesystem.usage`](#metric-systemfilesystemusage)
4848
- [Metric: `system.filesystem.utilization`](#metric-systemfilesystemutilization)
4949
- [Metric: `system.filesystem.limit`](#metric-systemfilesystemlimit)
50+
- [Metric: `system.filesystem.lock.count`](#metric-systemfilesystemlockcount)
5051
- [Network metrics](#network-metrics)
5152
- [Metric: `system.network.packet.dropped`](#metric-systemnetworkpacketdropped)
5253
- [Metric: `system.network.packet.count`](#metric-systemnetworkpacketcount)
@@ -825,6 +826,39 @@ This metric is [opt-in][MetricOptIn].
825826
<!-- END AUTOGENERATED TEXT -->
826827
<!-- endsemconv -->
827828

829+
### Metric: `system.filesystem.lock.count`
830+
831+
<!-- semconv metric.system.filesystem.lock.count -->
832+
<!-- NOTE: THIS TEXT IS AUTOGENERATED. DO NOT EDIT BY HAND. -->
833+
<!-- see templates/registry/markdown/snippet.md.j2 -->
834+
<!-- prettier-ignore-start -->
835+
836+
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
837+
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
838+
| `system.filesystem.lock.count` | UpDownCounter | `{lock}` | Filesystem lock counts. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
839+
840+
**Attributes:**
841+
842+
| Key | Stability | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Value Type | Description | Example Values |
843+
| --- | --- | --- | --- | --- | --- |
844+
| [`file.lock.mechanism`](/docs/registry/attributes/file.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | The lock mechanism such as noted by [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html) | `POSIX`; `FLOCK`; `DELEG`; `LEASE` |
845+
| [`file.lock.mode`](/docs/registry/attributes/file.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | Mode of lock or operation such as documented by [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html) | `ADVISORY`; `MANDATORY`; `BREAKING`; `ACTIVE`; `BREAKER` |
846+
| [`file.lock.type`](/docs/registry/attributes/file.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | The lock type as represented by i.e. [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html)'s l_type. | `read` |
847+
| [`system.device`](/docs/registry/attributes/system.md) | ![Development](https://img.shields.io/badge/-development-blue) | `Recommended` | string | OS-specific identifier for the device where the file resides. | `08:01` |
848+
849+
---
850+
851+
`file.lock.type` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.
852+
853+
| Value | Description | Stability |
854+
| --- | --- | --- |
855+
| `read` | read | ![Development](https://img.shields.io/badge/-development-blue) |
856+
| `write` | write | ![Development](https://img.shields.io/badge/-development-blue) |
857+
858+
<!-- prettier-ignore-end -->
859+
<!-- END AUTOGENERATED TEXT -->
860+
<!-- endsemconv -->
861+
828862
## Network metrics
829863

830864
**Description:** System level network metrics captured under the namespace `system.network`.

model/file/registry.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,32 @@ groups:
137137
This attribute is only applicable to symbolic links.
138138
stability: development
139139
examples: ['/usr/bin/python3']
140+
- id: registry.file.lock
141+
type: attribute_group
142+
display_name: File Lock Attributes
143+
brief: >
144+
These attributes may be used for any filesystem lock or related operation
145+
attributes:
146+
- id: file.lock.type
147+
type:
148+
members:
149+
- id: read
150+
value: 'read'
151+
stability: development
152+
- id: write
153+
value: 'write'
154+
stability: development
155+
stability: development
156+
brief: "The lock type as represented by i.e. [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html)'s l_type."
157+
examples: ["read"]
158+
- id: file.lock.mechanism
159+
type: string
160+
brief: "The lock mechanism such as noted by [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html)"
161+
stability: development
162+
examples: ["POSIX", "FLOCK", "DELEG", "LEASE"]
163+
- id: file.lock.mode
164+
type: string
165+
brief: >
166+
Mode of lock or operation such as documented by [POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/functions/fcntl.html)
167+
stability: development
168+
examples: ["ADVISORY", "MANDATORY", "BREAKING", "ACTIVE", "BREAKER"]

model/system/metrics.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,26 @@ groups:
384384
entity_associations:
385385
- host
386386

387+
- id: metric.system.filesystem.lock.count
388+
type: metric
389+
metric_name: system.filesystem.lock.count
390+
annotations:
391+
code_generation:
392+
metric_value_type: int
393+
stability: development
394+
brief: "Filesystem lock counts."
395+
instrument: updowncounter
396+
unit: "{lock}"
397+
attributes:
398+
- ref: system.device
399+
brief: OS-specific identifier for the device where the file resides.
400+
examples: ["08:01"]
401+
- ref: file.lock.type
402+
- ref: file.lock.mechanism
403+
- ref: file.lock.mode
404+
entity_associations:
405+
- host
406+
387407
# system.network.* metrics
388408
- id: metric.system.network.packet.dropped
389409
type: metric

0 commit comments

Comments
 (0)