Question

Observability for an app running in App platform with prometheus

Hi! As my app grows, I’d like to set up proper observability. Specifically, I’d like to expose some Prometheus metrics from my app running on the App platform accessible at /metrics endpoint.

I’d like to collect these metrics from all of my containers.

I’d like to run Prometheus in a droplet (but it’s not a MUST).

Is something like that possible? I didn’t find any way how to connect from a droplet to all of the containers in the app platform. I don’t mind much that the droplets and APP platform cannot share the same network as I’ll protect the /metrics with Basic Auth.

Basically, any solution that could get my metrics from /metrics from all the containers to a Prometheus would be fine.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
September 8, 2024

ey Zoltan! 👋

Setting up proper observability for your growing app is a great idea indeed! You have a few options to get Prometheus metrics from your app running on DigitalOcean App Platform.

Option 1: Use a Prometheus 1-Click Droplet

One straightforward way to get started with Prometheus is to use the Prometheus 1-Click Droplet from the DigitalOcean Marketplace. This will spin up a Droplet with Prometheus pre-configured and ready to go.

To connect Prometheus to your App Platform app:

  1. Expose the /metrics endpoint: You can make sure that your app exposes Prometheus metrics at the /metrics endpoint. You can protect this endpoint with Basic Auth as you mentioned.
  2. Configure Prometheus: On your Prometheus Droplet, update the prometheus.yml configuration file to scrape the /metrics endpoints from your App Platform containers. Although App Platform and Droplets don’t share the same private network, you can still access your App Platform services over the public internet.

Option 2: Run Prometheus on App Platform

If you prefer to keep everything within the App Platform, you can also run Prometheus directly as part of your app deployment. A great starting point is this community demo repository by circa10a, where they’ve set up Prometheus within the App Platform environment. You can customize it to suit your needs, including collecting metrics from all containers in your app.

Option 3: Native DigitalOcean Monitoring

If you’re looking for a more integrated solution without managing Prometheus yourself, consider using DigitalOcean’s native monitoring tools. This provides built-in observability features, including resource metrics like CPU, memory, and bandwidth usage directly from the App Platform dashboard. While it may not offer the granularity of custom metrics from Prometheus, it’s a hassle-free way to get visibility into your app’s performance.

Hope that this helps and good luck with setting up your observability stack! 🚀

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more