Developer Guide

Instrumenting Scripts

You can also instrument code that isn't part of your application. When the X-Ray daemon is running, it will relay any segments that it receives to X-Ray, even if they are not generated by the X-Ray SDK. Scorekeep uses its own scripts to instrument the build that compiles the application during deployment.

Example bin/ – Instrumented build script

SEGMENT=$(python bin/
gradle build --quiet --stacktrace &> /var/log/gradle.log; GRADLE_RETURN=$?
if (( GRADLE_RETURN != 0 )); then 
  echo "Grade failed with exit status $GRADLE_RETURN" >&2
  python bin/ "$SEGMENT" "$(cat /var/log/gradle.log)"
  exit 1
python bin/ "$SEGMENT", and are simple Python scripts that construct segment objects, convert them to JSON documents, and send them to the daemon over UDP. If the Gradle build fails, you can find the error message by clicking on the scorekeep-build node in the X-Ray console service map.