This is an example of OpenTelemetry Go Google Cloud Functions triggerd by HTTP.
- Create a project on Google Cloud Platform
- Install
- gcloud
- docker
cd collector
# Set your project id
vi deploy.sh
./deploy.sh
cd ..
Save URL of the deployed OpenTelemetry collector.
cd greeting
# Set your project id and OpenTelemetry collector URL
vi env-greeting-1.yaml
vi env-greeting-2.yaml
# Set your project id
vi deploy.sh
./deploy.sh
- curl to greeting-1
For example,
curl https://asia-northeast1-instruments-cloud-function.cloudfunctions.net/greeting-1
- check trace by Cloud Trace UI
docker compose up
cd greeting
export OTEL_SERVICE_NAME=greeting-1
export PORT=8080
export NEXT_ENDPOINT=http://localhost:8081
FUNCTION_TARGET=Greeting LOCAL_ONLY=true go run cmd/main.go
cd greeting
export OTEL_SERVICE_NAME=greeting-2
export PORT=8081
FUNCTION_TARGET=Greeting LOCAL_ONLY=true go run cmd/main.go
curl http://localhost:8080
output is
Hiya!