How do you monitor your application? Chances are if you're running containerized application then you are using Prometheus along with some other  visualization/dashboarding tool like Grafana, new relic or others. Prometheus is the defacto standard when it comes to monitoring your application. For containerized workloads, We basically use cadvisor to expose container metrics and Prometheus scrapes that at a fixed time interval.

Prometheus

Devtron ships with Prometheus and Grafana. You have to do some configuration in order to track your metrics.  You can expose your Prometheus and Grafana dashboard using Devtron. If you don’t have Prometheus installed as a part of the default installation, then you can configure it in the cluster/environment while setting the global configurations. If you want to access the Prometheus dashboard in order to query something, then you can port-forward.

If you want to expose your Prometheus, you can set hostname under the hosts section.

## Hostnames.
## Must be provided if Ingress is enabled.
hosts:
  - prometheus.domain.com

And similar thing you can do for Grafana, alertmanager as well. You have to update the values before triggering the deployment.

Grafana

You can install the same using the helm command line tool as well, but with Devtron we provide a dashboard, and you can see and track the progress of the release. If something goes wrong, you can see what’s going wrong and track the Kubernetes events, pod logs in the dashboard itself.

To access the Grafana dashboard, you need to port-forward devtron-grafana service.

kubectl -n devtroncd port-forward svc/devtron-grafana 3000:80 &

Go to your browser and type the URL, In my case it is localhost:3000, and you should see this. Click on the sign-in button at the left bottom corner.

You should see this the login page of Grafana.

In this case, your username is admin and you can get your password by executing the command

kubectl -n devtroncd get secret devtron-secret -o jsonpath='{.data.GRAFANA_PASSWORD}' | base64 -d

Devtron Dashboard

With the dashboard included with CI-CD Devtron gives you a complete view of your containerized workload right from the web UI.

Enabling metrics

Go to your Clusters & Environments sections and then enable metrics for application in the cluster.

Enabling metrics

Go to your Clusters & Environments sections and then enable metrics for application in the cluster.

When you will toggle it on then you need to provide Prometheus endpoint and in order to get Prometheus endpoint, you need to install it separately.

Installing Prometheus

Go to the chart store and search for Prometheus. Use the prometheus-community chart to deploy Prometheus.

During the installation of prometheus, you need to set some values.

podMonitorSelectorNilUsesHelmValues: false
grafana: 
	enabled: false
kube-state-metrics: 
	metricLabelsAllowlist:   
	- pods=[*]

Search for these and set these values as defined in the above image.

Now, after installing Prometheus, you need to get the endpoint of Prometheus server. Go to the service section of your Prometheus app and copy the Prometheus endpoint.

Go to Global Configurations > Clusters & Environments

You will be able to see the application metrics in the Devtron dashboard. I have already setup GitOps for application. Please note that you have to deploy your application in a production environment in order to see your deployment metrics.

With this you will be able to track your application metrics like resource usage, deployment metrics etc.

You can learn more about Devtron here. Feel free to join our Discord community and share your experiences or doubts.