@@ -127,6 +127,7 @@ jobs:
127127 sleep 1
128128 done
129129 echo "Store did not become ready in time" >&2
130+ docker compose -f "$COMPOSE_FILE" logs app
130131 exit 1
131132
132133 - name : Prepare artifact directory
@@ -177,6 +178,9 @@ jobs:
177178 if [ -d docker/data/prometheus ]; then
178179 tar -C docker/data -czf "$ARTIFACT_DIR/prometheus-${SCENARIO_ID}-${BACKEND_ID}.tar.gz" prometheus
179180 fi
181+ if docker compose -f "$COMPOSE_FILE" ps --format '{{.Name}}' >/dev/null 2>&1; then
182+ docker compose -f "$COMPOSE_FILE" logs app > "$ARTIFACT_DIR/docker-${SCENARIO_ID}-${BACKEND_ID}.log" || true
183+ fi
180184
181185 - name : Upload benchmark artifacts
182186 if : ${{ always() }}
@@ -185,3 +189,146 @@ jobs:
185189 name : benchmark-${{ matrix.scenario.id }}-${{ matrix.backend.id }}
186190 path : ${{ env.ARTIFACT_DIR }}
187191 if-no-files-found : error
192+
193+ micro-benchmark :
194+ name : Micro-benchmark (${{ matrix.backend.id }}, ${{ matrix.mode.display }})
195+ runs-on : ubuntu-latest
196+ timeout-minutes : 30
197+ strategy :
198+ fail-fast : false
199+ matrix :
200+ backend :
201+ - id : memory
202+ compose_file : compose.prometheus-memory-store.yml
203+ - id : mongo
204+ compose_file : compose.prometheus-mongo-store.yml
205+ mode :
206+ - id : worker
207+ display : Update worker throughput
208+ cli : worker
209+ - id : dequeue-empty
210+ display : Dequeue empty throughput
211+ cli : dequeue-empty
212+ - id : rollout
213+ display : Rollout + span throughput
214+ cli : rollout
215+ env :
216+ STORE_URL : http://localhost:4747
217+ STORE_API_URL : http://localhost:4747/v1/agl
218+ PROM_URL : http://localhost:9090
219+ BACKEND_ID : ${{ matrix.backend.id }}
220+ MODE_ID : ${{ matrix.mode.id }}
221+ ARTIFACT_DIR : artifacts/micro-${{ matrix.mode.id }}-${{ matrix.backend.id }}
222+ COMPOSE_FILE : ${{ matrix.backend.compose_file }}
223+ AGL_STORE_N_WORKERS : 8
224+ steps :
225+ - uses : actions/checkout@v4
226+
227+ - uses : astral-sh/setup-uv@v7
228+ with :
229+ enable-cache : true
230+ python-version : ' 3.12'
231+
232+ - name : Sync dependencies
233+ run : uv sync --frozen --extra mongo --group core-stable --group dev
234+
235+ - name : Reset benchmark data directories
236+ run : |
237+ set -euo pipefail
238+ cd docker
239+ rm -rf data
240+ bash setup.sh
241+
242+ - name : Launch ${{ matrix.backend.id }} Prometheus stack
243+ run : |
244+ set -euo pipefail
245+ cd docker
246+ docker compose -f "$COMPOSE_FILE" down -v || true
247+ docker compose -f "$COMPOSE_FILE" up -d --quiet-pull
248+
249+ - name : Wait for store readiness
250+ run : |
251+ set -euo pipefail
252+ for attempt in {1..60}; do
253+ if curl -fsS "$STORE_API_URL/health" >/dev/null 2>&1; then
254+ exit 0
255+ fi
256+ sleep 1
257+ done
258+ echo "Store did not become ready in time" >&2
259+ cd docker && docker compose -f "$COMPOSE_FILE" logs app
260+ exit 1
261+
262+ - name : Prepare artifact directory
263+ run : mkdir -p "$ARTIFACT_DIR"
264+
265+ - name : Record micro benchmark start
266+ run : echo "BENCHMARK_START=$(date -u +%FT%TZ)" >> "$GITHUB_ENV"
267+
268+ - name : Run ${{ matrix.mode.display }}
269+ run : |
270+ set -euo pipefail
271+ mkdir -p "$ARTIFACT_DIR"
272+ uv run --locked --no-sync python -m tests.benchmark.micro_benchmark \
273+ --store-url "$STORE_URL" \
274+ --summary-file "$ARTIFACT_DIR/summary-${MODE_ID}.txt" \
275+ "${{ matrix.mode.cli }}" | tee "$ARTIFACT_DIR/micro-${MODE_ID}.txt"
276+
277+ - name : Record micro benchmark end
278+ if : ${{ always() }}
279+ run : echo "BENCHMARK_END=$(date -u +%FT%TZ)" >> "$GITHUB_ENV"
280+
281+ - name : Run micro benchmark analysis
282+ if : ${{ always() }}
283+ run : |
284+ set -euo pipefail
285+ mkdir -p "$ARTIFACT_DIR"
286+ if [ -z "${BENCHMARK_START:-}" ] || [ -z "${BENCHMARK_END:-}" ]; then
287+ echo "Analysis skipped: benchmark window not recorded." > "$ARTIFACT_DIR/analysis-${MODE_ID}.txt"
288+ exit 1
289+ fi
290+ uv run --locked --no-sync python -m tests.benchmark.analysis \
291+ --prom-url "$PROM_URL" \
292+ --store-url "$STORE_API_URL" \
293+ --start "$BENCHMARK_START" \
294+ --end "$BENCHMARK_END" \
295+ | tee "$ARTIFACT_DIR/analysis-${MODE_ID}.txt"
296+
297+ - name : Show micro benchmark summary
298+ if : ${{ always() }}
299+ run : |
300+ set -euo pipefail
301+ summary_file="$ARTIFACT_DIR/summary-${MODE_ID}.txt"
302+ if [ -f "$summary_file" ]; then
303+ echo "Micro benchmark summary ($MODE_ID/$BACKEND_ID):"
304+ cat "$summary_file"
305+ else
306+ echo "Summary file not found: $summary_file"
307+ fi
308+
309+ - name : Stop ${{ matrix.backend.id }} Prometheus stack
310+ if : ${{ always() }}
311+ run : |
312+ set -euo pipefail
313+ cd docker
314+ docker compose -f "$COMPOSE_FILE" down -v || true
315+
316+ - name : Archive Prometheus metrics
317+ if : ${{ always() }}
318+ run : |
319+ set -euo pipefail
320+ mkdir -p "$ARTIFACT_DIR"
321+ if [ -d docker/data/prometheus ]; then
322+ tar -C docker/data -czf "$ARTIFACT_DIR/prometheus-micro-${MODE_ID}-${BACKEND_ID}.tar.gz" prometheus
323+ fi
324+ if docker compose -f "$COMPOSE_FILE" ps --format '{{.Name}}' >/dev/null 2>&1; then
325+ docker compose -f "$COMPOSE_FILE" logs app > "$ARTIFACT_DIR/docker-micro-${MODE_ID}-${BACKEND_ID}.log" || true
326+ fi
327+
328+ - name : Upload micro benchmark artifacts
329+ if : ${{ always() }}
330+ uses : actions/upload-artifact@v4
331+ with :
332+ name : micro-benchmark-${{ matrix.mode.id }}-${{ matrix.backend.id }}
333+ path : ${{ env.ARTIFACT_DIR }}
334+ if-no-files-found : error
0 commit comments