Skip to content

7. Logging Metrics for Production

AlpinDale edited this page Feb 3, 2024 · 3 revisions

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.

image

Launch Aphrodite Server

To get started, launch an Aphrodite Engine API server, with the following extra commands:

--host 0.0.0.0 --disable-log-requests

Launch Docker Containers

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.

Set up Prometheus + 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.

image

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!