π§ Lab 0: Environment Setup
Duration: ~15 minutes
In this lab, youβll set up your workshop environment using GitHub Codespaces and configure the necessary credentials.
π Prerequisites
Before starting, ensure you have:
- β A GitHub account
- β Dynatrace credentials (provided by your instructor)
- β Access to this workshop repository
π·οΈ Set Your Attendee ID
Before proceeding, set your Attendee ID in the sidebar (on the left side of this page). This will automatically personalize all code examples and commands throughout the workshop labs.
- Look for the βYour Attendee IDβ input field in the sidebar
- Enter your attendee ID (e.g., your name or initials like
sudosmitty) - Click Set or press Enter
π‘ Tip: Your attendee ID is stored in your browser and will persist across all lab pages. Youβll see
{YOUR_ATTENDEE_ID}placeholders replaced with your actual ID throughout the documentation.
Step 1: Launch GitHub Codespace
-
If you havenβt already, click the button below to launch your personal workshop environment:
-
Wait for the Codespace to build (this takes 2-3 minutes on first launch)
-
Once ready, youβll see VS Code in your browser with the workshop files
π‘ Important: Each attendee gets their own isolated Codespace. All your code changes stay within your Codespace and wonβt affect other workshop participants. No need to fork or create branches!
Step 2: Configure Workshop Credentials
After the Codespace starts, youβll need to configure credentials.
2.1 Run the Setup Script
In the open VS Code terminal run:
bash .devcontainer/fetch-secrets.sh
2.2 Enter Your Credentials
Youβll be prompted for:
- Attendee ID - Enter your ATTENDEE_ID (e.g.,
{YOUR_ATTENDEE_ID}) - Workshop Token - Your instructor will provide this
π Workshop Credentials Setup
Enter your attendee ID (e.g., your name or initials, no spaces) [press enter to generate]: {YOUR_ATTENDEE_ID}
β
Attendee ID: {YOUR_ATTENDEE_ID}
Enter your workshop token: *INSTRUCTOR PROVIDED*
β
Azure OpenAI credentials configured!
2.3 Load Your Credentials
You will need to load your credentials into the terminal session with the following command:
source ~/.bashrc
Then reload VS Code:
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Run: Developer: Reload Window
Step 3: Configure Dynatrace Credentials
Your Attendee ID and Azure OpenAI credentials are now configured as environment variables. You just need to add your Dynatrace credentials.
3.1 Open the Environment File
-
In the VS Code Explorer, locate and open the
.envfile in the root directory -
Youβll see it only contains placeholders for Dynatrace credentials
3.2 Add Dynatrace Credentials
Your instructor will provide the following values. Enter them in your .env file:
# Dynatrace Configuration - Get these from your instructor
DT_ENDPOINT=https://YOUR_ENV.live.dynatrace.com/api/v2/otlp
DT_API_TOKEN=dt0c01.XXXXXXXXXX.YYYYYYYYYYYYYYYY
3.3 Verify Configuration
Your complete .env file should look like this:
# Dynatrace Configuration
DT_ENDPOINT=https://abc12345.live.dynatrace.com/api/v2/otlp
DT_API_TOKEN=dt0c01.EXAMPLE_TOKEN_HERE
βΉοΈ Note: Azure OpenAI credentials and your Attendee ID are stored as environment variables (not in the
.envfile) for security.
To verify your environment variables are set, run in the terminal:
echo "Attendee: $ATTENDEE_ID"
echo "Azure OpenAI: ${AZURE_OPENAI_ENDPOINT:+configured}"
Step 3: Verify the Sample Application
Letβs make sure everything is working before we add instrumentation.
3.1 Start the Application
In your VS Code terminal, run:
python app/main.py
3.2 Expected Output
You should see output similar to:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π AI Chat Service Starting... β
β β
β Attendee ID: {YOUR_ATTENDEE_ID} β
β Service: ai-chat-service-{YOUR_ATTENDEE_ID} β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
RAG initialized successfully for attendee: {YOUR_ATTENDEE_ID}
INFO: Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
3.3 Test the Application
-
When the application starts, VS Code will show a popup about port 8000. Click βOpen in Browserβ
-
You should see the AI Chat Interface - a beautiful web UI for chatting with the AI assistant!
- Try sending a message like:
βWhat is Dynatrace?β
- You should receive an AI-generated response in the chat!
π‘ Tip: If you miss the popup, click the Ports tab in VS Code, find port 8000, and click the π globe icon.
3.4 Stop the Application
Press Ctrl+C in the terminal to stop the application.
β Checkpoint
Before proceeding to Lab 1, verify:
- Youβve set your Attendee ID in the sidebar (code examples should show your ID, not
{YOUR_ATTENDEE_ID}) - Your Codespace is running
- The
.envfile has theDT_ENDPOINTandDT_API_TOKENfrom your instructor - The sample application starts without errors
- You can access the application in your browser
- The chat endpoint responds with AI-generated text
π Troubleshooting
βAzure OpenAI credentials not foundβ
If you skipped entering the workshop token during Codespace creation:
- Get the workshop token from your instructor
- Run:
bash .devcontainer/fetch-secrets.sh - Enter the workshop token when prompted
βInvalid workshop tokenβ
- Double-check youβve entered the token correctly
- Make sure there are no extra spaces
- Ask your instructor to verify the token is correct
Missing or wrong ATTENDEE_ID
If you skipped the Attendee ID prompt or want to change it:
- Open the
.envfile - Add an
ATTENDEE_ID={YOUR_ATTENDEE_ID}line
βConnection refusedβ on port 8000
- Make sure the application is running
- Check that port 8000 is being forwarded (look in the Ports tab)
Application crashes on startup
- Check your
.envfile for typos - Ensure all dependencies are installed:
pip install -r app/requirements.txt
π Great Job!
Your environment is ready! Letβs move on to adding AI observability instrumentation.