1. Home
  2. ...
  3. AWS API Gateway metrics
  4. Sending AWS API Gateway metrics

Sending AWS API Gateway metrics

Step-by-step guide to send AWS API Gateway metrics to Sensedia Observability.
NOTE

This step-by-step guide is a suggested setup. You can use another way of sending the metrics that works better in your environment, as long as they arrive in the OpenTelemetry format.

This guide shows one way to send the metrics of your AWS API Gateway APIs to Sensedia Observability. After the configuration, the traffic, errors, and latency of your APIs appear on the Metrics screen within a few minutes.

NOTE

This guide covers only AWS API Gateway, in the REST API model. It does not apply to sending metrics from other sources.

How it works

The suggested setup uses only AWS managed services, in your own account. You deploy and maintain the pipeline. Sensedia provides the collection endpoint and the credential.

Component
Where it is
What it does
API GatewayYour AWS accountGenerates the metrics of your APIs
CloudWatch Metric StreamYour AWS accountStreams the metrics in
OpenTelemetry format
Amazon Data FirehoseYour AWS accountGroups the metrics into batches
Lambda forwarderYour AWS accountConverts each batch
and sends it to Sensedia
Sensedia ObservabilitySensedia platformReceives, stores, and
displays the metrics

To see who takes care of each part, check the responsibility matrix in the FAQs.

What is sent

Only metrics aggregated per minute, over HTTPS. No request payload, header, or IP address leaves your account. The behavior of your APIs does not change: the only configuration in API Gateway is enabling detailed metrics.

Prerequisites

  • Adaptive Governance Multi-gateway contracted. It is what allows the AWS API Gateway metrics to be enabled in Observability.
  • Sensedia Observability activated in your environment. See Activation.
  • AWS account with permission to create CloudWatch Metric Streams, Amazon Data Firehose delivery streams, Lambda functions, and Amazon S3 buckets.
  • APIs of the REST API type in AWS API Gateway.

Configuration

Get the collection endpoint and the credential.

The sending uses two values from your environment:

Value
What it is
OTLP_ENDPOINTIngestion URL dedicated to your environment (HTTPS)
OTLP_SECRETAccess credential
WARNING

Treat the credential as a secret. Store the value in a secrets vault, such as AWS Secrets Manager.

Enable detailed metrics on the stages.

In each stage you want to observe, go to Logs and tracing and turn on Detailed CloudWatch metrics. With the CLI or infrastructure as code, use metricsEnabled=true.

It is the detailed metrics that enable the view by method.

Build the collection pipeline in your account.

Create four resources, through the console or your infrastructure as code tool:

  • Lambda forwarder: function with a Function URL. It receives each batch from Firehose, converts it, and sends it to your collection endpoint.
  • Amazon S3 bucket: stores the batches that Firehose cannot deliver.
  • Amazon Data Firehose: delivery stream with the HTTP Endpoint destination, pointed at the Function URL of the function, and with the bucket as backup.
  • CloudWatch Metric Stream: output format opentelemetry1.0, filtered on the AWS/ApiGateway namespace, with the p50, p90, p95, and p99 latency percentiles included. The destination is the Firehose delivery stream.

The credential is sent in the sensedia-key header. Configure the two values from the first step in the function.

Validate the sending.

Call any observed API a few times and check:

  • The forwarder function logs show no sending errors.
  • The metrics appear on the Metrics screen of Sensedia Observability.
NOTE

Delivery uses a buffer. An end-to-end delay of a few minutes is expected.

After you configure

  • New APIs and stages start being sent when you enable detailed metrics on them. You do not need to change the pipeline.
  • To stop the sending, remove the pipeline resources from your account.

Known limitations

  • The sending covers only REST APIs in AWS API Gateway.
  • The metrics arrive aggregated per minute.
  • There is a delay of a few minutes between the call and the display of the metric.
  • Without detailed metrics enabled on the stage, the view by method is not available.

How happy are you with this page?

We use cookies to enhance your experience on our site. By continuing to browse, you agree to our use of cookies.Learn more