Observability Best Practices when running FastAPI in a Lambda

This page summarizes the projects mentioned and recommended in the original post on dev.to

Scout Monitoring - Free Django app performance insights with Scout Monitoring
Get Scout setup in minutes, and let us sweat the small stuff. A couple lines in settings.py is all you need to start monitoring your apps. Sign up for our free tier today.
www.scoutapm.com
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • aws-recipes

  • The required files to follow along in this example are available on GitHub, or here on my blog.

  • starlette

    The little ASGI framework that shines. 🌟

  • Further information on FastAPI GitHub Issue and Starlette GitHub Issue:

  • Scout Monitoring

    Free Django app performance insights with Scout Monitoring. Get Scout setup in minutes, and let us sweat the small stuff. A couple lines in settings.py is all you need to start monitoring your apps. Sign up for our free tier today.

    Scout Monitoring logo
  • mangum

    AWS Lambda support for ASGI applications

  • But we do not have a handler function, do we? We have a Mangum object wrapping the FastAPI application. Luckily, the Mangum object acts as a handler function, so we can just add the following in example/src/app/__init__.py:

  • aws-embedded-metrics-node

    Amazon CloudWatch Embedded Metric Format Client Library

  • Let's explore the next core utility in Lambda Powertools, the Metrics utility. This utility lets you easily push metrics to CloudWatch by taking care of all the necessary boilerplate. It works asynchronously by using Amazon CloudWatch Embedded Metrics Format, by logging the metrics to stdout. It also aggregates all metrics from each invocation to save on the number of calls to CloudWatch.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Why the Serverless Revolution Has Stalled

    1 project | news.ycombinator.com | 15 Feb 2024
  • Building Fast APIs with FastAPI: A Comprehensive Guide

    3 projects | dev.to | 28 Dec 2023
  • Writing a chat application in Django 4.2 using async StreamingHttpResponse

    4 projects | news.ycombinator.com | 16 Jun 2023
  • Deploying an ML model to Paperspace and creating an API

    1 project | dev.to | 6 May 2023
  • FastAPI middleware doesn't run while making request to websocket endpoint

    1 project | /r/FastAPI | 4 May 2023