-
-
Notifications
You must be signed in to change notification settings - Fork 121
7. Logging Metrics for Production
Aphrodite allows you to log metrics for production environments. We use Prometheus for scraping the metrics, and Grafana for the visualization. Look below for instructions.
To get started, launch an Aphrodite Engine API server, with the following extra commands:
--host 0.0.0.0 --disable-log-requests
If you've installed using the pre-built pip
package, then please clone the repository. Next, navigate to the monitoring example directory and launch the docker images.
cd examples/monitoring
docker compose up
Tip
If you don't have docker installed, install docker and docker compose.
You can now begin sending requests to the API server. Navigate to http://localhost:2242/metrics for raw HTML output. Now, you'll want to set up Prometheus with Grafana.
Navigate to http://localhost:9090. This should bring up the Prometheus UI. Click on the "Status" menu and select "Target". You should see an OK response to the metrics endpoint.
Caution
If it reports that the metrics endpoint is down, then follow the instructions here.
Now, navigate to http://localhost:3000. You should see the Grafana UI. You'll want to do two things: set up a Data Source (Prometheus) and configure your dashboard. Head over to http://localhost:3000/connections/datasources/new and select Prometheus. Insert http://prometheus:9090 for the URL.
Scroll all the way down and click on "Save & Test". It should return with a confirmation that it works. Now, head over to http://localhost:3000/dashboard/import. Here, type 20397
in the ID field and click on "Load". In the next page, select your Prometheus data source from the drop down menu and finally click on "Import". That should be all!