Skip to content

Commit

Permalink
add readme for otlp metric sample (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
dashpole authored Jan 23, 2025
1 parent 87b5a68 commit df8d75a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions example/metric/otlpgrpc/README.md
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 .
```

0 comments on commit df8d75a

Please sign in to comment.