{
  "id": "observability",
  "title": "Observability",
  "url": "https://redis.io/docs/latest/develop/clients/observability/",
  "summary": "Monitor your client's activity for optimization and debugging.",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-01T08:10:08-05:00",
  "page_type": "content",
  "content_hash": "c80537f4a64b99cfc2dbf138e3bfaa3cfc0efb7609f8e7be3d398069721ddb6a",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Some Redis client libraries implement the [OpenTelemetry](https://opentelemetry.io/) (OTel)\nobservability framework to let you gather performance metrics\nfor your application. This can help you optimize performance and pinpoint problems\nquickly. Currently, the following clients support OTel:\n\n- [redis-py]()\n- [go-redis]()\n\n<!--"
    },
    {
      "id": "tracing-overview",
      "title": "Tracing overview",
      "role": "content",
      "text": "An execution trace is a record of the sequence of steps that the Redis\nclient takes as it executes commands. Each step or *span* (in OTel terminology)\nrepresents a specific operation. In the trace, each span is recorded using an identifier\nto represent the type of operation along with its start and finish time, its\ncompletion or error status, and other relevant information.\n\nFor example, a simple trace might look like this:\n\n[code example]\n\nThis contains two child spans, each representing a specific operation\nsuch as executing a command or connecting to a Redis server.\nEach span is recorded with its start time, end time, and status information.\n\nA span can sometimes be broken down into sub-tasks (such as steps taken\nwhile calling an external service), each of which is a span in its own right.\nThe full trace is therefore best understood as a tree of nested spans.\n\nFor example, a more complex trace might look like this:\n\n[code example]\n\nThis trace shows how the second and third spans are themselves broken down into more\ngranular operations.\n\nBy examining the sequence of spans in a trace, you can determine where an error\n(if any) occurred and how long each step took to execute. Since the information\nin each trace is recorded, you can use monitoring tools such as\n[Grafana](https://grafana.com/) to aggregate the data from many traces over time.\nThis can help you find operations that are slow on average compared to others\n(suggesting a performance bottleneck that could be optimized) or that have a high\nerror rate (suggesting a deeper problem that could be fixed to improve reliability).\n-->"
    },
    {
      "id": "metrics-overview",
      "title": "Metrics overview",
      "role": "content",
      "text": "Metrics are quantitative measurements of the behavior of your application. They\nprovide information such as how often a certain operation occurs, how long it\ntakes to complete, or how many errors have occurred. By analyzing these metrics,\nyou can identify performance bottlenecks, errors, and other issues that need to\nbe addressed.\n\nRedis clients follow the OTel push model. This uses the\n[OLTP](https://opentelemetry.io/docs/specs/otlp/) \nprotocol to send metrics to a [collector](https://opentelemetry.io/docs/collector/)\n(both [OLTP/gRPC](https://opentelemetry.io/docs/specs/otlp/#otlpgrpc) and\n[OTLP/HTTP](https://opentelemetry.io/docs/specs/otlp/#otlphttp) are supported).\nA storage layer (such as [Prometheus](https://prometheus.io/)) can then pull the\nmetrics from a collector endpoint, making the data available for monitoring tools\n(such as [Grafana](https://grafana.com/)) to query and visualize. The basic\nflow of data is shown below.\n\n[code example]\n\nThe [Redis client observability demonstration](https://github.com/redis-developer/redis-client-observability)\non GitHub contains examples showing how to set up a local Grafana instance, then\nconnect it to a Redis client and visualize the metric data as it arrives."
    },
    {
      "id": "redis-metric-groups",
      "title": "Redis metric groups",
      "role": "content",
      "text": "In Redis clients, the metrics collected by OTel are organized into the following\nmetric groups:\n\n- [`resiliency`](#group-resiliency): data related to the availability and health of the Redis connection.\n- [`connection-basic`](#group-connection-basic): minimal metrics about Redis connections made by the client.\n- [`connection-advanced`](#group-connection-advanced): more detailed metrics about Redis connections.\n- [`command`](#group-command): metrics about Redis commands executed by the client.\n- [`client-side-caching`](#group-client-side-caching): metrics about\n  [client-side caching]() operations.\n- [`streaming`](#group-streaming): metrics about\n  [stream]() operations.\n- [`pubsub`](#group-pubsub): metrics about\n  [pub/sub]() operations.\n\nWhen you configure the client to activate OTel, you can select which metric groups\nyou are interested in. By default, only the `resiliency` and `connection-basic` groups are enabled.\nThe metrics in each group are described in the\n[Metrics reference](#metrics-reference) below."
    },
    {
      "id": "metrics-reference",
      "title": "Metrics reference",
      "role": "content",
      "text": "The metric groups and the metrics they contain are described below. The\nname in parentheses after each group name is the group's identifier, which you\nuse when you configure the client to select which metrics to collect.\n\nThe metrics contain *attributes* that provide extra information (such as\nthe client library and server details) that you can use to filter and\naggregate the data. The attributes are described in the Attributes\nsection following the metric groups. The badge shown after the attribute\nname can be any of the following:\n\n- `required`: This attribute will always be present in the metrics.\n- `optional`: This attribute may be present in the metrics.\n- `conditionally required`: This attribute will be present in the metrics only if a certain condition is met,\n  such as when a specific error occurs. The condition is described in the attribute description.\n- `recommended`: Specific client libraries may not support this attribute in some situations."
    }
  ],
  "examples": [
    {
      "id": "tracing-overview-ex0",
      "language": "hierarchy",
      "code": "\"Trace\":\n    \"Span 1\":\n        _meta:\n            description: \"(Start time: 10000, End time: 10005, Status: OK)\"\n    \"Span 2\":\n        _meta:\n            description: \"(Start time: 10005, End time: 10010, Status: OK)\"",
      "section_id": "tracing-overview"
    },
    {
      "id": "tracing-overview-ex1",
      "language": "hierarchy",
      "code": "\"Trace\":\n    \"Span 1\":\n        _meta:\n            description: \"(Start time: 10000, End time: 10005, Status: OK)\"\n    \"Span 2\":\n        \"Span 2.1\":\n            _meta:\n                description: \"(Start time: 10005, End time: 10010, Status: OK)\"\n        \"Span 2.2\":\n            _meta:\n                description: \"(Start time: 10010, End time: 10015, Status: OK)\"\n    \"Span 3\":\n        \"Span 3.1\":\n            _meta:\n                description: \"(Start time: 10015, End time: 10020, Status: OK)\"\n        \"Span 3.2\":\n            _meta:\n                description: \"(Start time: 10020, End time: 10025, Status: OK)\"\n        \"Span 3.3\":\n            _meta:\n                description: \"(Start time: 10025, End time: 10030, Status: OK)\"",
      "section_id": "tracing-overview"
    },
    {
      "id": "metrics-overview-ex0",
      "language": "mermaid {width=\"100%\"}",
      "code": "sequenceDiagram\n    participant App as Redis Client\n    participant Collector as OTel Collector\n    participant Storage as Storage Layer<br/>(Prometheus)\n    participant Monitor as Monitoring Tool<br/>(Grafana)\n\n    App->>Collector: Push metrics\n    Note over App,Collector: OTel push model\n\n    Storage->>Collector: Pull metrics from endpoint\n    Collector-->>Storage: Return metrics\n\n    Monitor->>Storage: Query metrics data\n    Storage-->>Monitor: Return metrics\n    Note over Monitor: Visualize",
      "section_id": "metrics-overview"
    }
  ]
}
