Skip to content

Commit 955f628

Browse files
committed
test
1 parent 715270f commit 955f628

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

.github/workflows/python-ec2-genesis-test.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,19 @@ jobs:
4040
- name: Generate testing id
4141
run: echo TESTING_ID="${{ github.run_id }}-${{ github.run_number }}-${RANDOM}" >> $GITHUB_ENV
4242

43-
- name: Generate XRay and W3C trace ID
43+
- name: Generate XRay and W3C trace ID and baggage
4444
run: |
4545
ID_1="$(printf '%08x' $(date +%s))"
4646
ID_2="$(openssl rand -hex 12)"
4747
W3C_TRACE_ID="${ID_1}${ID_2}"
4848
XRAY_TRACE_ID="1-${ID_1}-${ID_2}"
49+
BAGGAGE="test_session_$(openssl rand -hex 4)"
4950
echo "XRAY_TRACE_ID=${XRAY_TRACE_ID}" >> $GITHUB_ENV
5051
echo "W3C_TRACE_ID=${W3C_TRACE_ID}" >> $GITHUB_ENV
52+
echo "BAGGAGE=${BAGGAGE}" >> $GITHUB_ENV
5153
echo "Generated XRay Trace ID: ${XRAY_TRACE_ID}"
52-
echo "Generated W3C Trace ID: ${XRAY_TRACE_ID}"
54+
echo "Generated W3C Trace ID: ${W3C_TRACE_ID}"
55+
echo "Generated Baggage: ${BAGGAGE}"
5356
5457
- name: Configure AWS Credentials
5558
uses: aws-actions/configure-aws-credentials@v4
@@ -112,6 +115,7 @@ jobs:
112115
export DELAY_SECONDS="5"
113116
export TIMEOUT="30"
114117
export TRACE_ID="Root=${XRAY_TRACE_ID};Parent=$(openssl rand -hex 8);Sampled=1"
118+
export BAGGAGE="${{ env.BAGGAGE }}"
115119
./generate_traffic.sh
116120
117121
- name: Validate generated logs
@@ -141,10 +145,11 @@ jobs:
141145
--testing-id ${{ env.TESTING_ID }}
142146
--endpoint http://${{ env.INSTANCE_IP }}:8000
143147
--region ${{ env.E2E_TEST_AWS_REGION }}
144-
--account-id ${{ env.E2E_TEST_ACCOUNT_ID }}
148+
--metric-namespace ${{ env.METRIC_NAMESPACE }}
149+
--log-group aws/spans
145150
--service-name langchain-traceloop-app
146151
--instance-id ${{ env.INSTANCE_ID }}
147-
--trace-id ${{ env.XRAY_TRACE_ID }}'
152+
--trace-id ${{ env.W3C_TRACE_ID }}'
148153

149154
- name: Cleanup
150155
if: always()

sample-apps/traffic-generator/langchain/generate_traffic.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,16 @@ send_request() {
4242
echo "Message: \"$message\""
4343

4444
# Use environment variables or defaults for headers
45+
local baggage_header="${BAGGAGE:-session.id=test_session}"
4546
local trace_id_header="${TRACE_ID:-Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8;Sampled=1}"
4647

48+
echo "Using Baggage: $baggage_header"
4749
echo "Using Trace ID: $trace_id_header"
4850

4951
# Send request with timeout
5052
response=$(curl -s -X POST "$ENDPOINT" \
5153
-H "Content-Type: application/json" \
54+
-H "baggage: $baggage_header" \
5255
-H "X-Amzn-Trace-Id: $trace_id_header" \
5356
-d "{\"message\": \"$message\"}" \
5457
-m "$TIMEOUT" \

validator/src/main/java/com/amazon/aoc/App.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,9 @@ public class App implements Callable<Integer> {
160160
@CommandLine.Option(names = {"--trace-id"})
161161
private String traceId;
162162

163+
@CommandLine.Option(names = {"--baggage"})
164+
private String baggage;
165+
163166
private static final String TEST_CASE_DIM_KEY = "testcase";
164167
private static final String CANARY_NAMESPACE = "Otel/Canary";
165168
private static final String CANARY_METRIC_NAME = "Success";
@@ -200,6 +203,7 @@ public Integer call() throws Exception {
200203
context.setInstanceId(this.instanceId);
201204
context.setPrivateDnsName(this.privateDnsName);
202205
context.setTraceId(this.traceId);
206+
context.setBaggage(this.baggage);
203207

204208
log.info(context);
205209

validator/src/main/java/com/amazon/aoc/models/Context.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class Context {
6969

7070
private String traceId;
7171

72+
private String baggage;
73+
7274
private ECSContext ecsContext;
7375

7476
private CloudWatchContext cloudWatchContext;

validator/src/main/java/com/amazon/aoc/validators/TraceValidator.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,6 @@ private Map<String, Object> getTrace() throws Exception {
150150

151151
if (validationConfig.getHttpPath().contains("chat")) {
152152
traceFilter = String.format("service(\"%s\")", context.getServiceName());
153-
if (context.getTraceId() != null) {
154-
traceFilter += String.format(" AND id(\"%s\")", context.getTraceId());
155-
}
156153
}
157154
log.info("Trace Filter: {}", traceFilter);
158155
List<TraceSummary> retrieveTraceLists = xrayService.searchTraces(traceFilter);
Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
[{
2-
"name": "^{{serviceName}}$",
3-
"trace_id": "^{{traceId}}$",
4-
"http": {
5-
"request": {
6-
"url": "^.*/chat$",
7-
"method": "^POST$"
2+
"resource": {
3+
"attributes": {
4+
"aws.local.service": "{{serviceName}}",
5+
"aws.service.type": "gen_ai_agent",
6+
"service.name": "{{serviceName}}"
87
}
98
},
10-
"aws": {
11-
"service.type": "^gen_ai_agent$"
9+
"attributes": {
10+
"session.id": "{{baggage}}"
1211
},
13-
"annotations": {
14-
"aws.local.service": "^{{serviceName}}$",
15-
"aws.local.operation": "^POST /chat$"
16-
},
17-
"metadata": {
18-
"default": {
19-
"service.name": "^{{serviceName}}$"
20-
}
21-
}
12+
"traceId": "{{traceId}}"
2213
}]

0 commit comments

Comments
 (0)