Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

NodeJS+Java sample app

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.

Prerequisites

Running

  1. Build and push the Java sample app:

    pushd ../java
    make build
    popd
    
  2. Build and push the NodeJS sample app:

    pushd ../nodejs
    make build
    make push
    popd
    
  3. Update the manifests in this directory to point to your newly-pushed images:

    make sample-replace
    
  4. Deploy the apps in your cluster:

    kubectl apply -f k8s/.
    
  5. 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.

View your Spans

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.