Skip to content

Commit aed17db

Browse files
committed
Refactor validation workflow to simplify action execution and improve error handling for trace and metric validation
1 parent 1bbe1d4 commit aed17db

1 file changed

Lines changed: 5 additions & 20 deletions

File tree

.github/workflows/validate-action-output.yml

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ jobs:
7070
echo "Collector is ready"
7171
7272
# Execute the GitHub Action which sends telemetry data to the collector
73-
- name: Test Local Action
74-
id: test-action
73+
- name: Execute Action
7574
uses: ./
7675
env:
7776
OTEL_SERVICE_NAME: github-actions-opentelemetry
@@ -85,7 +84,6 @@ jobs:
8584
echo "Waiting for file writes to complete..."
8685
sleep 5
8786
88-
# Setup normalization filters
8987
- name: Setup normalization filters
9088
run: |
9189
# Create JQ filters for normalization
@@ -111,19 +109,10 @@ jobs:
111109
del(.resourceMetrics[]?.scopeMetrics[]?.metrics[]?.gauge?.dataPoints[]?.asDouble)
112110
EOF
113111
114-
# Generate normalized files
115112
- name: Generate normalized files
116113
run: |
117-
# Create normalized files from collector output
118-
if [ -f "collector-logs/traces.json" ]; then
119-
jq -f /tmp/normalize-traces.jq collector-logs/traces.json > collector-logs/traces-actual.json
120-
echo "✓ Created actual traces file"
121-
fi
122-
123-
if [ -f "collector-logs/metrics.json" ]; then
124-
jq -f /tmp/normalize-metrics.jq collector-logs/metrics.json > collector-logs/metrics-actual.json
125-
echo "✓ Created actual metrics file"
126-
fi
114+
jq -f /tmp/normalize-traces.jq collector-logs/traces.json > collector-logs/traces-actual.json
115+
jq -f /tmp/normalize-metrics.jq collector-logs/metrics.json > collector-logs/metrics-actual.json
127116
128117
# Upload collector logs as GitHub artifact for debugging
129118
- name: Upload collector logs as artifact
@@ -137,19 +126,15 @@ jobs:
137126
- name: Validate Traces
138127
run: |
139128
diff -u collector-logs/traces-actual.json .github/test-data/${{ inputs.test-data-directory }}/traces-expected.json
140-
if [ $? -eq 0 ]; then
141-
echo "✓ Trace structure matches expected format"
142-
else
129+
if [ $? -ne 0 ]; then
143130
echo "✗ Trace structure differs from expected format"
144131
exit 1
145132
fi
146133
147134
- name: Validate Metrics
148135
run: |
149136
diff -u collector-logs/metrics-actual.json .github/test-data/${{ inputs.test-data-directory }}/metrics-expected.json
150-
if [ $? -eq 0 ]; then
151-
echo "✓ Metrics structure matches expected format"
152-
else
137+
if [ $? -ne 0 ]; then
153138
echo "✗ Metrics structure differs from expected format"
154139
exit 1
155140
fi

0 commit comments

Comments
 (0)