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:
splunk-aoCreate a Kubernetes Secret
If you’re using the standalone version of Splunk Agent Observability for the workshop, run the following command to create a Kubernetes secret, which stores the Splunk Agent Observability API key:
kubectl create secret generic splunk-ao-secret \
--from-literal=SPLUNK_AO_API_KEY="$GALILEO_API_KEY"Alternatively, if you’re using Splunk Agent Observability within Splunk Observability Cloud for this workshop, please use the following command instead:
kubectl create secret generic splunk-ao-secret \
--from-literal=SPLUNK_AO_O11Y_TOKEN="$ACCESS_TOKEN"Create a Config Map
If you’re using the standalone version of Splunk Agent Observability for the workshop, 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 splunk-ao-config \
--from-literal=SPLUNK_AO_CONSOLE_URL="$GALILEO_CONSOLE_URL" \
--from-literal=SPLUNK_AO_PROJECT="Splunk Agent Observability Workshop" \
--from-literal=SPLUNK_AO_AGENT_STREAM="$INSTANCE"Alternatively, if you’re using Splunk Agent Observability within Splunk Observability Cloud for this workshop, please use the following command instead:
kubectl create configmap splunk-ao-config \
--from-literal=SPLUNK_AO_REALM="$REALM" \
--from-literal=SPLUNK_AO_PROJECT="Splunk Agent Observability Workshop" \
--from-literal=SPLUNK_AO_AGENT_STREAM="$INSTANCE"Project and agent stream
SPLUNK_AO_PROJECT and SPLUNK_AO_AGENT_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 SPLUNK_AO_PROJECT and SPLUNK_AO_AGENT_STREAM from the splunk-ao-config config map, where will
your traces show up?
