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

# Get latest raw metrics for a topic

> Returns the latest raw metric values (per partition / task / context) from the ClickHouse `metrics` and `metrics_qa` tables for a single topic — bypassing the materialized-view aggregation that powers the lineage / observability surfaces.

Intended for debugging discrepancies between what raw CH holds and what the UI renders. Returns one row per (metric_name, partition, task, context); the caller is responsible for aggregating across partitions if needed (sum for lag, max for latency, etc.).



## OpenAPI

````yaml /openapi/openapi.json get /topics/{topic_id}/raw-metrics
openapi: 3.1.0
info:
  title: Streamkap REST API
  description: >-
    The Streamkap REST API allows you to programmatically manage your CDC
    pipelines, sources, destinations, transforms, and more.


    Authenticate using a bearer token obtained from the [Access
    Token](/api-reference/auth/access-token) endpoint with your API client
    credentials.
  contact:
    name: Streamkap Support
    url: https://streamkap.com/
    email: support@streamkap.com
  license:
    name: Proprietary
  version: 2.0.0
servers:
  - url: https://api.streamkap.com
    description: Production
security: []
tags:
  - name: Alerts
    description: Manage alert subscribers, preferences, and notification credentials.
  - name: Authentication
    description: Obtain and refresh access tokens, manage client credentials and roles.
  - name: Billing
    description: Retrieve usage metrics, summaries, and export billing data.
  - name: Consumer Groups
    description: List, inspect, and reset Kafka consumer group offsets.
  - name: Dashboard
    description: Retrieve organisation-level statistics and overview data.
  - name: Destinations
    description: Create, configure, and manage data destinations and their lifecycle.
  - name: Kafka Access
    description: Manage Kafka users and their access permissions.
  - name: Logs
    description: Query and summarise system logs.
  - name: Pipelines
    description: Create, configure, and manage CDC pipelines and their lifecycle.
  - name: Project Keys
    description: Manage project keys that bundle API credentials and optional Kafka access.
  - name: Schema Registry
    description: Browse schema subjects, versions, and retrieve schema definitions.
  - name: Services
    description: View and switch service metadata.
  - name: Sources
    description: >-
      Create, configure, and manage data sources, snapshots, and their
      lifecycle.
  - name: Tags
    description: Create, update, and manage resource tags for organisation.
  - name: Topics
    description: Browse topic details, statistics, configurations, metrics, and messages.
  - name: Transforms
    description: >-
      Create, deploy, and manage data transforms, unit tests, and implementation
      details.
paths:
  /topics/{topic_id}/raw-metrics:
    get:
      tags:
        - Topics
      summary: Get latest raw metrics for a topic
      description: >-
        Returns the latest raw metric values (per partition / task / context)
        from the ClickHouse `metrics` and `metrics_qa` tables for a single topic
        — bypassing the materialized-view aggregation that powers the lineage /
        observability surfaces.


        Intended for debugging discrepancies between what raw CH holds and what
        the UI renders. Returns one row per (metric_name, partition, task,
        context); the caller is responsible for aggregating across partitions if
        needed (sum for lag, max for latency, etc.).
      operationId: getTopicRawMetrics
      parameters:
        - name: topic_id
          in: path
          required: true
          schema:
            type: string
            title: Topic Id
        - name: since
          in: query
          required: false
          schema:
            type: string
            description: >-
              Lookback window. Accepts '<int><unit>' where unit ∈ {s,m,h,d}.
              Defaults to 15m, capped at 3d (raw-table TTL).
            default: 15m
            title: Since
          description: >-
            Lookback window. Accepts '<int><unit>' where unit ∈ {s,m,h,d}.
            Defaults to 15m, capped at 3d (raw-table TTL).
        - name: metric_names
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Comma-separated metric_name filter. Omit to return every
              metric_name seen in the window.
            title: Metric Names
          description: >-
            Comma-separated metric_name filter. Omit to return every metric_name
            seen in the window.
        - name: include_destinations
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Include Destinations
        - name: include_qa
          in: query
          required: false
          schema:
            type: boolean
            default: true
            title: Include Qa
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TopicRawMetricsRes'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - FronteggHTTPAuthentication: []
components:
  schemas:
    TopicRawMetricsRes:
      properties:
        topic_id:
          type: string
          title: Topic Id
        since:
          type: string
          format: date-time
          title: Since
        source:
          anyOf:
            - $ref: '#/components/schemas/TopicRawConnectorMetrics'
            - type: 'null'
        destinations:
          items:
            $ref: '#/components/schemas/TopicRawDestinationMetrics'
          type: array
          title: Destinations
        qa:
          items:
            $ref: '#/components/schemas/TopicRawQaRow'
          type: array
          title: Qa
      type: object
      required:
        - topic_id
        - since
        - source
      title: TopicRawMetricsRes
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    TopicRawConnectorMetrics:
      properties:
        connector:
          type: string
          title: Connector
        ch_topic:
          type: string
          title: Ch Topic
        metrics:
          items:
            $ref: '#/components/schemas/TopicRawMetricRow'
          type: array
          title: Metrics
      type: object
      required:
        - connector
        - ch_topic
        - metrics
      title: TopicRawConnectorMetrics
    TopicRawDestinationMetrics:
      properties:
        destination_id:
          type: string
          title: Destination Id
        connector:
          type: string
          title: Connector
        ch_topic:
          type: string
          title: Ch Topic
        pipeline_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Pipeline Id
        transform_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Transform Id
        metrics:
          items:
            $ref: '#/components/schemas/TopicRawMetricRow'
          type: array
          title: Metrics
      type: object
      required:
        - destination_id
        - connector
        - ch_topic
        - metrics
      title: TopicRawDestinationMetrics
    TopicRawQaRow:
      properties:
        metric_name:
          type: string
          title: Metric Name
        connector_ctx:
          type: string
          title: Connector Ctx
        connector_id:
          type: string
          title: Connector Id
        value:
          type: number
          title: Value
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - metric_name
        - connector_ctx
        - connector_id
        - value
        - updated_at
      title: TopicRawQaRow
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    TopicRawMetricRow:
      properties:
        metric_name:
          type: string
          title: Metric Name
        partition:
          type: string
          title: Partition
        task:
          type: string
          title: Task
        context:
          type: string
          title: Context
        value:
          type: number
          title: Value
        updated_at:
          type: string
          format: date-time
          title: Updated At
      type: object
      required:
        - metric_name
        - partition
        - task
        - context
        - value
        - updated_at
      title: TopicRawMetricRow
  securitySchemes:
    FronteggHTTPAuthentication:
      type: http
      scheme: bearer

````