Skip to content

Conversation

@pellared
Copy link
Member

@pellared pellared commented Jun 3, 2025

Fixes #4478

Changes

Per #4509 (comment)

The same is probably done in many languages. Shouldn't we say somewhere in specification that 0 is a "reserved" value as it may be used to model unspecified?

Yes, I think we can.

The main purpose of this PR would then be to allow to have 0 as a "reserved" value as this is how most implementations implement the "unspecified" value e.g.

Defining 0 as something else would be disruptive for these languages. If it would be safe to "reserve" this value and make it optional.

I guess only OTel Rust and OTel Swift have "proper" enums which does not require handling 0 as unspecified.

@pellared pellared marked this pull request as ready for review June 3, 2025 07:59
@pellared pellared requested review from a team June 3, 2025 07:59
@pellared pellared added spec:logs Related to the specification/logs directory area:data-model For issues related to data model clarification clarify ambiguity in specification labels Jun 3, 2025
@pellared pellared self-assigned this Jun 3, 2025
@pellared pellared moved this from Todo to In Progress in Go: Logs (GA) Jun 3, 2025
@pellared pellared moved this to In progress in Logs SIG Jun 3, 2025
@pellared
Copy link
Member Author

pellared commented Jun 3, 2025

@tigrannajaryan, @jack-berg, I would love to get feedback from you.

@pellared
Copy link
Member Author

pellared commented Jun 3, 2025

Logs SIG meeting summary:
We agree that specifying that 0 can be used as "unset" is a good thing given how many languages already modeled it like this. Defining 0 as something else would be disruptive for these languages. It would be safer to "reserve" this value.
Other changes like e.g. changing the ranges should be done in separate PRs and discussed separately.

@pellared pellared changed the title Clarify SeverityNumber allowed values SeverityNumber=0 MAY be used to represent an unspecified value Jun 3, 2025
@pellared pellared requested a review from lmolkova June 3, 2025 18:01
@dyladan
Copy link
Member

dyladan commented Jun 13, 2025

You can add JS to the list of languages using 0 as UNSPECIFIED. I thought that was already a requirement given that it is defined that way in the proto definitions.

edit link: https://github.com/open-telemetry/opentelemetry-js/blob/main/experimental/packages/api-logs/src/types/LogRecord.ts#L24

@pellared
Copy link
Member Author

@tigrannajaryan, @jack-berg, can you please take a look?

@pellared
Copy link
Member Author

I think this PR can be merged if nobody objects during today's Spec SIG meeting.
I plan to work on #4552 (comment) as a followup.

@jack-berg jack-berg added this pull request to the merge queue Jun 24, 2025
Merged via the queue into open-telemetry:main with commit 18a37a1 Jun 24, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this from In progress to Done in Logs SIG Jun 24, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Go: Logs (GA) Jun 24, 2025
@pellared pellared deleted the sev-num-type branch June 24, 2025 16:19
@carlosalberto carlosalberto mentioned this pull request Jul 10, 2025
github-merge-queue bot pushed a commit that referenced this pull request Jul 18, 2025
July 2025 release.

### Context

- Add Supplementary Guidelines for environment variables as context
carrier
  specification.

([#4548](#4548))

### Traces

- Define sampling threshold field in OpenTelemetry TraceState; define
the behavior
of TraceIdRatioBased sampler in terms of W3C Trace Context Level 2
randomness.

([#4166](#4166))
- Define CompositeSampler implementation and built-in ComposableSampler
interfaces.

([#4466](#4466))
- Define how SDK implements `Tracer.Enabled`.

([#4537](#4537))

### Logs

- Stabilize `Event Name` parameter of `Logger.Enabled`.

([#4534](#4534))
- Stabilize SDK and No-Op `Logger.Enabled`.

([#4536](#4536))
- `SeverityNumber=0` MAY be used to represent an unspecified value.

([#4535](#4535))

### Baggage

- Add Supplementary Guidelines for environment variables as context
carrier
  specification.

([#4548](#4548))

### Compatibility

- Clarify expectations about Prometheus content negotiation for metric
names.

([#4543](#4543))

---------

Co-authored-by: Armin Ruech <7052238+arminru@users.noreply.github.com>
Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
github-merge-queue bot pushed a commit that referenced this pull request Jul 21, 2025
Follows:
-
#4535

## Why

Related to
#4540

Supersedes
#4541
per
#4541 (comment)
and discussions from the last OTel Specification and Logs SIG meetings.

**Some comments that were already expressed as comments.**

From
#4541 (comment):

> 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
#4541 (comment):

> 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
#4540 (comment):

> 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.

---------

Co-authored-by: Reiley Yang <reyang@microsoft.com>
Co-authored-by: Cijo Thomas <cijo.thomas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:data-model For issues related to data model changelog.opentelemetry.io clarification clarify ambiguity in specification spec:logs Related to the specification/logs directory

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

Additional severity range applicable to logs with missing severity level

8 participants