Skip to content

Commit 01c16f0

Browse files
committed
test
1 parent 464bc78 commit 01c16f0

File tree

1 file changed

+19
-2
lines changed
  • terraform/python/ec2/adot-genai

1 file changed

+19
-2
lines changed

terraform/python/ec2/adot-genai/main.tf

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ yum install -y python3.12 python3.12-pip unzip bc
7777
7878
mkdir -p /app
7979
cd /app
80-
aws s3 cp ${var.service_zip_url} langchain-service.zip
81-
unzip langchain-service.zip
80+
aws s3 cp ${var.service_zip_url} genai-service.zip
81+
unzip genai-service.zip
8282
8383
# Having issues installing dependencies from ec2-requirements.txt as these dependencies are quite large and cause timeouts/memory issues on EC2, manually installing instead
8484
python3.12 -m pip install fastapi uvicorn[standard] --no-cache-dir
@@ -98,6 +98,20 @@ export AGENT_OBSERVABILITY_ENABLED="true"
9898
9999
nohup opentelemetry-instrument python3.12 server.py > /var/log/langchain-service.log 2>&1 &
100100
101+
# Create log upload script
102+
cat > /app/upload_logs.sh << 'LOG_EOF'
103+
#!/bin/bash
104+
while true; do
105+
sleep 10
106+
if [ -f /var/log/langchain-service.log ]; then
107+
aws s3 cp /var/log/langchain-service.log s3://appsignals-genai-test/logs/${var.test_id}/langchain-service-$(date +%%Y%%m%%d-%%H%%M%%S).log
108+
fi
109+
done
110+
LOG_EOF
111+
112+
chmod +x /app/upload_logs.sh
113+
nohup /app/upload_logs.sh > /var/log/log-uploader.log 2>&1 &
114+
101115
# Wait for service to be ready
102116
echo "Waiting for service to be ready..."
103117
for i in {1..60}; do
@@ -121,12 +135,15 @@ for i in $$(seq 1 $$NUM_REQUESTS); do
121135
message="$${MESSAGES[$$((RANDOM % $${#MESSAGES[@]}))]}"
122136
echo "Request $$i: $$message"
123137
curl -X POST http://localhost:8000/ai-chat -H "Content-Type: application/json" -d "{\"message\": \"$$message\"}" -m $$TIMEOUT
138+
aws s3 cp /var/log/langchain-service.log s3://appsignals-genai-test/logs/${var.test_id}/langchain-service-request-$$i.log
124139
sleep $$DELAY_SECONDS
125140
done
126141
TRAFFIC_EOF
127142
128143
chmod +x /app/generate_traffic.sh
129144
145+
146+
130147
# Start traffic generator in background
131148
echo "Starting traffic generator..."
132149
nohup /app/generate_traffic.sh > /var/log/traffic-generator.log 2>&1 &

0 commit comments

Comments
 (0)