Skip to content

expfmt: preserve the full range of sample timestamps - #1036

Open
ViktorBystrov72 wants to merge 1 commit into
prometheus:mainfrom
ViktorBystrov72:fix/extracted-sample-timestamps
Open

ViktorBystrov72 wants to merge 1 commit into
prometheus:mainfrom
ViktorBystrov72:fix/extracted-sample-timestamps

Conversation

@ViktorBystrov72

Copy link
Copy Markdown

ExtractSamples converts each explicit protobuf millisecond timestamp to nanoseconds before converting it to model.Time. The multiplication overflows outside the nanosecond range: 9223372036855 milliseconds becomes -9223372036854, and math.MaxInt64 becomes -1.

Both representations already use int64 milliseconds, so copy the timestamp directly for counters, gauges, untyped metrics, summaries, and both histogram types. Regression cases cover the overflow boundaries, int64 extremes, ordinary and negative timestamps, and the default timestamp when none is supplied. They fail on the parent commit and pass with this change.

Validation: root go test ./..., go test -race ./expfmt -count=1, make lint, license checks, module-tidy checks, and git diff --check passed with Go 1.27.3 and golangci-lint 2.14.0.

@roidelapluie @gotjosh

@ViktorBystrov72
ViktorBystrov72 force-pushed the fix/extracted-sample-timestamps branch 2 times, most recently from 81357e9 to 2b719ad Compare November 12, 2026 04:53
Signed-off-by: Виктор Быстров <anatema@bk.ru>
@ViktorBystrov72
ViktorBystrov72 force-pushed the fix/extracted-sample-timestamps branch from 2b719ad to a0df2a7 Compare November 13, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant