Skip to content

Commit 91a7c35

Browse files
authored
Merge branch 'main' into 1600-cicd-metrics
2 parents 88e1c25 + bfe6e1e commit 91a7c35

File tree

12 files changed

+84
-15
lines changed

12 files changed

+84
-15
lines changed

.github/workflows/prepare-new-pr.yml

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
ref: ${{ github.head_ref }}
2222
path: prchangelog
23+
repository: ${{ github.event.pull_request.head.repo.full_name }}
2324
sparse-checkout: .chloggen
2425

2526
# we're going to run prepare-new-pr script from the main branch

docs/database/redis.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Instrumentations SHOULD document how `error.type` is populated.
7474

7575
**[9] `db.operation.batch.size`:** Operations are only considered batches when they contain two or more operations, and so `db.operation.batch.size` SHOULD never be `1`.
7676

77-
**[10] `db.query.text`:** For **Redis**, the value provided for `db.query.text` SHOULD correspond to the syntax of the Redis CLI. If, for example, the [`HMSET` command](https://redis.io/commands/hmset) is invoked, `"HMSET myhash field1 'Hello' field2 'World'"` would be a suitable value for `db.query.text`.
77+
**[10] `db.query.text`:** For **Redis**, the value provided for `db.query.text` SHOULD correspond to the syntax of the Redis CLI. If, for example, the [`HMSET` command](https://redis.io/docs/latest/commands/hmset) is invoked, `"HMSET myhash field1 'Hello' field2 'World'"` would be a suitable value for `db.query.text`.
7878

7979
**[11] `db.query.text`:** Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text.
8080
See [Sanitization of `db.query.text`](../../docs/database/database-spans.md#sanitization-of-dbquerytext).

internal/tools/go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ toolchain go1.23.4
66

77
require (
88
github.com/client9/misspell v0.3.4
9-
go.opentelemetry.io/build-tools/chloggen v0.16.0
9+
go.opentelemetry.io/build-tools/chloggen v0.17.0
1010
)
1111

1212
require (

internal/tools/go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
1414
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
1515
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
1616
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
17-
go.opentelemetry.io/build-tools/chloggen v0.16.0 h1:iuotHxlcK46JJtQLdwQPsC5dcAygeOL116d2akCv8M8=
18-
go.opentelemetry.io/build-tools/chloggen v0.16.0/go.mod h1:Wk92v9Wsv36sXYi7hOg3ndeeLKmKBu0/kgB7wcaeqJg=
17+
go.opentelemetry.io/build-tools/chloggen v0.17.0 h1:aOtA6MW67VoB1HYxcqYIlVxfiBypI/ZTxSb7SU/Jw8g=
18+
go.opentelemetry.io/build-tools/chloggen v0.17.0/go.mod h1:Wk92v9Wsv36sXYi7hOg3ndeeLKmKBu0/kgB7wcaeqJg=
1919
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2020
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2121
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

model/database/spans.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ groups:
403403
see [`db.operation.parameter.<key>`](../../docs/attributes-registry/db.md)).
404404
note: >
405405
For **Redis**, the value provided for `db.query.text` SHOULD correspond to the syntax of the Redis CLI.
406-
If, for example, the [`HMSET` command](https://redis.io/commands/hmset) is invoked, `"HMSET myhash field1 'Hello' field2 'World'"` would be a suitable value for `db.query.text`.
406+
If, for example, the [`HMSET` command](https://redis.io/docs/latest/commands/hmset) is invoked, `"HMSET myhash field1 'Hello' field2 'World'"` would be a suitable value for `db.query.text`.
407407
- ref: network.peer.address
408408
brief: Peer address of the database node where the operation was performed.
409409
requirement_level:

model/device/events.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,29 @@ groups:
3737
value: 'active'
3838
brief: >
3939
The app has become `active`. Associated with UIKit notification `applicationDidBecomeActive`.
40+
stability: development
4041
- id: inactive
4142
value: 'inactive'
4243
brief: >
4344
The app is now `inactive`. Associated with UIKit notification `applicationWillResignActive`.
45+
stability: development
4446
- id: background
4547
value: 'background'
4648
brief: >
4749
The app is now in the background.
4850
This value is associated with UIKit notification `applicationDidEnterBackground`.
51+
stability: development
4952
- id: foreground
5053
value: 'foreground'
5154
brief: >
5255
The app is now in the foreground.
5356
This value is associated with UIKit notification `applicationWillEnterForeground`.
57+
stability: development
5458
- id: terminate
5559
value: 'terminate'
5660
brief: >
5761
The app is about to terminate. Associated with UIKit notification `applicationWillTerminate`.
62+
stability: development
5863
- id: android.state
5964
stability: experimental
6065
requirement_level:
@@ -72,13 +77,16 @@ groups:
7277
brief: >
7378
Any time before Activity.onResume() or, if the app has no Activity, Context.startService()
7479
has been called in the app for the first time.
80+
stability: development
7581
- id: background
7682
value: 'background'
7783
brief: >
7884
Any time after Activity.onPause() or, if the app has no Activity,
7985
Context.stopService() has been called when the app was in the foreground state.
86+
stability: development
8087
- id: foreground
8188
value: 'foreground'
8289
brief: >
8390
Any time after Activity.onResume() or, if the app has no Activity,
8491
Context.startService() has been called when the app was in either the created or background states.
92+
stability: development

model/gen-ai/events.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ groups:
111111
- id: function
112112
value: 'function'
113113
brief: Function
114+
stability: development
114115
stability: experimental
115116
brief: >
116117
The type of the tool.
@@ -275,6 +276,7 @@ groups:
275276
- id: function
276277
value: 'function'
277278
brief: Function
279+
stability: development
278280
stability: experimental
279281
brief: >
280282
The type of the tool.

model/network/registry.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ groups:
236236
type: string
237237
brief: 'The network interface name.'
238238
examples: [ 'lo', 'eth0' ]
239+
stability: development
239240
- id: network.connection.state
240241
type:
241242
members:

policies/registry.rego

+19
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,25 @@ deny contains attr_registry_violation(description, group.id, attr.id) if {
7070
description := sprintf("Attribute definition '%s' has requirement_level set to %s. Only attribute references can set requirement_level.", [attr.id, attr.requirement_level])
7171
}
7272

73+
# We require attribute definitions to have stability
74+
deny contains attr_registry_violation(description, group.id, attr.id) if {
75+
group := input.groups[_]
76+
attr := group.attributes[_]
77+
not attr.stability
78+
description := sprintf("Attribute definition '%s' does not contain stability field. All attribute definitions must include stability level.", [attr.id])
79+
}
80+
81+
# We require span, metrics, events, resources definitions to have stability
82+
deny contains attr_registry_violation(description, group.id, "") if {
83+
semconv_types := {"span", "metric", "event", "resource"}
84+
group := input.groups[_]
85+
86+
semconv_types[group.type] != null
87+
88+
not group.stability
89+
description := sprintf("Semconv group '%s' does not contain stability field. All semconv definitions must include stability level.", [group.id])
90+
}
91+
7392
get_attribute_name(attr, group) := name if {
7493
full_name := concat(".", [group.prefix, attr.id])
7594

policies_test/registry_test.rego

+40-5
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,55 @@ test_registry_attribute_groups if {
1111

1212
test_attribute_ids if {
1313
# This requires a prefix for use with opa, but weaver will fill in.
14-
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "not_registry", "prefix": "", "attributes": [{"id": "foo.bar"}]}]}
14+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "not_registry", "prefix": "", "attributes": [{"id": "foo.bar", "stability": "rc"}]}]}
1515
count(before_resolution.deny) == 0 with input as {"groups": [
16-
{"id": "registry.test", "prefix": "", "attributes": [{"id": "foo.bar"}]},
17-
{"id": "not_registry", "prefix": "", "attributes": [{"ref": "foo.bar"}]},
16+
{"id": "registry.test", "prefix": "", "attributes": [{"id": "foo.bar", "stability": "rc"}]},
17+
{"id": "not_registry", "prefix": "", "attributes": [{"ref": "foo.bar", "stability": "rc"}]},
1818
]}
1919
}
2020

21+
test_attribute_without_stability if {
22+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.text", "attributes": [{"id": "foo.bar"}]}]}
23+
count(before_resolution.deny) == 0 with input as {"groups": [
24+
{"id": "registry.test", "attributes": [{"id": "foo.bar", "stability": "alpha"}]},
25+
]}
26+
}
27+
28+
test_span_without_stability if {
29+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "span.group", "type": "span"}]}
30+
count(before_resolution.deny) == 0 with input as {"groups": [
31+
{"id": "span.group", "type": "span", "stability": "alpha"}]
32+
}
33+
}
34+
35+
test_event_without_stability if {
36+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "event.foo", "type": "event", "name": "foo"}]}
37+
count(before_resolution.deny) == 0 with input as {"groups": [
38+
{"id": "event.foo", "name": "foo", "type": "event", "stability": "alpha"}]
39+
}
40+
}
41+
42+
test_metric_without_stability if {
43+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "metric.foo", "type": "metric", "name": "foo"}]}
44+
count(before_resolution.deny) == 0 with input as {"groups": [
45+
{"id": "metric.foo", "name": "foo", "type": "metric", "stability": "development"}]
46+
}
47+
}
48+
49+
test_resource_without_stability if {
50+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "resource.foo", "type": "resource", "name": "foo"}]}
51+
count(before_resolution.deny) == 0 with input as {"groups": [
52+
{"id": "resource.foo", "name": "foo", "type": "resource", "stability": "stable"}]
53+
}
54+
}
55+
2156
test_attribute_refs if {
2257
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.foo", "attributes": [{"ref": "foo"}]}]}
2358
count(before_resolution.deny) == 0 with input as {"groups": [{"id": "not_registry", "attributes": [{"ref": "foo"}]}]}
2459
}
2560

