opentelemetry-specification
opentelemetry-specification copied to clipboard
Clarify log record severity comparison
Follows:
- https://github.com/open-telemetry/opentelemetry-specification/pull/4535
Why
Related to https://github.com/open-telemetry/opentelemetry-specification/issues/4540
Supersedes https://github.com/open-telemetry/opentelemetry-specification/pull/4541 per https://github.com/open-telemetry/opentelemetry-specification/pull/4541#discussion_r2138670874 and discussions from the last OTel Specification and Logs SIG meetings.
Some comments that were already expressed as comments.
From https://github.com/open-telemetry/opentelemetry-specification/pull/4541#discussion_r2138670874:
I'd be in favor of treating
0as yet another severity when it comes to filtering and comparison, i.e. logs with unspecified/0 severity are dropped whenthreshold > 0and are recorded otherwise.
From https://github.com/open-telemetry/opentelemetry-specification/pull/4541#discussion_r2138960382:
I think I like the simplicity of
if sev < p.Min { // drop }
it provides a very reasonable default behavior, which is to drop logs that don't have any severity
This is also inline with
https://github.com/open-telemetry/opentelemetry-specification/blob/7e7c0bd12a535b332284ecabd228c4749886455f/specification/logs/data-model.md?plain=1#L323-L329
From https://github.com/open-telemetry/opentelemetry-specification/issues/4540#issue-3115353902:
Relying on int comparison seems to be the most natural option
We agreed that this PR does conflict proposal to allow only allow/support 0..24 SeverityNumber values.
What
Removal of
SeverityNumbercan be compared to anotherSeverityNumberor to numbers in the 1..24 range (or to the corresponding short names).
as I find that this sentence is more confusing than clarifying:
- why comparing values of different types?
- why can we compare only with integers between 1..24?
- what about
SeverityNumberthat are greater than 24 or lesser than 1? - are the short names normative?
Removal of duplicated description
Smaller numerical values in each range represent less important (less severe) events. Larger numerical values in each range represent more important (more severe) events.
Moving the comparison example to a better place where the SeverityNumber comparison is described
For example
SeverityNumber=17describes an error that is less critical than an error withSeverityNumber=20.
Simplify SeverityProcessor example.
Prototype
This is exactly how https://pkg.go.dev/go.opentelemetry.io/contrib/processors/minsev currently works.