-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add readme for otlp metric sample (#1005)
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# OTLP Metric with Google Auth Example | ||
|
||
Run this sample to connect to an endpoint that is protected by GCP authentication. | ||
|
||
#### Prerequisites | ||
|
||
Get Google credentials on your machine: | ||
|
||
```sh | ||
gcloud auth application-default login | ||
``` | ||
|
||
#### Run the Sample | ||
|
||
```sh | ||
# export necessary OTEL environment variables | ||
export PROJECT_ID=<project-id> | ||
export OTEL_EXPORTER_OTLP_ENDPOINT=<endpoint> | ||
export OTEL_RESOURCE_ATTRIBUTES="gcp.project_id=$PROJECT_ID,service.name=otlp-sample,service.instance.id=1" | ||
export OTEL_EXPORTER_OTLP_HEADERS=X-Goog-User-Project=$PROJECT_ID | ||
|
||
# from the samples/otlpmetric repository | ||
cd example/metric/otlpgrpc && go run . | ||
``` |