mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 03:01:48 +00:00
Observe timings even for 304 Not Modified responses to manifest loads.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user