<@U04UQ68083H> How can I track in self-hosted Hydr...
# ory-copilot
g
@chilly-king-10285 How can I track in self-hosted Hydra the usage of each OAuth2 client?
b
A message from kapa.ai
A message from kapa.ai
I'm sorry, but the knowledge sources do not contain explicit information about tracking the usage (such as request counts, token issuance, or activity logs) of each OAuth2 client in self-hosted Ory Hydra. The available documentation covers how to list, create, update, and manage OAuth2 clients, as well as how to perform OAuth2 flows and introspect tokens, but it does not mention built-in features or recommended practices for tracking per-client usage or analytics in self-hosted deployments. If you need detailed usage tracking, you may need to implement external logging or monitoring around the endpoints or use external tools to analyze access logs. For observability, Hydra can be integrated with Prometheus for metrics, but the documentation does not specify if these metrics include per-client usage details [Ory Hydra OAuth2 Server Quickstart](https://www.ory.sh/docs/hydra/self-hosted/quickstart).
Ory Hydra does not provide built-in, per-client usage tracking (such as request counts, token issuance, or activity logs) directly in its administrative APIs or CLI, according to the available documentation. However, you can monitor overall Hydra activity and metrics using Prometheus, as Hydra exposes a Prometheus-compatible metrics endpoint at
http://{host}:4445/admin/metrics/prometheus
by default. This allows you to collect operational metrics, but these are generally system-wide and not broken down by individual OAuth2 client usage out of the box [Prometheus observability](https://www.ory.sh/docs/self-hosted/operations/observability#prometheus). To track per-client usage, you would typically need to: - Scrape and analyze Hydra’s Prometheus metrics for any available client-related labels (if present). - Implement external logging or monitoring at the API gateway or reverse proxy level to log requests and correlate them with client IDs. - Use custom middleware or integrations to log or process token issuance and introspection events, extracting the client ID from those events. In summary, while Hydra supports robust system-level observability, the knowledge sources do not describe a built-in feature for detailed per-client usage tracking. You would need to extend your monitoring setup to achieve this level of granularity.
A message from kapa.ai
In self-hosted Ory Hydra, there is no built-in feature explicitly documented for tracking the usage of each OAuth2 client (such as counting requests, issued tokens, or per-client analytics). The available observability features include exposing Prometheus metrics at the
/admin/metrics/prometheus
endpoint, but the documentation does not specify that these metrics provide per-client usage breakdowns [Prometheus Observability](https://www.ory.sh/docs/self-hosted/operations/observability#prometheus). For more granular tracking, you would need to implement external monitoring or logging solutions. Ory services provide detailed logs that include HTTP request context, which could be parsed to extract client-specific activity by analyzing the
client_id
in relevant requests [Log Fields](https://www.ory.sh/docs/self-hosted/operations/logging#log-fields). However, this requires custom log processing, as there is no out-of-the-box dashboard or API for per-client usage statistics in self-hosted Hydra. If you need advanced analytics or administrative dashboards, these are available in Ory Network, but not in self-hosted Hydra [Feature Differences](https://www.ory.sh/blog/ory-network-or-self-hosting-explained-use-cases). In summary: - Prometheus metrics are available, but per-client usage is not explicitly documented. - You can analyze logs for client activity, but this requires custom processing. - No built-in per-client usage dashboard or API exists in self-hosted Hydra.