Skip to content

Commit 6d3af52

Browse files
zzylolclaude
andauthored
feat(asap-tools): label query sets and skew fits for cluster traces (#746)
* feat(asap-tools): add trace label and value skew analysis Add asap-tools/dataset-analysis: query sets over Google 2011, Alibaba v2022 and BOOM traces, a fetch script, and fit_skew.py, which fits a discrete Zipf theta per key query and a power-law alpha per value query, with lower/upper bounds from per-window fits. Add a CI job running its lint, type check and unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(asap-tools): add skew summary for the fetched traces Output of fit_skew.py over the data fetched by fetch_data.sh. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(asap-tools): sweep skew window lengths and refine value-alpha fits - lower/upper now span the per-window fits and the pooled fit, so lower <= mle <= upper. - Bounds are computed at several window lengths (window_lengths_s per dataset) by merging finest-window aggregates; results gain window_len_s. - Value fits use up to 100k samples and pick xmin over a 50-quantile grid (p50..p99.9, at least 100 tail values); losing fits report best_alt. - BOOM series report ok_frac and alpha over passing variates only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(asap-tools): require power law to beat both alternatives power_law_ok now needs the power law to significantly beat both the lognormal and the exponential. Otherwise best_alt names the significantly better alternative or "inconclusive". BOOM ok_frac uses the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(asap-tools): classify value tails instead of a pass/fail flag Replace power_law_ok and best_alt with tail_class (light, power_law, lognormal, heavy_inconclusive). BOOM series report the majority class, ok_frac as the share of non-light variates, and alpha and R/p medians over the non-light variates. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(asap-tools): add per-window K and row stats to skew summary K and rows were whole-sample totals repeated on every window length. Rename them to K_total/rows_total and add K_win_{min,median,max} and rows_win_{min,median,max} from the existing per-window aggregates (value queries get rows_win_* only), so the saturation study can read N and K at the sketch window and the query lookback. Write the summary with enough digits to keep row counts exact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(asap-tools): extend skew analysis to longer lookback windows Fetch and analyze a longer sample: Google task_usage/task_events parts 0-119 (about 7 days), Alibaba CallGraph/MCRRTUpdate shards 0-119 (6 h), MSMetricsUpdate 0-47 and NodeMetricsUpdate 0-1 (1 day). Drop the 30-minute clip on Alibaba tables and let a table override the dataset's window_lengths_s, so window lengths reach 6 h (CallGraph, MSRTMCR), 1 day (MSMetrics, NodeMetrics) and 7 days (Google). Joins are loaded once per table instead of once per file, so the task_events join covers all 120 parts. Regenerate results/skew_summary.csv. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(asap-tools): evaluate skew queries per step as instant and range queries Replace disjoint window lengths with Prometheus-style evaluation: every query is evaluated at each step of its table (step_s, the sampling period), in an instant form (latest sample per series, 5-minute lookback) and/or range forms (sliding window over the last S seconds). lower/upper are the min/max over evaluation times; mle pools all data. - Tables declare step_s and series_key; queries declare promql, promql_range and range (instant, 5m, 1h; CallGraph events: 1m, 5m, 1h). Google task_usage is stamped at end_time with a 5-minute step. - Range key sums use a banded sparse matrix over per-step key aggregates; value queries merge per-step uniform samples. - Instant aggregates are computed per file, with series boundary samples resolved across files; interleaved files fail loudly. - Add worst-case columns for the sketch-bench study (worst_theta_cms, worst_K, min_N, max_N, worst_alpha_rank, worst_alpha_memory) and per-query accuracy targets; cms_weight picks the counter-sketch weight. - Evaluations with no rows (trace gaps) are skipped for key and value queries alike. - Regenerate results/skew_summary.csv. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(asap-tools): add skew analysis figures Rank-frequency and CCDF plots for every query and range from the current results, with a short guide to the file names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent a8f57aa commit 6d3af52

144 files changed

Lines changed: 2715 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/python.yml‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
utilities: ${{ steps.filter.outputs.utilities }}
4040
prometheus_exporters: ${{ steps.filter.outputs.prometheus_exporters }}
4141
execution_utilities: ${{ steps.filter.outputs.execution_utilities }}
42+
dataset_analysis: ${{ steps.filter.outputs.dataset_analysis }}
4243
steps:
4344
- uses: actions/checkout@v4
4445
- uses: dorny/paths-filter@v2
@@ -57,6 +58,8 @@ jobs:
5758
execution_utilities:
5859
- 'asap-tools/execution-utilities/**'
5960
- 'asap-common/dependencies/py/**'
61+
dataset_analysis:
62+
- 'asap-tools/dataset-analysis/**'
6063
6164
test-prometheus-client:
6265
needs: detect-changes
@@ -137,6 +140,37 @@ jobs:
137140
working-directory: asap-tools/experiments
138141
run: python -m unittest discover -s tests -p 'test_*.py' -v
139142

143+
test-dataset-analysis:
144+
needs: detect-changes
145+
if: needs.detect-changes.outputs.dataset_analysis == 'true'
146+
runs-on: ubuntu-latest
147+
steps:
148+
- uses: actions/checkout@v4
149+
- name: Set up Python
150+
uses: actions/setup-python@v4
151+
with:
152+
python-version: '3.11'
153+
- name: Install dependencies
154+
run: |
155+
python -m pip install --upgrade pip
156+
pip install black==24.8.0 flake8==6.1.0 isort==5.13.2 mypy==1.14.1 types-PyYAML
157+
pip install -r asap-tools/dataset-analysis/requirements.txt
158+
- name: Check formatting with Black
159+
working-directory: asap-tools/dataset-analysis
160+
run: black --check --diff .
161+
- name: Check import sorting with isort
162+
working-directory: asap-tools/dataset-analysis
163+
run: isort --check-only --diff --settings-file .isort.cfg .
164+
- name: Lint with flake8
165+
working-directory: asap-tools/dataset-analysis
166+
run: flake8 . --config=../../.flake8 --count --show-source --statistics
167+
- name: Type check with mypy
168+
working-directory: asap-tools/dataset-analysis
169+
run: mypy . --config-file=.mypy.ini
170+
- name: Run tests
171+
working-directory: asap-tools/dataset-analysis
172+
run: python -m unittest discover -s tests -p 'test_*.py' -v
173+
140174
test-prometheus-exporters:
141175
needs: detect-changes
142176
if: needs.detect-changes.outputs.prometheus_exporters == 'true'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
out/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
profile=black
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[mypy]
2+
files = "**/*.py"
3+
ignore_missing_imports = True
4+
disable_error_code = import-untyped
Lines changed: 208 additions & 0 deletions
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
# Download the trace subsets analyzed by fit_skew.py into DATA_ROOT.
3+
# Files that already exist are skipped, so the script can be re-run to resume.
4+
set -euo pipefail
5+
6+
if [ "$#" -ne 1 ]; then
7+
echo "usage: $0 DATA_ROOT" >&2
8+
exit 1
9+
fi
10+
DATA_ROOT=$1
11+
12+
GOOGLE_URL=https://storage.googleapis.com/clusterdata-2011-2
13+
ALIBABA_URL=https://aliopentrace.oss-cn-beijing.aliyuncs.com/v2022MicroservicesTraces
14+
BOOM_URL=https://huggingface.co/datasets/Datadog/BOOM/resolve/main
15+
16+
# task_usage parts cover about 1.4 hours each; 120 parts = about 7 days.
17+
# task_events uses the same parts; job_events is read in full for job names.
18+
GOOGLE_TASK_PARTS=120
19+
GOOGLE_JOB_EVENT_PARTS=500
20+
# CallGraph and MCRRTUpdate shards cover 3 minutes each: 120 shards = 6 hours.
21+
ALIBABA_RPC_SHARDS=120
22+
# MSMetricsUpdate shards cover 30 minutes, NodeMetricsUpdate 12 hours: 1 day.
23+
ALIBABA_MS_SHARDS=48
24+
ALIBABA_NODE_SHARDS=2
25+
26+
BOOM_SERIES=(
27+
ds-2187-H ds-2394-D ds-1135-5T ds-1833-D ds-2806-D
28+
ds-2573-D ds-2222-30T ds-1914-30T ds-2577-H ds-2212-D
29+
ds-2782-H ds-1400-10S ds-2650-D ds-1316-10S ds-1558-5T
30+
ds-1972-D ds-1840-D ds-671-10S ds-1524-5T ds-899-T
31+
)
32+
BOOM_SERIES_FILES=(data-00000-of-00001.arrow dataset_info.json state.json)
33+
34+
# fetch URL DEST: download to a temp file, then rename so partial files never look complete.
35+
fetch() {
36+
local url=$1 dest=$2
37+
if [ -s "$dest" ]; then
38+
return
39+
fi
40+
mkdir -p "$(dirname "$dest")"
41+
echo "fetch $url"
42+
curl -fL --retry 5 --retry-delay 5 -C - -o "$dest.part" "$url"
43+
mv "$dest.part" "$dest"
44+
}
45+
46+
google_part() {
47+
printf 'part-%05d-of-00500.csv.gz' "$1"
48+
}
49+
50+
G=$DATA_ROOT/google-2011
51+
fetch "$GOOGLE_URL/schema.csv" "$G/schema.csv"
52+
for ((i = 0; i < GOOGLE_TASK_PARTS; i++)); do
53+
for t in task_usage task_events; do
54+
fetch "$GOOGLE_URL/$t/$(google_part "$i")" "$G/$t/$(google_part "$i")"
55+
done
56+
done
57+
for ((i = 0; i < GOOGLE_JOB_EVENT_PARTS; i++)); do
58+
fetch "$GOOGLE_URL/job_events/$(google_part "$i")" "$G/job_events/$(google_part "$i")"
59+
done
60+
61+
A=$DATA_ROOT/alibaba-v2022
62+
for ((i = 0; i < ALIBABA_NODE_SHARDS; i++)); do
63+
fetch "$ALIBABA_URL/NodeMetricsUpdate/NodeMetricsUpdate_$i.tar.gz" "$A/NodeMetricsUpdate_$i.tar.gz"
64+
done
65+
for ((i = 0; i < ALIBABA_MS_SHARDS; i++)); do
66+
fetch "$ALIBABA_URL/MSMetricsUpdate/MSMetricsUpdate_$i.tar.gz" "$A/MSMetricsUpdate_$i.tar.gz"
67+
done
68+
for ((i = 0; i < ALIBABA_RPC_SHARDS; i++)); do
69+
fetch "$ALIBABA_URL/CallGraph/CallGraph_$i.tar.gz" "$A/CallGraph_$i.tar.gz"
70+
fetch "$ALIBABA_URL/MCRRTUpdate/MCRRTUpdate_$i.tar.gz" "$A/MCRRTUpdate_$i.tar.gz"
71+
done
72+
73+
B=$DATA_ROOT/boom
74+
fetch "$BOOM_URL/dataset_taxonomy.json" "$B/dataset_taxonomy.json"
75+
for series in "${BOOM_SERIES[@]}"; do
76+
for f in "${BOOM_SERIES_FILES[@]}"; do
77+
fetch "$BOOM_URL/$series/$f" "$B/$series/$f"
78+
done
79+
done
Lines changed: 12 additions & 0 deletions
44.9 KB
45.9 KB
45.4 KB

0 commit comments

Comments
 (0)