mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
refactor(unified-storage): measure also failed queries (#100430)
This commit is contained in:
parent
f7588376df
commit
d1b4162a33
@ -176,28 +176,22 @@ func (d *DualWriterMode3) Delete(ctx context.Context, name string, deleteValidat
|
||||
// we want to delete from legacy first, otherwise if the delete from unistore was successful,
|
||||
// but legacy failed, the user would get a failure, but not be able to retry the delete
|
||||
// as they would not be able to see the object in unistore anymore.
|
||||
|
||||
startLegacy := time.Now()
|
||||
objFromLegacy, asyncLegacy, err := d.Legacy.Delete(ctx, name, deleteValidation, options)
|
||||
d.recordLegacyDuration(err != nil && !apierrors.IsNotFound(err), mode3Str, d.resource, method, startLegacy)
|
||||
if err != nil {
|
||||
if !apierrors.IsNotFound(err) {
|
||||
log.WithValues("object", objFromLegacy).Error(err, "could not delete from legacy store")
|
||||
d.recordLegacyDuration(true, mode3Str, d.resource, method, startLegacy)
|
||||
return objFromLegacy, asyncLegacy, err
|
||||
}
|
||||
}
|
||||
d.recordLegacyDuration(false, mode3Str, d.resource, method, startLegacy)
|
||||
|
||||
startStorage := time.Now()
|
||||
objFromStorage, asyncStorage, err := d.Storage.Delete(ctx, name, deleteValidation, options)
|
||||
d.recordStorageDuration(err != nil && !apierrors.IsNotFound(err), mode3Str, d.resource, method, startStorage)
|
||||
if err != nil {
|
||||
if !apierrors.IsNotFound(err) {
|
||||
log.WithValues("object", objFromStorage).Error(err, "could not delete from storage")
|
||||
d.recordStorageDuration(true, mode3Str, d.resource, method, startStorage)
|
||||
return nil, false, err
|
||||
}
|
||||
return objFromStorage, asyncStorage, err
|
||||
}
|
||||
d.recordStorageDuration(false, mode3Str, d.resource, method, startStorage)
|
||||
|
||||
areEqual := Compare(objFromStorage, objFromLegacy)
|
||||
d.recordOutcome(mode3Str, name, areEqual, method)
|
||||
|
Loading…
Reference in New Issue
Block a user