refactor: refactor the code to be more structured and find bugs - #185
Open
tarungka wants to merge 5 commits into
Open
refactor: refactor the code to be more structured and find bugs#185tarungka wants to merge 5 commits into
tarungka wants to merge 5 commits into
Conversation
The k6 uppercase pipeline finishes per-job in microseconds, so the
wire_coordinator_job_duration_seconds histogram only ever records
queue wait — useless for measuring actual end-to-end in-system time
under realistic CPU pressure.
Add a configurable CPU-burn pipeline:
1. cpu-burn map operator (wire-worker-example/main.go) — hashes each
event's value Rounds times in a tight SHA-256 chain. Each round
feeds the previous hash back in so the compiler can't elide the
loop. Config is msgpack CPUBurnConfig{Rounds: uint32}; default
50 000 when config is empty.
2. print-cpuburn-graph helper (examples/print-cpuburn-graph/) emits a
base64 graph_bytes blob for Source → Map(cpu-burn) → Sink with CLI
flags --rounds, --events, --payload-bytes. Source events are
position-filled so the hash chain stays distinct per event.
3. Dockerfile.wire builds + installs the new binary so the compose
stack stays self-contained.
4. docker-compose.yml gains a k6-cpu profile mirroring the existing
k6 profile but using print-cpuburn-graph for the request body.
BURN_ROUNDS / BURN_EVENTS / BURN_PAYLOAD env vars tune the workload
at graph-build time. Default RPS is 2 — at 50000 rounds × 100
events × 4 task slots the worker drains ~9 jobs/sec/core, so 2 RPS
submitted keeps the queue near-empty and the histogram reflects
pure processing time.
Measured on this host:
rounds=10000 events=100 → ~95 ms/job
rounds=50000 events=100 → ~440 ms/job (default)
rounds=100000 events=100 → ~860 ms/job
rounds=500000 events=100 → ~4.3 s/job
Run with:
docker compose --profile k6-cpu run --rm k6-cpu
BURN_ROUNDS=100000 RPS=4 DURATION=3m \
docker compose --profile k6-cpu run --rm k6-cpu
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🔒 Security Scan ResultsFound 27 issues (🔴 18 high · 🟠 9 medium · 🟡 0 low). Findings
…and 2 more. Full SARIF report on the repo's Security tab. |
| } | ||
|
|
||
| func openLogFile(path string) *os.File { | ||
| f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o666) |
| } | ||
|
|
||
| func openLogFile(path string) *os.File { | ||
| f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o666) |
🔒 Security Scan ResultsFound 27 issues (🔴 18 high · 🟠 9 medium · 🟡 0 low). Findings
…and 2 more. Full SARIF report on the repo's Security tab. |
… --max-frame-size --metrics-enabled and --metrics-addr bypassed the file → flag → validate pipeline that every other operator setting uses, so they were CLI-only. Now they layer on top of YAML the same way --http-listen and friends do. - Add ObservabilityConfig (Enabled, MetricsAddr) to WireConfig. - Wire the two flags through flagToKey; defaults live in DefaultConfig. - Validate rejects enabled=true with empty metrics_addr. - Drop --max-frame-size: declared but never read by any consumer. - Six new tests cover YAML, CLI override, defaults, validation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🔒 Security Scan ResultsFound 27 issues (🔴 18 high · 🟠 9 medium · 🟡 0 low). Findings
…and 2 more. Full SARIF report on the repo's Security tab. |
🔒 Security Scan ResultsFound 27 issues (🔴 18 high · 🟠 9 medium · 🟡 0 low). Findings
…and 2 more. Full SARIF report on the repo's Security tab. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.