2661
test_attribute_requirement_levels if {
27-
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.foo", "attributes": [{"id": "foo", "requirement_level": "required"}]}]}
28-
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.foo", "attributes": [{"id": "foo", "requirement_level": {"recommended": "if available"}}]}]}
62+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.foo", "attributes": [{"id": "foo", "requirement_level": "required", "stability": "rc"}]}]}
63+
count(before_resolution.deny) > 0 with input as {"groups": [{"id": "registry.foo", "attributes": [{"id": "foo", "requirement_level": {"recommended": "if available"}, "stability": "rc"}]}]}
2964
count(before_resolution.deny) == 0 with input as {"groups": [{"id": "not_registry", "attributes": [{"ref": "foo", "requirement_level": "required"}]}]}
3065
}

policies_test/yaml_schema_test.rego

+5-4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ test_fails_on_referenced_event_name_on_event if {
5252
event := [{ "id": "event.foo",
5353
"type": "event",
5454
"name": "foo",
55+
"stability": "rc",
5556
"attributes": [{"ref": "event.name"}]}]
5657
count(deny) == 1 with input as {"groups": event}
5758
}
@@ -101,22 +102,22 @@ test_fails_on_invalid_resource_id if {
101102
}
102103

103104
create_attribute_group(attr) = json if {
104-
json := [{"id": "yaml_schema.test", "attributes": [{"id": attr}]}]
105+
json := [{"id": "yaml_schema.test", "attributes": [{"id": attr, "stability": "rc"}]}]
105106
}
106107

