This demo application has two parts:
- helloworld - A simple Node.js express app
- helloworld-observe - A helloworld Node.js app instrumented with minimal Elastic Observability
-
Create an Elastic Cloud Deployment
- In Elastic Cloud, select Integrations from the top-level menu. Then click the APM integrations tile.
- Copy the Elastic APM serverUrl and save it for a later step.
- Copy the Elastic APM secretToken and save it for a later step.
-
Enable necessary Google Cloud APIs
- compute.googleapis.com
- run.googleapis.com
- containerregistry.googleapis.com
- cloudbuild.googleapis.com
-
Add required IAM roles to the Google Compute Engine Default Service Account
- Logs Viewer
- Monitoring Viewer
- Pub/Sub Subscriber
Open Google Cloud Shell and clone this repo
git clone https://github.com/elastic/observability-examples
- In Google Cloud Shell, cd to helloworld
cd gcp/run/helloworld
- Build helloworld app image and push it to Google Container Resistry
gcloud builds submit --tag gcr.io/your-project-id/elastic-helloworld
- Deploy helloworld app to Google Cloud Run
gcloud run deploy elastic-helloworld --image gcr.io/your-project-id/elastic-helloworld
- Once the app is deployed, a Service URL will be provided. Open the Service URL in a browser to see the helloworld app running.
-
In Google Cloud Shell, cd to helloworld-observe
cd gcp/run/helloworld-observe
-
Update
Dockerfile
to add the Elastic Observability APM Server URL and the APM Secret Token. Replace ELASTIC_APM_SERVER_URL and ELASTIC_APM_SECRET_TOKEN with values you copied and saved in the Setup step.ENV OTEL_EXPORTER_OTLP_ENDPOINT='ELASTIC_APM_SERVER_URL' ENV OTEL_EXPORTER_OTLP_HEADERS='Authorization=Bearer ELASTIC_APM_SECRET_TOKEN'
-
Build helloworld-observe app image and push it to Google Container Resistry
gcloud builds submit --tag gcr.io/your-project-id/elastic-helloworld
-
Deploy helloworld-observe app to Google Cloud Run
gcloud run deploy elastic-helloworld --image gcr.io/your-project-id/elastic-helloworld
-
Once the app is deployed, a Service URL will be provided. Open the Service URL in a browser to see the helloworld-observe app running.
-
Visit Elastic Cloud and open Observability to see Trace samples from the helloworld-observe app.