> ## Documentation index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Ask it with GET https://upstash.com/docs/ask?q=<keywords or question>. Short keywords rank best.
> Use these to discover all available pages before exploring further.
> If the product lacks a feature you need, ask for it: https://upstash.com/docs/common/help/feature-requests.md
> Tell the owner if this page helped: `POST https://upstash.com/docs/_docs7/analytics/feedback` with `Content-Type: application/json` and `{ "path": "/docs/devops/developer-api/redis/get_database_insights", "helpful": true, "comment": "…" }`. `helpful` is true or false. `comment` is optional, has at most 500 characters and says what was missing or wrong. Do not send code, secrets or personal data.

# Get Database Insights

> This endpoint returns the Insights series of a database: service latency percentiles, read, write, engine, replication, lock-wait and Lua latency, expired entries, replication lag, throughput, bandwidth and disk size, for the whole database, one replica or every region, with each series' latest window compared to the one before it, and how much the limit, security and Lua counters grew over the period. Latencies are in milliseconds. Available for databases on a Pro plan or with the Production Pack.

`GET /redis/insights/{id}`

## OpenAPI

````yaml devops/developer-api/openapi.yaml get /redis/insights/{id}
openapi: 3.0.4
info:
  title: Developer API - Upstash
  description: This is a documentation to specify Developer API endpoints based on
    the OpenAPI 3.0 specification.
  contact:
    name: Support Team
    email: support@upstash.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.0
servers:
  - url: https://api.upstash.com/v2
tags:
  - name: redis
    description: Manage redis databases.
    externalDocs:
      description: Find out more
      url: https://upstash.com/docs/devops/developer-api/introduction
  - name: teams
    description: Manage teams and team members.
    externalDocs:
      description: Find out more
      url: https://upstash.com/docs/devops/developer-api/introduction
  - name: vector
    description: Manage vector indices.
    externalDocs:
      description: Find out more
      url: https://upstash.com/docs/devops/developer-api/introduction
  - name: search
    description: Manage search indices.
    externalDocs:
      description: Find out more
      url: https://upstash.com/docs/devops/developer-api/introduction
  - name: qstash
    description: Manage QStash.
    externalDocs:
      description: Find out more
      url: https://upstash.com/docs/devops/developer-api/introduction
paths:
  /redis/insights/{id}:
    get:
      tags:
        - redis
      summary: Get Database Insights
      description: "This endpoint returns the Insights series of a database: service
        latency percentiles, read, write, engine, replication, lock-wait and Lua
        latency, expired entries, replication lag, throughput, bandwidth and
        disk size, for the whole database, one replica or every region, with
        each series' latest window compared to the one before it, and how much
        the limit, security and Lua counters grew over the period. Latencies are
        in milliseconds. Available for databases on a Pro plan or with the
        Production Pack."
      x-mint:
        href: /devops/developer-api/redis/get_database_insights
      operationId: getDatabaseInsights
      parameters:
        - name: id
          in: path
          description: The ID of the database
          required: true
          schema:
            type: string
        - name: period
          in: query
          description: "The period of the series: 1h, 3h, 12h, 1d, 3d, 7d or 30d. Defaults
            to 3h."
          required: false
          schema:
            type: string
            default: 3h
        - name: replica
          in: query
          description: Restrict the series to one replica, by the key of a group whose
            kind is replica. Other keys are rejected with 400.
          required: false
          schema:
            type: string
        - name: by
          in: query
          description: Set to region to receive one series per region next to the total.
          required: false
          schema:
            type: string
            enum:
              - region
      responses:
        "200":
          description: Database insights retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DatabaseInsights"
      security:
        - basicAuth: []
components:
  schemas:
    InsightGroup:
      type: object
      properties:
        key:
          type: string
          description: Key of the group in metrics and comparison for the all and region
            groups; pass a replica group's key as the replica parameter
        label:
          type: string
        kind:
          type: string
          enum:
            - all
            - region
            - replica
    DatabaseInsights:
      type: object
      properties:
        groups:
          type: array
          description: Every group the database has, regardless of the scope requested
          items:
            $ref: "#/components/schemas/InsightGroup"
        metrics:
          type: object
          description: "Metric name to group key to data points. The all group is always
            present; region groups are added with by=region. Metrics:
            latency_p50, latency_p90, latency_p99, read_latency_99,
            write_latency_99, command_latency_99, replication_latency_999,
            wait_latency_99, lua_latency_p50, lua_latency_99, expired_entries
            (per minute), replication_lag (entries), throughput, bandwidth
            (bytes per second) and diskusage."
          additionalProperties:
            type: object
            additionalProperties:
              type: array
              items:
                $ref: "#/components/schemas/InsightPoint"
        comparison_window:
          type: string
          description: "Length of the latest window the comparison averages: the whole
            period up to three hours, the last three hours for longer periods."
          example: 3h
        comparison:
          type: object
          description: Metric name to group key to the mean over the latest window and
            over the equal window right before it. previous is absent when that
            earlier window has no data.
          additionalProperties:
            type: object
            additionalProperties:
              type: object
              properties:
                current:
                  type: number
                previous:
                  type: number
        counters:
          type: object
          description: "Growth of each counter over the period, for the whole database:
            over_size_requests (TCP and REST), over_size_record_accesses,
            throttled_commands (writes delayed by persistence backpressure),
            undeliverable (requests and connections the proxies could not hand
            to any replica), auth_failures (TCP and REST, including commands
            sent before authenticating and REST requests over the rate limit),
            keyspace_notifications, connections_opened, bandwidth_ingress,
            bandwidth_egress (bytes), rest_commands, lua_executions,
            lua_commands (commands run inside scripts), lua_failures,
            lua_timeouts and lua_memory_limits."
          additionalProperties:
            type: object
            properties:
              total:
                type: number
              last_at:
                type: string
                format: date-time
                description: End of the last bucket the counter grew in, absent when it did not
                  grow
              series:
                type: array
                description: Growth inside each bucket of the period
                items:
                  $ref: "#/components/schemas/InsightPoint"
        anomalies:
          type: object
          description: "Metric name to up to three anomalies of its all series, largest
            first: stretches where the value stayed above both the period's
            median plus three standard deviations, estimated as 1.4826 times the
            median absolute deviation, and 30% over the median. A series with
            fewer than 8 points after its first positive value reports none. The
            median is raised to a small per-metric floor, so a nearly idle
            series does not report huge changes. An empty stretch at the start
            of the series is ignored, and a stretch longer than a third of the
            analyzed points is a level change, not an anomaly. Every metric is
            present; diskusage is never checked and always has an empty list."
          additionalProperties:
            type: array
            items:
              $ref: "#/components/schemas/InsightAnomaly"
    InsightAnomaly:
      type: object
      properties:
        start:
          type: string
          description: x of the first point above the threshold
        end:
          type: string
          description: x of the last point above the threshold
        peak:
          type: string
          description: x of the highest point
        peak_value:
          type: number
        baseline:
          type: number
          description: Typical level of the period, the median raised to the metric's floor
        change:
          type: number
          description: peak_value / baseline - 1, where 1 means +100%
    InsightPoint:
      type: object
      properties:
        x:
          type: string
          description: Timestamp of the point
        y:
          type: number
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
````