107108
create_metric(name) = json if {
108109
id := sprintf("metric.%s", [name])
109-
json := [{"id": id, "type": "metric", "metric_name": name}]
110+
json := [{"id": id, "type": "metric", "metric_name": name, "stability": "rc"}]
110111
}
111112

112113
create_event(name) = json if {
113114
id := sprintf("event.%s", [name])
114-
json := [{"id": id, "type": "event", "name": name}]
115+
json := [{"id": id, "type": "event", "name": name, "stability": "rc"}]
115116
}
116117

117118
create_resource(name) = json if {
118119
id := sprintf("resource.%s", [name])
119-
json := [{"id": id, "type": "resource", "name": name}]
120+
json := [{"id": id, "type": "resource", "name": name, "stability": "rc"}]
120121
}
121122

122123
invalid_names := [

templates/registry/markdown/stability.j2

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
{%- elif stability == "stable" %}![Stable](https://img.shields.io/badge/-stable-lightgreen)
55
{%- elif stability == "release_candidate" %}![Release Candidate](https://img.shields.io/badge/-rc-mediumorchid)
66
{%- elif stability == "deprecated" %}![Deprecated](https://img.shields.io/badge/-deprecated-red)
7-
{%- else %}![Experimental](https://img.shields.io/badge/-experimental-blue)
7+
{%- elif stability == "experimental" %}![Experimental](https://img.shields.io/badge/-experimental-blue)
8+
{%- elif stability == "development" %}![Experimental](https://img.shields.io/badge/-experimental-blue)
9+
{%- else %}{{ "Unknown stability." }}
810
{%- endif %}
911
{%- endmacro %}

0 commit comments

Comments
 (0)