Skip to content

Latest commit

 

History

History

cloud-trace-demo-app-opentelemetry

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

cloud-trace-demo-app-opentelemetry

Open this demo app in Google Cloud Shell. This includes necessary tools.

Open Cloud Trace Demo APP in Cloud Shell

Demo Requirements

If you are using Cloud Shell, skip to the next section.

  1. Install gcloud https://cloud.google.com/sdk/install
  2. Install kubectl https://kubernetes.io/docs/tasks/tools/install-kubectl/
  3. Install docker https://docs.docker.com/install/

Deploy and run the demo application

  1. Enable Google Cloud and set up region and zone.

    gcloud init
  2. Enable the GKE API:

    gcloud services enable container.googleapis.com
  3. Setup GCP project to YOUR_PROJECT_ID. Replace YOUR_PROJECT_ID with your GCP project id.

    gcloud config set project YOUR_PROJECT_ID
  4. Setup the location of GKE cluster and create a new cluster named cloud-trace-demo. The example below sets the cluster's location to the "us-central1-c" zone. You can replace the zone with one which you like. See zones for the full list.

    ZONE=us-central1-c
    gcloud container clusters create cloud-trace-demo \
        --zone $ZONE
  5. Update GKE cluster credentials and verify the access to the cluster:

    gcloud container clusters get-credentials cloud-trace-demo --zone $ZONE
    kubectl get nodes

    The output is similar to the following:

    NAME                                              STATUS   ROLES    AGE     VERSION
    gke-cloud-trace-demo-default-pool-43f3fe97-dnk1   Ready    <none>   5m      v1.23.8-gke.1900
    gke-cloud-trace-demo-default-pool-43f3fe97-j2b8   Ready    <none>   5m      v1.23.8-gke.1900
    gke-cloud-trace-demo-default-pool-43f3fe97-znvv   Ready    <none>   5m      v1.23.8-gke.1900
  6. Download the demo application:

    git clone https://github.com/GoogleCloudPlatform/python-docs-samples
    cd python-docs-samples/trace/cloud-trace-demo-app-opentelemetry/
  7. Setup the application:

    ./setup.sh

    The setup deployes 3 services of the demo application using a pre-built image. If you like, you can build your own container image using app/Dockerfile.

  8. Track the status of the deployment:

    kubectl get deployments

    The output is similar to the following:

    NAME                 READY   UP-TO-DATE   AVAILABLE   AGE
    cloud-trace-demo-a   1/1     1            1           3m
    cloud-trace-demo-b   1/1     1            1           3m
    cloud-trace-demo-c   1/1     1            1           3m
  9. Send a curl request to the cloud-trace-demo-a:

    curl $(kubectl get svc -o=jsonpath='{.items[?(@.metadata.name=="cloud-trace-demo-a")].status.loadBalancer.ingress[0].ip}')

    The output is similar to the following:

    Hello, I am service A
    And I am service B
    Hello, I am service C
  10. Visit Trace List to check traces generated. Click on any trace in the graph to see the Waterfall View.

    Screenshot

  11. To clean up the provisioned resources:

    gcloud container clusters delete cloud-trace-demo --zone $ZONE