shiichan

Privacy Proxy Metrics Are Now Just a GraphQL Query Away!

Hi everyone, it's me, Shii-chan! Today I've got a small but handy update from Cloudflare's observability world.

Cloudflare Changelog developers.cloudflare.com

What was announced?

From Cloudflare's Changelog: Privacy Proxy metrics are now queryable through the GraphQL Analytics API. And this is now the new default way to access Privacy Proxy observability data.

The story so far

Until now, Privacy Proxy metrics were exported via OpenTelemetry, which meant you had to run your own collector infrastructure. OpenTelemetry export is still available, but going forward GraphQL is the recommended default.

What changes

The GraphQL Analytics API is a plug-and-play method that needs no collector infrastructure, so you skip the work of standing up and operating a collector and save engineering overhead. With an API token, you hit a single endpoint, https://api.cloudflare.com/client/v4/graphql, and pull the metrics.

Dive Deep

There are four nodes, each returning aggregate metrics:

  • privacyProxyRequestMetricsAdaptiveGroups — request volume, error rates, status codes, and proxy status breakdowns
  • privacyProxyIngressConnMetricsAdaptiveGroups — client-to-proxy connection counts, bytes transferred, and latency percentiles
  • privacyProxyEgressConnMetricsAdaptiveGroups — proxy-to-origin connection counts, bytes transferred, and latency percentiles
  • privacyProxyAuthMetricsAdaptiveGroups — authentication attempt counts by method and result

Every node supports filtering by time, data center (coloCode), and endpoint, plus node-specific dimensions such as transport protocol and authentication method.

Here's the shape of a call (swap the placeholders for your own values):

curl https://api.cloudflare.com/client/v4/graphql \
  --header "Authorization: Bearer YOUR_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{ "query": "{ viewer { accounts(filter: { accountTag: $accountTag }) { privacyProxyRequestMetricsAdaptiveGroups(filter: { date_geq: $startDate, date_leq: $endDate }, limit: 10000, orderBy: [date_ASC]) { count dimensions { date } } } } }" }'

Want the details? Check out the GraphQL Analytics API for Privacy Proxy and the GraphQL Analytics API getting started guide.

Wrap-up

  • Privacy Proxy metrics are now available via the GraphQL Analytics API
  • This is the new default method for observability data (OpenTelemetry export still works)
  • Four nodes: requests / ingress connections / egress connections / auth
  • No collector infrastructure needed, just hit a single endpoint

If you run Privacy Proxy and want to cut the operational cost of collecting metrics, this update is a great fit for you!