open-telemetry / open-telemetry/opentelemetry-java

Fix `otel.sdk.log.created` counting semantics

Open Beginner friendly
#8,688 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

SdkLogRecordBuilder.emit() increments otel.sdk.log.created only after the isEnabled(severity, context) check, so records suppressed by the minimum severity threshold or trace-based rules aren't counted.

Per semantic-conventions #3939, this is wrong — every record submitted to an enabled Logger should be counted, even if it's later filtered within the SDK:

Every log record submitted to an enabled Logger is counted, even if it is later filtered or dropped within the SDK (e.g. by minimum severity or trace-based rules, or by a processor or the export pipeline), making this metric the top of the log delivery funnel.

We should count at intake, before the severity/trace filtering. A disabled Logger is already a no-op so it stays uncounted.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SdkLogRecordBuilder.emit() and inspect where otel.sdk.log.created is incremented relative to the isEnabled(severity, context) check. Verify the existing log SDK tests and add coverage for records filtered by severity or trace rules. Done means records submitted to an enabled Logger are counted, while disabled Logger calls remain uncounted.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
observability
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.