i-love-flamingo / httpcache

Flamingo module to cache http responses

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metrics regarding backendtype / frontendname not exposed

jeinfeldt opened this issue · comments

Hello friends,

we have a two level cache configured as described by the README. The cache is functioning and we have verified that keys exists in the redis and are read by the application.

Now we would like to gain some insight with the provided metrics, and noticed that the tags
identifying the metrics are missing.

When checking the metrics endpoint (http://localhost:13210/metrics), I see this:

# HELP flamingo_httpcache_backend_error Count of cache-backend errors
# TYPE flamingo_httpcache_backend_error counter
flamingo_httpcache_backend_error{area="cacheBackend"} 12
# HELP flamingo_httpcache_backend_hit Count of cache-backend hits
# TYPE flamingo_httpcache_backend_hit counter
flamingo_httpcache_backend_hit{area="cacheBackend"} 16
# HELP flamingo_httpcache_backend_miss Count of cache-backend misses
# TYPE flamingo_httpcache_backend_miss counter
flamingo_httpcache_backend_miss{area="cacheBackend"} 14
# HELP flamingo_prefixrouter_requests request times
# TYPE flamingo_prefixrouter_requests histogram

But the code suggests that the backendtype + frontendname should be available as tags as well:

func (bi Metrics) countHit() {
	ctx, _ := tag.New(
		context.Background(),
		tag.Upsert(opencensus.KeyArea, "cacheBackend"),
		tag.Upsert(backendTypeCacheKeyType, bi.backendType),
		tag.Upsert(frontendNameCacheKeyType, bi.frontendName),
	)
	stats.Record(ctx, backendCacheHitCount.M(1))
}

However, it seems only the key area tag is available.

Without these tags we cannot distinguish between the configured caches in our metrics.
Help / Input would be appreciated, thanks!