Monitor Bitbucket with Prometheus and Grafana

On this page

Still need help?

The Atlassian Community is here for you.

Ask the community

This section will guide you through how to install and connect Prometheus and Grafana. This is optional, but may be useful if you don’t already have an APM solution, or would like to use our templates and sample queries.

Use Prometheus to monitor app performance metrics

To set up Prometheus to monitor app metrics:

  1. Download and install Prometheus.
    For installation options and detailed instructions see the Prometheus documentation.

  2. Edit the prometheus.yaml file and add the following scrape configuration to the bottom of the file.

    # A scrape configuration containing exactly one endpoint to scrape:
      - job_name: 'Bitbucket app metrics'
        scheme: http
        metrics_path: '/metrics'
         - targets: ["<jmx-exporter-host>:<port>"]

    • The target is the JMX exporter, not Bitbucket. For example - targets: ["localhost:8060"]

    • If you deploy Prometheus in Kubernetes, you’ll need to use a pipe to indicate the multi-line YAML string, as in the example below.

      extraScrapeConfigs: |
        - job_name: 'Bitbucket app metrics'
          scheme: http
          metrics_path: '/metrics'
           - targets: [""]
    • See Configuration in the Prometheus documentation for more configuration options.

  3. Start Prometheus. How you do this will depend on the way you run Prometheus.

  4. Access the Prometheus UI at http://localhost:9090.

  5. Go to Status > Targets to check that Prometheus is successfully connected to the JMX exporter.

Perform a simple query

You can confirm that Prometheus is receiving app metrics with a simple test.

Go to Manage apps and temporarily disable an app (such as the Bitbucket Migration Assistant, don’t disable anything that will interrupt your users).

In Prometheus, run the following query:


This will return the number of times an app has been disabled since monitoring was turned on.

Use Grafana to visualize metrics

While you can use Prometheus to create graphs of your data, if you want to take it to the next level, you can use a tool like Grafana to create more detailed charts and dashboards.

To get you started, we’ve created some sample dashboards which track several important metrics. You can access the JSON for these dashboards in our App monitoring dashboards repo.

To set up Grafana and import the sample dashboard:

  1. Download and install Grafana.
    For installation options and detailed instructions see the Grafana documentation.

  2. Create a Prometheus data source in Grafana.
    For detailed instructions see the Prometheus documentation.

  3. Select Create (+) > Import

  4. Paste the JSON sample provided into the Import via panel json field. Remember to update the Unique identifier(only required if you already have a dashboard with the same ID).

  5. Select Load.

Here's an example dashboard. 

Last modified on Oct 4, 2022

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.