Observe timings even for 304 Not Modified responses to manifest loads.

This commit is contained in:
Catherine
2025-10-21 00:29:42 +00:00
parent 99b87226a1
commit 23b516cf15

View File

@@ -320,11 +320,11 @@ func (l s3ManifestLoader) Reload(ctx context.Context, key string, oldValue *Cach
}
func (l s3ManifestLoader) load(ctx context.Context, name string, oldManifest *CachedManifest) (*CachedManifest, error) {
log.Printf("s3: get manifest %s\n", name)
startTime := time.Now()
manifest, size, etag, err := func() (*Manifest, uint32, string, error) {
log.Printf("s3: get manifest %s\n", name)
startTime := time.Now()
opts := minio.GetObjectOptions{}
if oldManifest != nil && oldManifest.etag != "" {
opts.SetMatchETagExcept(oldManifest.etag)
@@ -351,13 +351,13 @@ func (l s3ManifestLoader) load(ctx context.Context, name string, oldManifest *Ca
return nil, 0, "", err
}
s3GetObjectDurationSeconds.
With(prometheus.Labels{"kind": "manifest"}).
Observe(time.Since(startTime).Seconds())
return manifest, uint32(len(data)), stat.ETag, nil
}()
s3GetObjectDurationSeconds.
With(prometheus.Labels{"kind": "manifest"}).
Observe(time.Since(startTime).Seconds())
if err != nil {
if errResp := minio.ToErrorResponse(err); errResp.Code == "NoSuchKey" {
err = fmt.Errorf("%w: %s", errNotFound, errResp.Key)