> ## Documentation Index
> Fetch the complete documentation index at: https://www.ravion.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Query a batch of native PlanetScale module metrics

> Query native PlanetScale metrics declared on an authorized module. Credentials remain inside the broker; native database targets are resolved server-side.



## OpenAPI

````yaml https://api.ravion.com/openapi.yaml post /metrics/planetscale/query-range
openapi: 3.0.0
info:
  title: Ravion
  version: 0.0.0
servers:
  - url: https://api.ravion.com
security:
  - BearerAuth: []
tags:
  - name: Projects
  - name: Environments
  - name: FeatureFlags
  - name: Pipelines
  - name: PipelineRuns
  - name: TerraformResources
  - name: TerraformExecutionSummaries
  - name: PipelineStepExecutions
  - name: AwsCloudWatch
  - name: PipelineVersions
  - name: Organizations
  - name: Stacks
  - name: StackWorkspaces
  - name: Auth
  - name: OAuth
  - name: User
  - name: Health
  - name: Memberships
  - name: ServiceAccounts
  - name: Integrations
  - name: AwsDefaultNetworks
  - name: AwsAccounts
  - name: ApiKeys
  - name: AwsAmp
  - name: EksPrometheus
  - name: EksLoki
  - name: ExecutionEnvironments
  - name: ModuleDefinitions
  - name: ModuleCategories
  - name: ModuleVersions
  - name: ModuleInstances
  - name: DefaultValueDefinitions
  - name: DefaultValues
  - name: CodeSources
  - name: Github
  - name: GitHub Actions
  - name: Gitlab
  - name: Git
  - name: Values
  - name: Deployments
  - name: DeploymentResources
  - name: InfrastructureEvents
  - name: WebSocket
  - name: Domains
  - name: AcmCertificates
  - name: Describe
  - name: Reports
  - name: BillingPlans
  - name: BillingAccounts
  - name: BillingCycles
  - name: BillingUsageSummaries
  - name: BillingAddOns
  - name: BillingInvoices
  - name: Authorization
paths:
  /metrics/planetscale/query-range:
    post:
      summary: Query a batch of native PlanetScale module metrics
      description: >-
        Query native PlanetScale metrics declared on an authorized module.
        Credentials remain inside the broker; native database targets are
        resolved server-side.
      operationId: GetPlanetScaleMetricData
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Metrics.PlanetScaleMetricBatchRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Metrics.PlanetScaleMetricBatchResponse'
          description: The request has succeeded.
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The request is invalid or malformed.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: The server cannot find the requested resource.
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Client error
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Client error
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors.UserFacingErrorData'
          description: Server error
