-
Notifications
You must be signed in to change notification settings - Fork 12.4k
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
Alerting: Refactor the ImageStore/Provider to provide image URL/bytes #67693
Alerting: Refactor the ImageStore/Provider to provide image URL/bytes #67693
Conversation
…ernandezc/refactor_image_store_interface
@@ -200,7 +200,7 @@ func createSut(t *testing.T, messageTmpl string, subjectTmpl string, emailTmpl * | |||
}, | |||
Message: messageTmpl, | |||
Subject: subjectTmpl, | |||
}, receivers.Metadata{}, emailTmpl, ns, &images.UnavailableImageStore{}, &alertingLogging.FakeLogger{}) | |||
}, receivers.Metadata{}, emailTmpl, ns, &images.UnavailableProvider{}, &alertingLogging.FakeLogger{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our interface was previously called images.ImageStore
. but this name has recently been changed to images.Provider
in this PR to better reflect its behavior.
All changes from ImageStore
-> Provider
respond to this name change in our alerting repository.
…ernandezc/refactor_image_store_interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM. One thing I would like us to have is logging that would mention how annotation was resolved, whether there was a record in db and if it was expired or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a first pass, looking good. I got one nit and one thing we should consider regarding the database fields we use in the where clause of the newly introduced URLExists
function.
…ernandezc/refactor_image_store_interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice work 👍
…ernandezc/refactor_image_store_interface
…ernandezc/refactor_image_store_interface
Description
This PR implements the
images.Provider
interface described in ourgrafana/alerting
repository (link).This new implementation has two methods:
GetImageURL()
: Gets a URL that can be used directly in our notifications.GetRawImage()
: Returns anio.ReadCloser
to read the bytes of an image, useful for integrations that require the images to be uploaded.Other Changes
ImageStore
->Provider
(naming change).go.mod
.URLExists()
method in our store.