diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-12-17 15:00:09 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2019-12-17 15:00:09 +0300 |
commit | b6c55c1fed2f48c75aade7344d57e171fe4f0073 (patch) | |
tree | 6b17c5d603adaa8b051c6bd37a11a4ce587a71b1 /internal/source | |
parent | 332f72f54c95bf44c8559b65473350516827b1c4 (diff) |
Add GitLab API domains source caching metrics
Diffstat (limited to 'internal/source')
-rw-r--r-- | internal/source/gitlab/cache/cache.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/internal/source/gitlab/cache/cache.go b/internal/source/gitlab/cache/cache.go index 492a52a9..3d518ff0 100644 --- a/internal/source/gitlab/cache/cache.go +++ b/internal/source/gitlab/cache/cache.go @@ -4,6 +4,7 @@ import ( "context" "gitlab.com/gitlab-org/gitlab-pages/internal/source/gitlab/api" + "gitlab.com/gitlab-org/gitlab-pages/metrics" ) // Cache is a short and long caching mechanism for GitLab source @@ -73,14 +74,17 @@ func (c *Cache) Resolve(ctx context.Context, domain string) *api.Lookup { entry := c.store.LoadOrCreate(domain) if entry.IsUpToDate() { + metrics.DomainsSourceCacheHit.Inc() return entry.Lookup() } if entry.NeedsRefresh() { entry.Refresh(c.client, c.store) + metrics.DomainsSourceCacheHit.Inc() return entry.Lookup() } + metrics.DomainsSourceCacheMiss.Inc() return entry.Retrieve(ctx, c.client) } |