@@ -86,11 +86,7 @@ npm install
8686npm install express @langchain/community @langchain/core @traceloop/node-server-sdk pino
8787
8888# Download and install ADOT instrumentation
89- echo "Installing ADOT instrumentation..."
9089${ var . get_adot_wheel_command }
91- echo "ADOT installation completed"
92- echo "Checking installed packages:"
93- npm list --depth=0
9490
9591export AWS_REGION=${ var . aws_region }
9692export OTEL_EXPORTER_OTLP_LOGS_HEADERS="x-aws-log-group=test/genesis,x-aws-log-stream=default,x-aws-metric-namespace=genesis"
@@ -99,50 +95,28 @@ export AGENT_OBSERVABILITY_ENABLED="true"
9995
10096# Run the genai service from the genai-service directory
10197cd /app/genai-service
102- echo "Starting Node.js service..."
103- echo "Current directory: $(pwd)"
104- echo "Files in directory:"
105- ls -la
106- echo "Checking if ADOT module exists:"
107- node -e "try { require('@aws/aws-distro-opentelemetry-node-autoinstrumentation/register'); console.log('ADOT module found'); } catch(e) { console.log('ADOT module not found:', e.message); }"
108- echo "Starting service with ADOT instrumentation:"
10998nohup node --require '@aws/aws-distro-opentelemetry-node-autoinstrumentation/register' --require ./customInstrumentation.js index.js > /var/log/langchain-service.log 2>&1 &
110- echo "Service started with PID: $!"
11199
112100# Wait for service to be ready
113- echo "Waiting for service to be ready..."
114- for i in {1..10}; do
101+ for i in {1..60}; do
115102 if curl -s http://localhost:8000/health > /dev/null 2>&1; then
116- echo "Service is ready!"
117103 break
118104 fi
119- echo "Attempt $i: Service not ready, waiting 5 seconds..."
120- echo "Checking service logs:"
121- tail -5 /var/log/langchain-service.log
122105 sleep 5
123106done
124107
125108# Generate traffic directly
126- echo "Starting traffic generator..."
127109nohup bash -c '
128110for i in {1..5}; do
129111 message="What is the weather like today?"
130- echo "[$(date)] Request $i: $message"
131112 curl -s -X POST http://localhost:8000/ai-chat \
132113 -H "Content-Type: application/json" \
133114 -H "X-Amzn-Trace-Id: ${ var . trace_id } " \
134115 -d "{\"message\": \"$message\"}" \
135- -m 30 \
136- echo "Request $i completed"
116+ -m 30 > /dev/null 2>&1
137117 sleep 10
138118done
139- echo "Traffic generator completed"
140- ' > /var/log/traffic-generator.log 2>&1 &
141-
142- # Upload cloud-init logs to S3
143- aws s3 cp /var/log/cloud-init.log s3://adot-genai-js-test/cloud-init-logs/${ var . test_id } /cloud-init.log
144- aws s3 cp /var/log/cloud-init-output.log s3://adot-genai-js-test/cloud-init-logs/${ var . test_id } /cloud-init-output.log
145-
119+ ' > /dev/null 2>&1 &
146120EOF
147121 )
148122
0 commit comments