Metrics: list

Requires authorization

List all of the available metrics. Large number of metrics will be paginated, use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken. Try it now or see an example.


HTTP request



Parameter name Value Description
Path parameters
project string The project id. The value can be the numeric project ID or string-based project name.
Optional query parameters
count integer Maximum number of metrics per page. Used for pagination. If not specified, count = 100. Acceptable values are 1 to 1000, inclusive. (Default: 100)
pageToken string The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.


This request requires authorization with the following scope (read more about authentication and authorization).


Request body

Do not supply a request body with this method.


If successful, this method returns a response body with the following structure:

  "kind": "cloudmonitoring#listMetricResponse",
  "metric": [
    metrics Resource
  "totalResults": long,
  "nextPageToken": string
Property name Value Description Notes
kind string Identifies what kind of resource this is. Value: the fixed string "cloudmonitoring#listMetricResponse".
metric[] list The returned metrics.
totalResults long Total number of available metrics. Since results are paginated, some metrics might not be included in this response page.
nextPageToken string Pagination token. If present, indicates that additional results are available for retrieval. To access the results past the pagination limit, set this value to the pageToken query parameter.


Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).


Uses the Java client library.



// ...

public class MyClass {

  // ...

   * List all of the available metrics
   * @param service Client Monitoring API service instance.
   * @param projectName The name of the project to get monitoring data about.
  private static void listMetrics(Clientmonitoring service, String projectName) {
    Metrics metrics = new Metrics();

    try {
    } catch (IOException e) {

  // ...



Uses the Python client library.

body = {
    'project': projectName
    return service.metrics().list(body=body).execute()
  except errors.HttpError, error:
    print 'An error occurred: %s' % error


Uses the Ruby client library.

# List all of the available metrics
# @param [Google::APIClient] client
#   Authorized client instance.
# @param [String] project_name
#   The name of the project to get monitoring data about.

def list_metrics(client, project_name)
  cloudmonitoring = client.discovered_api('cloudmonitoring', 'v2beta1')
  result = client.execute(
    :api_method => cloudmonitoring.metrics.list,
    :body_object => { 'project' => project_name })
  if result.error?
    puts "An error occurred: #{['error']['message']}"


Uses the JavaScript client library.

gapi.client.load('cloudmonitoring', 'v2beta1', function() {
  var request = gapi.client.cloudmonitoring.metrics.list({
    'project': projectName
  request.execute(function(resp){ });

Try it!

Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Stackdriver Monitoring