components:
  schemas:
    Metrics.PlanetScaleMetricBatchRequest:
      additionalProperties: false
      properties:
        end_time:
          format: date-time
          type: string
        metrics:
          items:
            $ref: '#/components/schemas/Metrics.PlanetScaleMetricSelection'
          maxItems: 64
          minItems: 1
          type: array
        moduleInstanceId:
          type: string
        period_seconds:
          format: int32
          maximum: 86400
          minimum: 1
          type: integer
        start_time:
          format: date-time
          type: string
      required:
        - start_time
        - end_time
        - period_seconds
        - moduleInstanceId
        - metrics
      type: object
    Metrics.PlanetScaleMetricBatchResponse:
      additionalProperties: false
      properties:
        metrics:
          items:
            $ref: '#/components/schemas/Metrics.PlanetScaleModuleMetricResult'
          type: array
      required:
        - metrics
      type: object
    Errors.UserFacingErrorData:
      additionalProperties: false
      description: |-
        User-facing error presentation data.
        This is what the API returns to the frontend after formatting ErrorData
        using CEL templates from the error registry.

        Used for both:
        - Error fields on domain models (e.g., PipelineRun.error)
        - API error response bodies (HTTP 4xx/5xx responses)
      properties:
        action:
          allOf:
            - $ref: '#/components/schemas/Errors.Action'
          description: Optional action to help resolve the error
        code:
          description: Full error code, e.g., "Ravion:Pipeline:NOT_FOUND"
          type: string
        description:
          description: Additional description with more details
          type: string
        details:
          description: Structured details rendered as user-facing sections.
          items:
            $ref: '#/components/schemas/Errors.UserFacingErrorDetailSection'
          type: array
        isInternal:
          description: >-
            Indicates whether this error is internal (only set when
            ShowInternal=true).

            This allows SUPERADMINs to identify internal errors while viewing
            full details.
          type: boolean
        message:
          description: Main error message (required)
          type: string
        metadata:
          additionalProperties: {}
          description: >-
            Error params/metadata. Stripped for internal errors unless
            superadmin.
          type: object
        requestId:
          description: Request ID for correlating errors with server logs.
          type: string
      required:
        - code
        - message
      type: object
    Metrics.PlanetScaleMetricSelection:
      additionalProperties: false
      properties:
        id:
          description: A metric `id` declared in the module's `ui.metrics`.
          type: string
        source:
          allOf:
            - $ref: '#/components/schemas/Module.PlanetScaleMetricSource'
          description: >-
            Which link of the metric's fallback chain to read, when several

            PlanetScale entries share `id`. It must equal one of those declared

            sources, so it selects among them and never names a new target.
            Omitted

            reads the first.
      required:
        - id
      type: object
    Metrics.PlanetScaleModuleMetricResult:
      additionalProperties: false
      description: One result per requested selection, in request order.
      properties:
        data:
          $ref: '#/components/schemas/Module.PlanetScaleMetricResult'
        id:
          type: string
        unavailable:
          type: string
      required:
        - id
      type: object
    Errors.Action:
      additionalProperties: false
      description: Action to help user resolve the error
      properties:
        label:
          description: Button/link label text
          type: string
        url:
          description: URL to navigate to for resolution
          type: string
      required:
        - label
        - url
      type: object
    Errors.UserFacingErrorDetailSection:
      additionalProperties: false
      description: Structured user-facing error detail section.
      properties:
        items:
          description: List of detail values for this section.
          items:
            type: string
          type: array
        object:
          additionalProperties: {}
          description: Structured detail payload for object rendering.
          type: object
        render:
          description: Rendering hint for clients. Valid values are list or object.
          type: string
        title:
          description: Detail section title shown in the UI.
          type: string
      required:
        - title
        - render
      type: object
    Module.PlanetScaleMetricSource:
      additionalProperties: false
      description: Native PlanetScale time-series source; no AWS credentials or endpoints.
      properties:
        branch:
          minLength: 1
          type: string
          x-templateable: true
        database:
          minLength: 1
          type: string
          x-templateable: true
        integration_id:
          minLength: 1
          type: string
          x-templateable: true
        keyspace:
          type: string
          x-templateable: true
        name:
          allOf:
            - $ref: '#/components/schemas/Module.PlanetScaleMetricName'
          x-templateable: true
        shard:
          type: string
          x-templateable: true
        type:
          enum:
            - planetscale
          type: string
          x-templateable: true
      required:
        - type
        - integration_id
        - database
        - branch
        - name
      type: object
    Module.PlanetScaleMetricResult:
      additionalProperties: false
      properties:
        name:
          $ref: '#/components/schemas/Module.PlanetScaleMetricName'
        series:
          items:
            $ref: '#/components/schemas/Module.PlanetScaleMetricSeries'
          type: array
        step_seconds:
          format: int32
          type: integer
        unavailable:
          type: string
        unit:
          type: string
      required:
        - name
        - series
        - step_seconds
        - unit
      type: object
    Module.PlanetScaleMetricName:
      enum:
        - avg_parallel_workers
        - avg_shard_queries
        - block_cache_hit_ratio
        - blocks_dirtied
        - blocks_hit
        - blocks_read
        - blocks_written
        - connections
        - cpu_duration_millis
        - egress_bytes
        - egress_bytes_per_query
        - ingress_bytes
        - ingress_bytes_per_query
        - io_duration_millis
        - latency_max
        - latency_p50
        - latency_p95
        - latency_p99
        - latency_p999
        - max_egress_bytes
        - max_ingress_bytes
        - max_shard_queries
        - planetscale_dedicated_pgbouncer_cpu_usage
        - planetscale_dedicated_pgbouncer_current_connections
        - planetscale_dedicated_pgbouncer_memory_usage
        - planetscale_edge_bytes_received
        - planetscale_edge_bytes_received_rate
        - planetscale_edge_bytes_sent
        - planetscale_edge_bytes_sent_rate
        - planetscale_neki_router_pods_container_ooms
        - planetscale_neki_router_pods_container_restarts
        - planetscale_neki_router_pods_container_waiting_reason
        - planetscale_neki_router_pods_cpu_util_percentages
        - planetscale_neki_router_pods_mem_util_percentages
        - planetscale_neki_router_pods_status_phase
        - planetscale_neki_router_queries
        - planetscale_neki_router_query_errors
        - planetscale_neki_router_query_latency_avg
        - planetscale_neki_router_query_latency_avg_by_database
        - planetscale_neki_router_query_latency_p50
        - planetscale_neki_router_query_latency_p50_by_database
        - planetscale_neki_router_query_latency_p95
        - planetscale_neki_router_query_latency_p95_by_database
        - planetscale_neki_router_query_latency_p99
        - planetscale_neki_router_query_latency_p99_by_database
        - planetscale_pgbouncer_current_connections
        - planetscale_pgbouncer_pools_client
        - planetscale_pgbouncer_pools_server
        - planetscale_pods_container_ooms
        - planetscale_pods_container_restarts
        - planetscale_pods_container_waiting_reason
        - planetscale_pods_cpu_util_percentages
        - planetscale_pods_iops_total
        - planetscale_pods_mem_util_percentages
        - planetscale_primary_memory_active_cache_bytes
        - planetscale_primary_memory_inactive_cache_bytes
        - planetscale_primary_memory_mmap_bytes
        - planetscale_primary_memory_rss_bytes
        - planetscale_primary_pgbouncer_cpu_util_percentages
        - planetscale_primary_pgbouncer_mem_util_percentages
        - planetscale_primary_pods_cpu_util_percentages
        - planetscale_primary_pods_iops_total
        - planetscale_primary_pods_mem_util_percentages
        - planetscale_primary_pods_status_phase
        - planetscale_primary_postgres_connection_state
        - planetscale_primary_postgres_locks
        - planetscale_primary_storage_usage
        - planetscale_primary_storage_usage_bytes
        - planetscale_primary_volume_usage_percentages
        - planetscale_primary_xact_commit_rate
        - planetscale_replica_lag_seconds
        - planetscale_replica_memory_active_cache_bytes
        - planetscale_replica_memory_inactive_cache_bytes
        - planetscale_replica_memory_mmap_bytes
        - planetscale_replica_memory_rss_bytes
        - planetscale_replica_pgbouncer_cpu_util_percentages
        - planetscale_replica_pgbouncer_current_connections
        - planetscale_replica_pgbouncer_mem_util_percentages
        - planetscale_replica_pods_cpu_util_percentages
        - planetscale_replica_pods_iops_total
        - planetscale_replica_pods_mem_util_percentages
        - planetscale_replica_pods_status_phase
        - planetscale_replica_postgres_connection_state
        - planetscale_replica_postgres_locks
        - planetscale_replica_storage_usage_bytes
        - planetscale_replica_volume_usage_percentages
        - planetscale_replication_slot_max_wal_retained_bytes
        - planetscale_replication_slots_lost
        - planetscale_settings_max_slot_wal_keep_size_bytes
        - planetscale_storage_usage_bytes
        - planetscale_volume_usage_percentages
        - planetscale_wal_archiver_failed_rate
        - planetscale_wal_archiver_lag_bytes
        - planetscale_wal_archiver_last_age_succeeded
        - planetscale_wal_archiver_succeeded_rate
        - planetscale_wal_size_bytes
        - queries
        - query_errors
        - rows_affected_per_query
        - rows_read
        - rows_read_per_query
        - rows_read_per_returned
        - rows_returned
        - rows_returned_per_query
        - rows_written
        - storage_per_table
        - total_duration_millis
        - traffic_control_throttled
        - traffic_control_warnings
        - violations
        - vtgate_cpu_avg_by_az
        - vtgate_cpu_by_az
        - vtgate_latency_p50
        - vtgate_latency_p95
        - vtgate_memory_avg_by_az
        - vtgate_memory_by_az
        - vtgate_requests
        - replication_lag
        - vreplication_lag
        - pod_cpu_usage
        - pod_memory_usage
        - pod_queries
        - pod_rows_read
        - pod_iops
        - pod_ooms
        - primary_cpu_usage
        - primary_memory_usage
        - primary_iops
        - primary_queries
        - primary_rows_read
        - primary_rows_written
        - shard_storage_usage
        - shard_storage_available
      type: string
    Module.PlanetScaleMetricSeries:
      additionalProperties: false
      properties:
        datapoints:
          items:
            $ref: '#/components/schemas/Module.PlanetScaleMetricPoint'
          type: array
        label:
          type: string
        labels:
          additionalProperties:
            type: string
          type: object
        name:
          type: string
      required:
        - name
        - label
        - labels
        - datapoints
      type: object
    Module.PlanetScaleMetricPoint:
      additionalProperties: false
      properties:
        timestamp:
          format: date-time
          type: string
        value:
          format: double
          nullable: true
          type: number
      required:
        - timestamp
        - value
      type: object
  securitySchemes:
    BearerAuth:
      scheme: Bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.