Skip to content

Guard capability duration metrics against invalid timestamps - #754

Open
Krish-vemula wants to merge 1 commit into
mainfrom
fix/cap-duration-invalid-telemetry
Open

Krish-vemula wants to merge 1 commit into
mainfrom
fix/cap-duration-invalid-telemetry

Conversation

@Krish-vemula

Copy link
Copy Markdown
Contributor

Summary

  • Reject reversed or int64-overflowing capability telemetry timestamps in RecordEmit
  • Preserve event counts while skipping invalid timestamp and duration samples
  • Add an invalid telemetry counter and tests for reversed/overflow inputs

@cl-sonarqube-production

Copy link
Copy Markdown

@Krish-vemula
Krish-vemula marked this pull request as ready for review September 10, 2026 16:27
@Krish-vemula
Krish-vemula requested review from a team as code owners September 10, 2026 16:27
Comment thread libs/monitoring/common.go
Unit: "ms",
Description: fmt.Sprintf("The duration (local) since capability exec start to message: '%s' emit", eventRef),
},
invalidTelemetry: beholder.MetricInfo{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when does this get emitted?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From RecordEmit, only when the timestamp pair is invalid (emit < start or timestamp > MaxInt64). It marks samples we intentionally skip for timestamp/duration recording while still counting the event.

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.

2 participants