Skip to content

feat: Add check for event.Series.LastObservedTime - #6825

Open
NachoxMacho wants to merge 2 commits into
grafana:mainfrom
NachoxMacho:fix/kubernetes-event-timestamp
Open

feat: Add check for event.Series.LastObservedTime#6825
NachoxMacho wants to merge 2 commits into
grafana:mainfrom
NachoxMacho:fix/kubernetes-event-timestamp

Conversation

@NachoxMacho

Copy link
Copy Markdown

Brief description of Pull Request

This updates the event timestamp check, to utilize the series.lastObservedTime field if present, and default to existing logic if it's not present. Adds an if statement to the event timestamp function for this check.

Pull Request Details

The existing timestamp logic has an issue when an event doesn't get a lastTimestamp and only has eventTime and series.lastObservedTime. This causes events that are valid, but repeat using the series functionality to only be registered when they were initially created, making the timestamping inaccurate.

This seems to be currently isolated to the scheduler's event reporting node availability when a pod can't be scheduled. For example:

0/16 nodes are available: persistentvolumeclaim "pvc-redisinsight" not found. not found

I have not seen any instances in my investigation where both lastTimestamp and series.lastObservedTime are defined, however in this case I think it would be beneficial to use the series.lastObservedTime as that is the newer of the two fields.

This also seems to be the general direction of the Kubernetes event structure going forward, with lastTimestamp being deprecated in 1.25, so I'd expect this problem to ripple out to other events as more get updated.

Issue(s) fixed by this Pull Request

Fixes #206
Fixes #4140

Notes to the Reviewer

This is my first PR to the repository, so let me know if I've missed anything or this is an incorrect way to suggest a change. I have written all the content of the change and this PR description myself, and not used AI for any of the work related to this.

PR Checklist

  • Documentation added
  • Tests updated
  • Config converters updated
  • This pull request was substantially generated with AI assistance (see the GenAI policy)

@NachoxMacho
NachoxMacho requested a review from a team as a code owner August 5, 2026 12:14
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Signed commits report

All 2 commits between main and fix/kubernetes-event-timestamp have verified signatures. ✅

@cla-assistant

cla-assistant Bot commented Aug 5, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@NachoxMacho
NachoxMacho force-pushed the fix/kubernetes-event-timestamp branch from ed3195f to ce8d11a Compare August 5, 2026 12:22
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.

loki.source.kubernetes_events generating old events loki.source.kubernetes_events: use last observed time as timestamp instead of creation time

1 participant