From df8d75a1f2e50f8ed7cadcd7ca51a1c55d519784 Mon Sep 17 00:00:00 2001 From: David Ashpole Date: Wed, 22 Jan 2025 20:18:08 -0500 Subject: [PATCH] add readme for otlp metric sample (#1005) --- example/metric/otlpgrpc/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 example/metric/otlpgrpc/README.md diff --git a/example/metric/otlpgrpc/README.md b/example/metric/otlpgrpc/README.md new file mode 100644 index 000000000..1cf14dc1b --- /dev/null +++ b/example/metric/otlpgrpc/README.md @@ -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= +export OTEL_EXPORTER_OTLP_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 . +```