Skip to content

labs/common-fields: negative checks and injected faults in both tests - #143

Merged
litkhai merged 4 commits into
mainfrom
claude/common-fields-139-20f54a
Nov 7, 2026
Merged

litkhai merged 4 commits into
mainfrom
claude/common-fields-139-20f54a

Conversation

@litkhai

@litkhai litkhai commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #139

PR #140 delivered this lab but wrote Closes 139 without the #, so #139 stayed open. This PR adds what #140 left out: a negative check and an injected fault in each test, plus a date and build on every number.

Changed

  • tests/test_schema.py
    • Negative: ResourceAttributes['svc.group'] = 'g7' does not use the primary key (PK condition true, all granules), and a row without svc.* gets ''.
    • Fault: test_fault_fires drops svc_group from the logs sort key and asserts that the pruning check then fails. The test first checks that the key it edits is still in the file.
  • tests/test_collector.sh
    • Negative: an untagged log gets no svc.* key.
    • Fault: a copy of standard-fields.yaml without the "app value first" guard must fail the checks, and the script exits non-zero if that copy passes. The script first checks that the guard is still in the file.
  • README.md (English and Korean)
    • A tests table: positive, negative and injected fault for each test.
    • ClickHouse Cloud 26.8.1.608 written on every Cloud number.
    • Tests re-run dated 2026-11-07.
    • Removed the unsourced "20–30 %".
  • lab.yaml: verified_on updated to match the README.

Checked (2026-11-07)

  • python3 -m unittest discover -s labs/common-fields/tests: 5/5 tests OK on clickhouse local 26.9.6.6.
    • Also checked outside the suite: a typo in the real schema.sql ('svc.grp') made test_columns_fill fail.
  • labs/common-fields/tests/test_collector.sh on otelcol-contrib 0.155.0 (Docker): 6/6 PASS on the real file. On the faulted copy, FAIL app: its own svc.group kept; the script still exits 0, because the fault was caught.
  • check_links.py, check_syntax.sh and otel-profiles/bin/lint.sh all OK; gitleaks found no leaks.

Demo inserts in chunks. The owner's rerun on 2026-11-07 failed on the 2 M-row logs INSERT … SELECT with MEMORY_LIMIT_EXCEEDED. That limit is the service's total, maximum 6.89 GiB. managed/demo.py now runs the inserts as 16 chunks that keep number. In clickhouse local 26.9.6.6 the chunked and one-shot inserts give the same rows: 2,000,000 logs, 500,000 spans and 480,000 gauge points, with equal row hashes. The rerun's --cleanup removed the 2026-11-06 demo objects.

Managed ClickStack, 2026-11-07 (ClickHouse Cloud 26.8.1.608, Seoul; chunked demo.py: 2,000,000 logs, 500,000 spans, 480,000 gauge points). The four captures in images/ were retaken in dark mode on Claude in Chrome over the 15 minutes 12:39–12:54 KST, cropped so that no personal name and no other source shows:

  • exact ResourceAttributes.svc.group:"g7": 24,836 results, Scanned Rows 49,152
  • substring ResourceAttributes.svc.group:g7: sent as svc_group ILIKE '%g7%', Scanned Rows 49,152
  • the svc-107 error span with its 4 log lines and the common fields under Resource Attributes

Confirmed in system.query_log: the exact search's query (svc_group = 'g7', 04:18:06Z) and the substring search's (svc_group ILIKE '%g7%', 04:18:38Z) each read 49,152 rows, and count() on the window gives 24,836. The ClickStack Color Mode preference was set to Dark for the captures and back to System afterwards.

The demo was removed after the captures (demo.py --cleanup, 2026-11-07): no common_fields_demo database and no cf demo * sources are left on the Seoul service.

Cost (API list-price equivalent, khai-harness cost.py): $1.56, lead only.

🤖 Generated with Claude Code

litkhai and others added 4 commits November 7, 2026 12:42
test_schema.py: a map lookup on ResourceAttributes['svc.group'] does not use the primary key, a row
without svc.* gets '' in the columns, and test_fault_fires drops svc_group from the logs sort key
and asserts the pruning check then fails. test_collector.sh: an untagged log gets no svc.* key, and
a copy of standard-fields.yaml without the "app value first" guard must fail the checks.

README (EN/KO): the tests table, the Cloud build 26.8.1.608 on every Cloud number, tests re-run
2026-11-07 (clickhouse local 26.9.6.6, otelcol-contrib 0.155.0), and the unsourced "20-30 %" removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…memory)

The rerun on 2026-11-07 failed on the 2 M-row logs INSERT ... SELECT with MEMORY_LIMIT_EXCEEDED
(service total, maximum 6.89 GiB). The inserts now run as 16 chunks (logs 250 K, traces 125 K,
metrics 60 K rows) that keep `number`. In clickhouse local 26.9.6.6 the chunked and one-shot
inserts give the same rows: 2,000,000 / 500,000 / 480,000, equal row hashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The four screens retaken in dark mode on Managed ClickStack (ClickHouse Cloud 26.8.1.608, Seoul),
from the chunked demo.py run, 15 minutes 12:39-12:54 KST. Exact svc.group:"g7": 24,836 results,
Scanned Rows 49,152; substring svc.group:g7 is sent as svc_group ILIKE '%g7%' and scans the same
49,152; the svc-107 error span shows its 4 log lines and the common fields. README (EN/KO) and
lab.yaml carry the new count and date; the query_log check is from the 2026-11-06 run and says so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… system.query_log

Both searches' queries (svc_group = 'g7' at 04:18:06Z, svc_group ILIKE '%g7%' at 04:18:38Z) read
49,152 rows on ClickHouse Cloud 26.8.1.608; count() on 12:39-12:54 KST gives 24,836.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@litkhai
litkhai merged commit b18b0eb into main Nov 7, 2026
5 checks passed
@litkhai
litkhai deleted the claude/common-fields-139-20f54a branch November 7, 2026 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

labs/common-fields: adoption guide for the common fields (taxonomy, host, environment)

1 participant