Giter VIP home page Giter VIP logo

autometrics-demo-python-fastapi-animals's Introduction

Autometrics ❤️ FastAPI

An example fastapi app that makes use of autometrics.

Setup

Running the app

Create and activate a virtual env

python3 -m venv .venv
source .venv/bin/activate

Install dependencies

pip install -r requirements.txt

Run the app

uvicorn app:app --reload --port=8080

Optionally generate traffic for all the api routes

chmod +x generate-traffic.sh
./generate-traffic.sh

Setting up local Prometheus

Skip this if you already have Prometheus set up locally

With am

You can use the am CLI to quickly spin up Prometheus and the Autometrics Explorer dashboard:

# Install the Autometrics cli
brew install autometrics-dev/tap/am
# Start scraping localhost:8080
am start :8080

You can also run the CLI via docker:

docker run \
  --network host
  -e LISTEN_ADDRESS=0.0.0.0:6789 \
  -p 6789:6789 \
  -p 9090:9090 \
  autometrics/am start :8080

Install and Configure the Autometrics VSCode Extension

Update the VSCode Extension settings to use the url to your local Prometheus server. Since we're using am to run prometheus, we need to update the settings:

{
  "autometrics.prometheusUrl": "http://localhost:9090/prometheus"
}

Generating Data

There is a script in the root of the repo that can be executed to generate data inside Prometheus. See: generate-traffic.sh

You can copy-paste the script into a shell, or execute it directly from the repo.

autometrics-demo-python-fastapi-animals's People

Contributors

brettimus avatar gagbo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.