Instrument the Application
Add the Splunk Agent Observability SDK and Configuration
First, add the Splunk Agent Observability SDK to the Python application. Then, add configuration so that the SDK knows where to send traces.
Add the Splunk Agent Observability package
If you open the ~/workshop/healthcare-assistant/2-app-with-instrumentation/requirements.txt
file, you’ll see that this package has already been added:
galileoNote about the SDK
galileo package. For new deployments, we recommend
using the splunk_ao package instead. Refer to the
LangChain and LangGraph
document
for details about this newer SDK.Set the Participant Number Environment Variable
Run the following command to set the PARTICIPANT_NUMBER environment variable
on your EC2 instance:
Be sure to add the participant number assigned to you in the sign-up sheet before running the following command
export PARTICIPANT_NUMBER=<your participant number> Create a Kubernetes Secret
Run the following command to create a Kubernetes secret, which stores the Splunk Agent Observability API key:
kubectl create secret generic galileo-secret \
--from-literal=GALILEO_API_KEY="$GALILEO_API_KEY"Create a Config Map
Run the following command to create a Kubernetes config map, which the application will use to determine how to send traces to Splunk Agent Observability:
kubectl create configmap galileo-config \
--from-literal=GALILEO_CONSOLE_URL="$GALILEO_CONSOLE_URL" \
--from-literal=GALILEO_PROJECT="project-$PARTICIPANT_NUMBER" \
--from-literal=GALILEO_LOG_STREAM="default"Project and agent stream
GALILEO_PROJECT and GALILEO_LOG_STREAM decide where your traces appear in the Splunk Agent Observability
console. If you leave them blank, the SDK falls back to a project and agent stream both named
default.If you remove GALILEO_PROJECT and GALILEO_LOG_STREAM from the galileo-config config map, where will
your traces show up?
