Skip to content

Conversation

@Baliedge
Copy link
Contributor

@Baliedge Baliedge commented Dec 3, 2024

Increase visibility of cache state and performance with Prometheus metrics.
Upstream deps must register metrics returned by GetMetrics().

Metrics

Peer to peer

  • groupcache_get_from_peer_latency{group}: The latency in seconds getting value from remote peer
  • groupcache_set_peer_latency{group}: The latency in seconds during peer update after a Set

Cache stats

type denotes cache type main or hot.

  • groupcache_stats_bytes{group, type}: The number of bytes stored in cache
  • groupcache_stats_items{group, type}: The number of items stored in cache
  • groupcache_stats_gets{group, type}: The count of get requests
  • groupcache_stats_hits{group, type}: The count of cache hits
  • groupcache_stats_evictions{group, type}: The count of cache evictions

Objectives: SummaryObjectives,
}, []string{"group", "peer"})
metricUpdatePeerLatency = prometheus.NewSummaryVec(prometheus.SummaryOpts{
Name: "groupcache_update_peer_latency",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should be called groupcache_set_peer_latency 😃

@udhos
Copy link
Contributor

udhos commented Dec 15, 2024

I am using this exporter to collect metrics from groupcache in prometheus format while keeping prometheus metrics decoupled from groupcache:

https://github.com/udhos/groupcache_exporter

@Baliedge
Copy link
Contributor Author

Closing in favor of existing metrics solution: https://github.com/udhos/groupcache_exporter

Thanks, @udhos

@Baliedge Baliedge closed this Dec 20, 2024
@Baliedge Baliedge deleted the Baliedge/metrics branch April 15, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants