Skip to content

Conversation

Stern87
Copy link

@Stern87 Stern87 commented Apr 29, 2025

This PR adds full support for the new proxy_* stats that appear when Memcached is built and run in proxy mode, and ensures that scraping a non-proxy Memcached instance do not fail due to missing keys. It also updates the README to document all of the new proxy metrics.

Changes:

  • Exporter (exporter.go):
    • Added prometheus.Desc fields for each proxy metric (proxy_conn_requests, proxy_conn_errors, proxy_conn_oom, proxy_req_active, proxy_config_reloads, proxy_config_reload_fails, proxy_config_cron_runs, proxy_config_cron_fails, proxy_backend_total, proxy_backend_marked_bad, proxy_backend_failed, proxy_request_failed_depth, round_robin_fallback, unexpected_napi_ids).
    • Initialized those Descs in New(...) using the naming convention memcached_<metric>[_total].
    • Added those in Describe list of all the metrics exported by the memcached exporter.
    • Extended parseStats to detect and emit proxy metrics when present.
    • Wrapped proxy parsing in a guard so that missing proxy_* stats do not cause scrape failures on non-proxy Memcached instances.
  • Documentation (README.md):
    • Added a Proxy Mode Metrics to the Collectors section listing and describing each exported memcached_proxy_* metric.

Motivation:

Memcached 1.6.23+ can run as a frontend proxy, exposing a new set of proxy_* stats. Without these changes, the Prometheus exporter doesn’t surface any of the proxy metrics to Prometheus.

This update makes the exporter fully compatible with both classic and proxy-mode Memcached deployments.

Testing:

  • Ran the exporter against a vanilla Memcached 1.6.37: scrape succeeds, no proxy metrics.
  • Ran against a proxy-mode Memcached 1.6.37 with a simple Lua routing config: all memcached_proxy_* metrics appear and values match stats output.
  • Verified that existing standard metrics (uptime, cmd_get, etc.) are unaffected.

Backward Compatibility:

Existing users of the exporter who do not enable proxy mode will see identical behavior, and their scrapes will continue to succeed without any new metrics.

Documentation:

  • README.md updated with adding a Proxy Mode Metrics to the Collectors section listing and describing each exported memcached_proxy_* metric.

@Stern87 Stern87 force-pushed the feat/export-proxy-metrics branch from dcc691b to 78c2c68 Compare April 29, 2025 09:54
@Stern87
Copy link
Author

Stern87 commented May 9, 2025

Hey @SuperQ can you take a look please?

@Stern87
Copy link
Author

Stern87 commented May 29, 2025

@SuperQ please review. Thanks!

Signed-off-by: Eugene Tretiak <minister87@gmail.com>
@Stern87 Stern87 force-pushed the feat/export-proxy-metrics branch from 78c2c68 to 2b02f44 Compare June 6, 2025 01:54
@Stern87
Copy link
Author

Stern87 commented Jun 17, 2025

Hey @SuperQ can you take a look please?

1 similar comment
@Stern87
Copy link
Author

Stern87 commented Jul 16, 2025

Hey @SuperQ can you take a look please?

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.

1 participant