Skip to content

Commit c21e560

Browse files
authored
Add missing brief on ios.state attribute and add policies to require briefs (#2506)
1 parent 37eb9d4 commit c21e560

File tree

10 files changed

+113
-74
lines changed

10 files changed

+113
-74
lines changed

docs/registry/attributes/android.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ This document defines attributes that represents an occurrence of a lifecycle tr
3333

3434
| Attribute | Type | Description | Examples | Stability |
3535
|---|---|---|---|---|
36-
| <a id="android-state" href="#android-state">`android.state`</a> | string | Deprecated. Use `android.app.state` body field instead. | `created`; `background`; `foreground` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Use `android.app.state` body field instead. |
36+
| <a id="android-state" href="#android-state">`android.state`</a> | string | Deprecated. Use `android.app.state` attribute instead. | `created`; `background`; `foreground` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Use `android.app.state` attribute instead. |
3737

3838
---
3939

docs/registry/attributes/ios.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The iOS platform on which the iOS application is running.
3434

3535
| Attribute | Type | Description | Examples | Stability |
3636
|---|---|---|---|---|
37-
| <a id="ios-state" href="#ios-state">`ios.state`</a> | string | [2] | `active`; `inactive`; `background` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by the `ios.app.state` event body field. |
37+
| <a id="ios-state" href="#ios-state">`ios.state`</a> | string | Deprecated. Use the `ios.app.state` attribute. [2] | `active`; `inactive`; `background` | ![Deprecated](https://img.shields.io/badge/-deprecated-red)<br>Replaced by the `ios.app.state` attribute. |
3838

3939
**[2] `ios.state`:** The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate), and from which the `OS terminology` column values are derived.
4040

docs/system/system-metrics.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ This metric is [recommended][MetricRecommended].
352352

353353
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
354354
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
355-
| `system.memory.utilization` | Gauge | `1` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
355+
| `system.memory.utilization` | Gauge | `1` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
356356

357357
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
358358
|---|---|---|---|---|---|
@@ -427,7 +427,7 @@ This metric is [recommended][MetricRecommended].
427427

428428
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
429429
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
430-
| `system.paging.utilization` | Gauge | `1` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
430+
| `system.paging.utilization` | Gauge | `1` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
431431

432432
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
433433
|---|---|---|---|---|---|
@@ -461,7 +461,7 @@ This metric is [recommended][MetricRecommended].
461461

462462
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
463463
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
464-
| `system.paging.faults` | Counter | `{fault}` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
464+
| `system.paging.faults` | Counter | `{fault}` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
465465

466466
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
467467
|---|---|---|---|---|---|
@@ -494,7 +494,7 @@ This metric is [recommended][MetricRecommended].
494494

495495
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
496496
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
497-
| `system.paging.operations` | Counter | `{operation}` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
497+
| `system.paging.operations` | Counter | `{operation}` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
498498

499499
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
500500
|---|---|---|---|---|---|
@@ -541,7 +541,7 @@ This metric is [recommended][MetricRecommended].
541541

542542
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
543543
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
544-
| `system.disk.io` | Counter | `By` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
544+
| `system.disk.io` | Counter | `By` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
545545

546546
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
547547
|---|---|---|---|---|---|
@@ -575,7 +575,7 @@ This metric is [recommended][MetricRecommended].
575575

576576
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
577577
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
578-
| `system.disk.operations` | Counter | `{operation}` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
578+
| `system.disk.operations` | Counter | `{operation}` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
579579

580580
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
581581
|---|---|---|---|---|---|
@@ -679,7 +679,7 @@ This metric is [recommended][MetricRecommended].
679679

680680
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
681681
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
682-
| `system.disk.merged` | Counter | `{operation}` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
682+
| `system.disk.merged` | Counter | `{operation}` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
683683

684684
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
685685
|---|---|---|---|---|---|
@@ -795,7 +795,7 @@ This metric is [recommended][MetricRecommended].
795795

796796
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
797797
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
798-
| `system.filesystem.utilization` | Gauge | `1` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
798+
| `system.filesystem.utilization` | Gauge | `1` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
799799

800800
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
801801
|---|---|---|---|---|---|
@@ -930,7 +930,7 @@ This metric is [recommended][MetricRecommended].
930930

931931
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
932932
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
933-
| `system.network.packets` | Counter | `{packet}` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
933+
| `system.network.packets` | Counter | `{packet}` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
934934

935935
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
936936
|---|---|---|---|---|---|
@@ -1004,7 +1004,7 @@ This metric is [recommended][MetricRecommended].
10041004

10051005
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
10061006
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
1007-
| `system.network.io` | Counter | `By` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
1007+
| `system.network.io` | Counter | `By` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
10081008

10091009
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
10101010
|---|---|---|---|---|---|
@@ -1038,7 +1038,7 @@ This metric is [recommended][MetricRecommended].
10381038

10391039
| Name | Instrument Type | Unit (UCUM) | Description | Stability | Entity Associations |
10401040
| -------- | --------------- | ----------- | -------------- | --------- | ------ |
1041-
| `system.network.connection.count` | UpDownCounter | `{connection}` | | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
1041+
| `system.network.connection.count` | UpDownCounter | `{connection}` | TODO. | ![Development](https://img.shields.io/badge/-development-blue) | [`host`](/docs/registry/entities/host.md#host) |
10421042

10431043
| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
10441044
|---|---|---|---|---|---|

model/android/deprecated/registry-deprecated.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ groups:
77
attributes:
88
- id: android.state
99
stability: development
10-
brief: Deprecated. Use `android.app.state` body field instead.
10+
brief: Deprecated. Use `android.app.state` attribute instead.
1111
deprecated:
1212
reason: uncategorized
13-
note: Use `android.app.state` body field instead.
13+
note: Use `android.app.state` attribute instead.
1414
type:
1515
members:
1616
- id: created

model/ios/deprecated/registry-deprecated.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@ groups:
77
attributes:
88
- id: ios.state
99
stability: development
10+
brief: >
11+
Deprecated. Use the `ios.app.state` attribute.
1012
deprecated:
1113
reason: uncategorized
1214
note:
13-
Replaced by the `ios.app.state` event body field.
15+
Replaced by the `ios.app.state` attribute.
1416
note: >
1517
The iOS lifecycle states are defined in the [UIApplicationDelegate documentation](https://developer.apple.com/documentation/uikit/uiapplicationdelegate),
1618
and from which the `OS terminology` column values are derived.

model/system/metrics.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ groups:
149149
code_generation:
150150
metric_value_type: double
151151
stability: development
152-
brief: ""
152+
brief: TODO.
153153
instrument: gauge
154154
unit: "1"
155155
attributes:
@@ -183,7 +183,7 @@ groups:
183183
code_generation:
184184
metric_value_type: double
185185
stability: development
186-
brief: ""
186+
brief: TODO.
187187
instrument: gauge
188188
unit: "1"
189189
attributes:
@@ -201,7 +201,7 @@ groups:
201201
code_generation:
202202
metric_value_type: int
203203
stability: development
204-
brief: ""
204+
brief: TODO.
205205
instrument: counter
206206
unit: "{fault}"
207207
attributes:
@@ -216,7 +216,7 @@ groups:
216216
annotations:
217217
code_generation:
218218
metric_value_type: int
219-
brief: ""
219+
brief: TODO.
220220
instrument: counter
221221
unit: "{operation}"
222222
attributes:
@@ -233,7 +233,7 @@ groups:
233233
code_generation:
234234
metric_value_type: int
235235
stability: development
236-
brief: ""
236+
brief: TODO.
237237
instrument: counter
238238
unit: "By"
239239
attributes:
@@ -249,7 +249,7 @@ groups:
249249
code_generation:
250250
metric_value_type: int
251251
stability: development
252-
brief: ""
252+
brief: TODO.
253253
instrument: counter
254254
unit: "{operation}"
255255
attributes:
@@ -308,7 +308,7 @@ groups:
308308
code_generation:
309309
metric_value_type: int
310310
stability: development
311-
brief: ""
311+
brief: TODO.
312312
instrument: counter
313313
unit: "{operation}"
314314
attributes:
@@ -364,7 +364,7 @@ groups:
364364
code_generation:
365365
metric_value_type: double
366366
stability: development
367-
brief: ""
367+
brief: TODO.
368368
instrument: gauge
369369
unit: "1"
370370
attributes:
@@ -428,7 +428,7 @@ groups:
428428
code_generation:
429429
metric_value_type: int
430430
stability: development
431-
brief: ""
431+
brief: TODO.
432432
instrument: counter
433433
unit: "{packet}"
434434
attributes:
@@ -466,7 +466,7 @@ groups:
466466
code_generation:
467467
metric_value_type: int
468468
stability: development
469-
brief: ""
469+
brief: TODO.
470470
instrument: counter
471471
unit: "By"
472472
attributes:
@@ -482,7 +482,7 @@ groups:
482482
code_generation:
483483
metric_value_type: int
484484
stability: development
485-
brief: ""
485+
brief: TODO.
486486
instrument: updowncounter
487487
unit: "{connection}"
488488
attributes:

policies/yaml_schema.rego

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,24 @@ deny contains yaml_schema_violation(description, group.id, "") if {
168168
description := sprintf("Group id '%s' is invalid. Span group 'id' must follow 'span.*.%s' pattern", [group.id, kind])
169169
}
170170

171+
# brief is required on attributes
172+
deny contains yaml_schema_violation(description, group.id, attr.id) if {
173+
group := input.groups[_]
174+
attr := group.attributes[_]
175+
property_or_null(attr, "brief") == null
176+
177+
description := sprintf("Attribute id '%s' in group '%s' is invalid. Attributes must have a brief.", [attr.id, group.id])
178+
}
179+
180+
# brief is required on groups (except attribute groups)
181+
deny contains yaml_schema_violation(description, group.id, "") if {
182+
group := input.groups[_]
183+
group.type != "attribute_group"
184+
property_or_null(group, "brief") == null
185+
186+
description := sprintf("Group id '%s' is invalid. Groups must have a brief.", [group.id])
187+
}
188+
171189
yaml_schema_violation(description, group, attr) = violation if {
172190
violation := {
173191
"id": description,
@@ -185,3 +203,8 @@ name_regex := "^[a-z][a-z0-9]*([._][a-z0-9]+)*$"
185203
has_namespace_regex := "^[a-z0-9_]+\\.([a-z0-9._]+)+$"
186204

187205
invalid_name_helper := "must consist of lowercase alphanumeric characters separated by '_' and '.'"
206+
207+
property_or_null(obj, property) := obj[property] if {
208+
obj[property]
209+
obj[property] != ""
210+
} else := null

policies_test/metric_brief_format_test.rego

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,6 @@ test_metric_brief_without_period if {
2626
]}
2727
}
2828

29-
test_metric_without_brief if {
30-
# Should pass: metric without brief is ignored (handled by other policies)
31-
count(before_resolution.deny) == 0 with input as {"groups": [
32-
{"id": "metric.test", "type": "metric", "stability": "development"}
33-
]}
34-
}
35-
36-
test_metric_with_empty_brief if {
37-
# Should pass: metric with empty brief is allowed
38-
count(before_resolution.deny) == 0 with input as {"groups": [
39-
{"id": "metric.test", "type": "metric", "brief": "", "stability": "development"}
40-
]}
41-
42-
# Should pass: metric with whitespace-only brief is treated as empty and allowed
43-
count(before_resolution.deny) == 0 with input as {"groups": [
44-
{"id": "metric.test2", "type": "metric", "brief": " ", "stability": "development"}
45-
]}
46-
}
47-
4829
test_non_metric_groups_ignored if {
4930
# Should pass: non-metric groups are ignored
5031
count(before_resolution.deny) == 0 with input as {"groups": [

0 commit comments

Comments
 (0)