open-telemetry / open-telemetry/opentelemetry-ruby

Fix per-timeseries async cumulative start-timestamp distinction

Open
#2,370 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug metrics spec-compliance spec:development
Dominant language
Ruby
Stars
606
Forks
301
Avg merge
3d 19h
Merged PRs (30d)
42

Description

Spec requirement

[Development] For cumulative async instruments, start timestamp SHOULD be instrument-creation time (if first series in first collection) or the prior collection's timestamp otherwise (sdk.md:853-876, Start timestamps).

Current behavior

Async streams reuse the same ||= start_time-on-first-write pattern as sync (via the shared aggregation classes, e.g. sum.rb:45 (permalink)) rather than distinguishing "first series in first collection" (instrument-creation time) from "first occurrence in a later collection" (prior collection's timestamp) — a simplification of the spec's two-case rule.

Suggested fix

Thread the instrument-creation timestamp through to async metric streams so the first-ever collection can use it, while later collections that see a first-time attribute set still use the prior collection's timestamp as today.

Related rows in SPEC_COMPLIANCE_METRICS.md

SDK-28

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 with the shared aggregation classes, especially metrics_sdk/lib/opentelemetry/sdk/metrics/aggregation/sum.rb around line 45, and compare the behavior with the SDK start-timestamps section linked in the issue. Trace how async metric streams receive collection timestamps and instrument creation time. Done means the first series in the first collection uses instrument-creation time, while a first-time attribute set in later collections uses the prior collection timestamp, with SDK-28 compliance updated as needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.