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

# Get function metric aggregates

> Returns aggregate request, latency, CPU, memory, and resource-limit metrics for a function over the requested window.



## OpenAPI

````yaml /openapi/source/external/edge-compute/functions-observability.json get /compute/funcs/{id}/metric_aggregates
openapi: 3.1.0
info:
  title: Edge Compute Function Observability API
  description: >-
    Customer-facing Edge Compute function logs, metrics, deployment history, and
    ship inspection.
  version: '1.0'
  x-latency-category: responsive
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /compute/funcs/{id}/metric_aggregates:
    get:
      tags:
        - functions
      summary: Get function metric aggregates
      description: >-
        Returns aggregate request, latency, CPU, memory, and resource-limit
        metrics for a function over the requested window.
      operationId: GetComputeFunctionMetricAggregates
      parameters:
        - name: id
          in: path
          required: true
          description: Function ID
          schema:
            type: string
        - name: start_time
          in: query
          required: true
          description: Inclusive window start, UTC ISO 8601 with milliseconds
          schema:
            type: string
            format: date-time
        - name: end_time
          in: query
          required: true
          description: Exclusive window end, UTC ISO 8601 with milliseconds
          schema:
            type: string
            format: date-time
        - name: filter[edge_site]
          in: query
          required: false
          description: Edge site filter
          schema:
            type: string
        - name: filter[namespace]
          in: query
          required: false
          description: Kubernetes namespace filter
          schema:
            type: string
        - name: page[number]
          in: query
          required: false
          schema:
            type: integer
            default: 1
        - name: page[size]
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 250
            default: 20
      responses:
        '200':
          description: Metric aggregates retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FunctionMetricAggregateListResponse'
              example:
                meta:
                  total_pages: 1
                  total_results: 1
                  page_number: 1
                  page_size: 20
                data:
                  - record_type: edge_compute_function_metric_aggregate
                    product: edge_compute
                    start_time: '2026-09-08T16:00:00.000Z'
                    end_time: '2026-09-09T16:00:00.000Z'
                    function_id: 01998f0a-1111-7777-8888-123456789abc
                    function_name: my-func
                    request_count: 1250
                    request_success_rate: 0.982
                    request_client_error_rate: 0.012
                    request_error_rate: 0.006
                    request_latency_p50_ms: 8.4
                    request_latency_p95_ms: 21.7
                    request_latency_p99_ms: 44.2
                    request_latency_avg_ms: 10.1
                    cpu_used_cores_avg: 0.03
                    cpu_used_cores_max: 0.18
                    memory_used_bytes_avg: 67108864
                    memory_used_bytes_max: 94371840
        '401':
          description: Unauthorized
        '404':
          description: Function not found
        '422':
          description: Invalid function ID or query parameter
        '500':
          description: Internal server error
        '502':
          description: Metrics backend query failed
        '503':
          description: Metrics backend unavailable
        '504':
          description: Metrics backend timed out
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const response = await
            client.compute.funcs.retrieveMetricAggregates('id');


            console.log(response.meta);
        - lang: Python
          source: |
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            response = client.compute.funcs.retrieve_metric_aggregates(
                "id",
            )
            print(response.meta)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Compute.Funcs.GetMetricAggregates(\n\t\tcontext.TODO(),\n\t\t\"id\",\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    var response = client.compute().funcs().retrieveMetricAggregates("id");
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            response = telnyx.compute.funcs.retrieve_metric_aggregates("id")

            puts(response)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $response = $client->compute->funcs->retrieveMetricAggregates(
                'id',
              );

              var_dump($response);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx compute:funcs retrieve-metric-aggregates \
              --api-key 'My API Key' \
              --id id
components:
  schemas:
    FunctionMetricAggregateListResponse:
      type: object
      properties:
        meta:
          $ref: '#/components/schemas/PaginationMeta'
        data:
          type: array
          items:
            $ref: '#/components/schemas/FunctionMetricAggregate'
    PaginationMeta:
      type: object
      properties:
        total_pages:
          type: integer
        total_results:
          type: integer
        page_number:
          type: integer
        page_size:
          type: integer
    FunctionMetricAggregate:
      type: object
      properties:
        record_type:
          type: string
        product:
          type: string
        start_time:
          type: string
          format: date-time
        end_time:
          type: string
          format: date-time
        function_id:
          type: string
        function_name:
          type: string
        request_count:
          type:
            - number
            - 'null'
        request_success_rate:
          type:
            - number
            - 'null'
        request_client_error_rate:
          type:
            - number
            - 'null'
        request_error_rate:
          type:
            - number
            - 'null'
        request_latency_p50_ms:
          type:
            - number
            - 'null'
        request_latency_p95_ms:
          type:
            - number
            - 'null'
        request_latency_p99_ms:
          type:
            - number
            - 'null'
        request_latency_avg_ms:
          type:
            - number
            - 'null'
        cpu_used_cores_avg:
          type:
            - number
            - 'null'
        cpu_used_cores_max:
          type:
            - number
            - 'null'
        memory_used_bytes_avg:
          type:
            - number
            - 'null'
        memory_used_bytes_max:
          type:
            - number
            - 'null'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````