opentelemetry-specification icon indicating copy to clipboard operation
opentelemetry-specification copied to clipboard

Clarify log record severity comparison

Open pellared opened this issue 4 months ago • 5 comments

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 0 as yet another severity when it comes to filtering and comparison, i.e. logs with unspecified/0 severity are dropped when threshold > 0 and 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

SeverityNumber can be compared to another SeverityNumber or to numbers in the 1..24 range (or to the corresponding short names).

as I find that this sentence is more confusing than clarifying:

  1. why comparing values of different types?
  2. why can we compare only with integers between 1..24?
  3. what about SeverityNumber that are greater than 24 or lesser than 1?
  4. 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=17 describes an error that is less critical than an error with SeverityNumber=20.

Simplify SeverityProcessor example.

Prototype

This is exactly how https://pkg.go.dev/go.opentelemetry.io/contrib/processors/minsev currently works.

pellared avatar Jun 12 '25 12:06 pellared