This is a sample app consisting of a basic server written in Python. The server listens for requests which the client makes on a timed loop.
- OpenTelemetry Operator installed in your cluster
- Artifact Registry set up in your GCP project (see the main README.md)
- An
OpenTelemetryCollectorobject already created in the current namespace, such as the samplecollector-config.yamlfrom the main README - An
Instrumentationobject already created in the current namespace, such as the sampleinstrumentation.yamlfrom the main README
-
Build the sample app:
make buildThis command will also update the local manifests to refer to your image location.
-
Push the local image to the Artifact Registry you created in the setup steps (if you did not create one, or are using an already created registry, make sure to set the
REGISTRY_LOCATIONandCONTAINER_REGISTRYvariables):make push -
Deploy the app in your cluster:
kubectl apply -f k8s/.If you want to run the sample app in a specific namespace, pass
-n <your-namespace>. -
Run the following commands to patch the
appandserverdeployments for auto-instrumentation:kubectl patch deployment.apps/pythonshowcase-app -p '{"spec":{"template":{"metadata":{"annotations":{"instrumentation.opentelemetry.io/inject-python": "true"}}}}}' kubectl patch deployment.apps/pythonshowcase-service -p '{"spec":{"template":{"metadata":{"annotations":{"instrumentation.opentelemetry.io/inject-python": "true"}}}}}'These commands will use the
Instrumentationcreated 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.