Generating Reference Documentation for Metrics

This page demonstrates the generation of metrics reference documentation.

Before you begin


  • You need a machine that is running Linux or macOS.

  • You need to have these tools installed:

  • Your PATH environment variable must include the required build tools, such as the Go binary and python.

  • You need to know how to create a pull request to a GitHub repository. This involves creating your own fork of the repository. For more information, see Work from a local clone.

Clone the Kubernetes repository

The metric generation happens in the Kubernetes repository. To clone the repository, change directories to where you want the clone to exist.

Then, execute the following command:

git clone 

This creates a kubernetes folder in your current working directory.

Generate the metrics

Inside the cloned Kubernetes repository, locate the test/instrumentation/documentation directory. The metrics documentation is generated in this directory.

With each release, new metrics are added. After you run the metrics documentation generator script, copy the metrics documentation to the Kubernetes website and publish the updated metrics documentation.

To generate the latest metrics, make sure you are in the root of the cloned Kubernetes directory. Then, execute the following command:


To check for changes, execute:

git status

The output is similar to:


Copy the generated metrics documentation file to the Kubernetes website repository

  1. Set the Kubernetes website root environment variable.

    Execute the following command to set the website root:

    export WEBSITE_ROOT=<path to website root>
  2. Copy the generated metrics file to the Kubernetes website repository.

    cp ./test/instrumentation/documentation/ "${WEBSITE_ROOT}/content/en/docs/reference/instrumentation/"

Create a pull request

To create a pull request, follow the instructions in Opening a pull request.

What's next

Last modified January 22, 2024 at 10:02 AM PST: Clean up (48509eebee)