The purpose of this sample app is to demonstrate basic use of the operator across multi-lingual microservice applications. It combines the NodeJS sample app with the Java sample service, where the NodeJS app periodically calls to the Java service.
- OpenTelemetry Operator installed in your cluster
- Artifact Registry set up in your GCP project (see the main README.md)
- An
OpenTelemetryCollector
object already created in the current namespace, such as the samplecollector-config.yaml
from the main README - An
Instrumentation
object already created in the current namespace, such as the sampleinstrumentation.yaml
from the main README
-
Build and push the Java sample app:
pushd ../java make build popd
-
Build and push the NodeJS sample app:
pushd ../nodejs make build make push popd
-
Update the manifests in this directory to point to your newly-pushed images:
make sample-replace
-
Deploy the apps in your cluster:
kubectl apply -f k8s/.
-
Run the following commands to patch the app CronJob and service Deployment for auto-instrumentation:
kubectl patch deployment.apps/nodeshowcase-app -p '{"spec":{"template":{"metadata":{"annotations":{"instrumentation.opentelemetry.io/inject-nodejs": "true"}}}}}' kubectl patch deployment.apps/javashowcase-service -p '{"spec":{"template":{"metadata":{"annotations":{"instrumentation.opentelemetry.io/inject-java": "true"}}}}}'
These commands will use the
Instrumentation
created as part of the Prerequisites.
To stream logs from the otel-collector, which will include spans from this sample application, run:
kubectl logs deployment/otel-collector -f
Alternatively, follow the cloud-trace recipe to view your spans in Google Cloud Trace.