autometrics-dev / autometrics-py

Easily add metrics to your code that actually help you spot and debug issues in production. Built on Prometheus and OpenTelemetry.
https://autometrics.dev
Apache License 2.0
214 stars 7 forks source link

Admin panel bookkeeping #43

Closed brettimus closed 1 year ago

brettimus commented 1 year ago

Description

This PR adds bookkeeping of every function that we decorate, so that we can expose that information to tooling if we see fit.

This is a first step to supporting something like an admin panel, as discussed in https://github.com/orgs/autometrics-dev/discussions/23

Try it out Locally

In the parent directory of autometrics-py, clone my python-autometrics-example-fastapi:

# Clone python-autometrics-example-fastapi and check out the `admin-panel` branch
git clone git@github.com:brettimus/python-autometrics-example-fastapi.git
cd python-autometrics-example-fastapi
git checkout admin-panel

# Start the app
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn fastapi-example:app --reload --port=8080

# Then, open http://localhost:8080/autometrics/admin