Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Dependabot can keep this file up to date with latest containers.

# Weaver is used to generate markdown docs, and enforce policies on the model.
FROM otel/weaver:v0.13.2 AS weaver
FROM otel/weaver:v0.14.0 AS weaver

# OPA is used to test policies enforced by weaver.
FROM openpolicyagent/opa:1.3.0 AS opa
Expand Down
2 changes: 1 addition & 1 deletion docs/dotnet/dotnet-kestrel-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ of `[ 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300 ]`.

| Attribute | Type | Description | Examples | [Requirement Level](https://opentelemetry.io/docs/specs/semconv/general/attribute-requirement-level/) | Stability |
|---|---|---|---|---|---|
| [`error.type`](/docs/attributes-registry/error.md) | string | The full name of exception type. [1] | `System.OperationCanceledException`; `Contoso.MyException` | `Conditionally Required` if and only if an error has occurred. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`error.type`](/docs/attributes-registry/error.md) | string | The full name of exception type. [1] | `connection_reset`; `invalid_handshake` | `Conditionally Required` if and only if an error has occurred. | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`network.protocol.name`](/docs/attributes-registry/network.md) | string | [OSI application layer](https://wikipedia.org/wiki/Application_layer) or non-OSI equivalent. [2] | `http`; `web_sockets` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`network.protocol.version`](/docs/attributes-registry/network.md) | string | The actual version of the protocol used for network communication. [3] | `1.1`; `2` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
| [`network.transport`](/docs/attributes-registry/network.md) | string | [OSI transport layer](https://wikipedia.org/wiki/Transport_layer) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). [4] | `tcp`; `unix` | `Recommended` | ![Stable](https://img.shields.io/badge/-stable-lightgreen) |
Expand Down
6 changes: 2 additions & 4 deletions model/kestrel/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ groups:
- ref: network.protocol.version
examples: ["1.1", "2"]
- ref: tls.protocol.version
# yamllint disable rule:line-length
- ref: error.type
brief: The full name of exception type.
requirement_level:
conditionally_required: if and only if an error has occurred.
note: "Captures the exception type when a connection fails."
examples: ['System.OperationCanceledException', 'Contoso.MyException']
# yamllint disable rule:line-length
- ref: error.type
examples: ['connection_reset', 'invalid_handshake']
# TODO: move note to yaml once https://github.com/open-telemetry/build-tools/issues/192 is supported
note: |
Starting from .NET 9, Kestrel `kestrel.connection.duration` metric reports
Expand Down
3 changes: 3 additions & 0 deletions model/messaging/deprecated/registry-deprecated.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ groups:
Deprecated, use `messaging.client.id` instead.
examples: ['client-5', 'myhost@8742@s8083jm']
deprecated: "Replaced by `messaging.client.id`."
annotations:
code_generation:
exclude: true
- id: messaging.kafka.consumer.group
type: string
brief: >
Expand Down
22 changes: 11 additions & 11 deletions policies/attribute_name_collisions.rego
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@ import rego.v1
attribute_names := { obj |
group := input.groups[_];
attr := group.attributes[_];
obj := { "name": attr.name, "const_name": to_const_name(attr.name), "namespace_prefix": to_namespace_prefix(attr.name), "deprecated": is_property_set(attr, "deprecated") }
obj := { "name": attr.name, "const_name": to_const_name(attr.name), "namespace_prefix": to_namespace_prefix(attr.name), "deprecated": is_property_set(attr, "deprecated"), "annotations": property_or_null(attr, "annotations") }
}

# check that attribute constant names do not collide
deny contains attr_registry_collision(description, name) if {
some i
name := attribute_names[i].name
const_name := attribute_names[i].const_name
not excluded_const_collisions[name]
annotations := attribute_names[i].annotations

not annotations["code_generation"]["exclude"]

collisions := [other.name |
other := attribute_names[_]
other.name != name
other.const_name == const_name
not excluded_const_collisions[other.name]

not other.annotations["code_generation"]["exclude"]
]
count(collisions) > 0

# TODO (https://github.com/open-telemetry/weaver/issues/279): provide other violation properties once weaver supports it.
description := sprintf("Attribute '%s' has the same constant name '%s' as '%s'.", [name, const_name, collisions])
}
Expand Down Expand Up @@ -82,11 +87,6 @@ is_property_set(obj, property) = true if {
obj[property] != null
} else = false

# This list contains exceptions for existing collisions that were introduced unintentionally.
# We'll have a way to specify how collision resolution happens in the schema -
# see phase 2 in https://github.com/open-telemetry/semantic-conventions/issues/1118#issuecomment-2173803006
# For now we'll exclude existing collisions from the checks.
# ADDING NEW EXCEPTIONS IS NOT ALLOWED.

# DO NOT ADD ATTRIBUTES TO THIS LIST
excluded_const_collisions := {"messaging.client_id"}
property_or_null(obj, property) := obj[property] if {
obj[property]
} else = null
9 changes: 9 additions & 0 deletions policies_test/attribute_name_collisions_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,12 @@ test_does_not_fail_on_deprecated_namespace_collision if {
count(deny) == 0 with input as collision
}

test_does_not_fail_on_excluded_name_collision if {
collision := {"groups": [
{"id": "test1", "attributes": [{"name": "test1.namespace.id"}, {"name": "test1.namespace_id", "annotations": {"code_generation": {"exclude": true}}}]},

{"id": "test2", "attributes": [{"name": "test2.namespace_id"}, {"name": "test2.namespace.id", "annotations": {"code_generation": {"exclude": true}}}]},
]}
count(deny) == 0 with input as collision
}