Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update instrumentation-quickstart README #694

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions samples/instrumentation-quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,26 @@ oauth2 flow (read more about the command [here][auth_command]):

gcloud auth application-default login

Set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable with `export GOOGLE_APPLICATION_CREDENTIALS="$HOME/.config/gcloud/application_default_credentials.json"`
or manually set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to a service
account key JSON file path.
> [!CAUTION]
> This method of authentication is not recommended for production environments.

Executing this command will save your application credentials to the default path which will depend on the type of machine -
- Linux, macOS: `$HOME/.config/gcloud/application_default_credentials.json`
- Windows: `%APPDATA%\gcloud\application_default_credentials.json`

Next, export the credentials to `GOOGLE_APPLICATION_CREDENTIALS` environment variable -

For Linux & MacOS:
```shell
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/.config/gcloud/application_default_credentials.json
```

For Windows:
```shell
SET GOOGLE_APPLICATION_CREDENTIALS=%APPDATA%\gcloud\application_default_credentials.json
```

You can also manually set the `GOOGLE_APPLICATION_CREDENTIALS` environment variable to point to a service account key JSON file path.

Learn more at [Setting Up Authentication for Server to Server Production Applications][ADC].

Expand All @@ -64,4 +81,11 @@ export GOOGLE_CLOUD_PROJECT=<your project id>
docker compose -f docker-compose.yaml -f docker-compose.creds.yaml up --abort-on-container-exit
```

## Viewing the results

After a successful run of the example, you can see the generated metrics in the GCP console via Metrics Explorer. The generated metrics would be present under the `Prometheus Target` resource.

Similarly, to view the generated traces in the GCP console, use the Trace Explorer.

[auth_command]: https://cloud.google.com/sdk/gcloud/reference/beta/auth/application-default/login
[ADC]: https://cloud.google.com/docs/authentication/application-default-credentials