Monitoring Client Libraries

This page shows how to get started with the Cloud Client Libraries for the
Stackdriver Monitoring API. Read more about the client
libraries for Cloud APIs, including the older Google APIs Client Libraries, in
Client Libraries Explained.

Beta

This is
a beta
release of the Cloud Client Libraries for the Stackdriver Monitoring API.
These libraries
might be changed in backward-incompatible ways
and
are not
subject to any SLA or deprecation policy.

Ruby

Setting up authentication

To run the client library, you must first set up authentication by creating a
service account and setting an environment variable. Complete the following
steps to set up authentication. For more information, see
the GCP authentication documentation
.

Note: The Role field authorizes your service account
to access resources. You can view and change this field later by using
GCP Console. If you are
developing a production app, specify more granular
permissions than Project > Owner. For more information, see
granting roles to service accounts.

Note: The Role field authorizes your service account
to access resources. You can view and change this field later by using
GCP Console. If you are
developing a production app, specify more granular
permissions than Project > Owner. For more information, see
granting roles to service accounts.

Generate the key file. Replace [FILE_NAME] with a name for
the key file.

Provide authentication credentials to your application code by
setting the environment variable GOOGLE_APPLICATION_CREDENTIALS.
Replace [PATH] with the file path of the JSON file that contains your
service account key, and [FILE_NAME] with the
filename. This variable only applies to your current shell session, so if you
open a new session, set the variable again.