Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add created_at and updated_at to alerts in alerting #52738

Closed
FrankHassanabad opened this issue Dec 11, 2019 · 2 comments · Fixed by #53793
Closed

Add created_at and updated_at to alerts in alerting #52738

FrankHassanabad opened this issue Dec 11, 2019 · 2 comments · Fixed by #53793
Assignees
Labels
Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.6.0

Comments

@FrankHassanabad
Copy link
Contributor

Describe the feature:
Add created_at and updated_at to alerts in alerting.

Describe a specific use case for the feature:
When users are writing UI's they need to see when an alert was created and when it was last updated.

See this older saved object issue where created_at was proposed:
#9376

saved objects already have a updated_at, it just needs to flow down to the alerts infrastructure.

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-stack-services (Team:Stack Services)

@bmcconaghy bmcconaghy added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) and removed Team:Stack Services labels Dec 12, 2019
@gmmorris
Copy link
Contributor

This has now been implemented but I was a little torn on how to go about it, so here are a couple of thoughts.

I initially added two properties to the SavedObject - updatedAt and createdAt.
createdAt is set at creation and untouched after. updatedAt is changed on every subsequent update (be it using update, mute, unmute etc.).
The reason I did this rather than use the existing updated_at property that the SavedObject Client already provides was that we so internal updates using that client throughout the creation process, meaning that field would be set on creation and so if I create an Alert, it'll immediately be marked as both created and updated by me, which felt weird.

I then gave it some more thought and realised that that is technically correct, and more importantly, using the SavedObjects field would reflect when the Alert is actually updated, meaning if I do something that has the side effect of updating the SavedObject - that'll be reflected in the Alerting updatedAt field, even if I don't use the update api directly, and that felt like a safer choice.

So the final implementation uses the SavedObjects updated_at property, but it is exposed on API calls as updatedAt along side createdAt.
(Using CamelCase as all other Alerting properties are CamelCased... and I do acknowledge the irony of writing CamelCase in PascalCase)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.6.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants