Documentation
¶
Overview ¶
Package isutools is an all-in-one profiling module for ISUCON-style tuning: wrap your SQL driver, download sorted reports.
Minimal integration (1 line):
db, _ := sqlx.Open(isutools.SQLDriverName("mysql"), dsn)
SQLDriverName also starts a small admin server (default 127.0.0.1:19191, override with ISUTOOLS_ADDR, disable with ISUTOOLS_ADDR=off) serving the report UI, snapshot export, and POST /reset — the control channel for bench scripts. It intentionally runs on its own port so the application router and reverse proxy never expose it.
ISUTOOLS=off disables everything: SQLDriverName then returns the raw driver name, so the application runs unproxied with zero overhead. The on/off decision is made once at startup; it is not dynamic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTP ¶ added in v0.2.0
HTTP instruments inbound HTTP requests. When ISUTOOLS=off it returns next unchanged, avoiding request-path overhead.
func Handler ¶
Handler serves the report UI: GET / (dashboard with snapshot history), GET /snapshot.html (download), GET /json, GET /files/<name>, POST /reset, POST /collect, POST /save. Snapshot history persists to ISUTOOLS_DATA_DIR when set. The DB schema is inspected through the first DSN the application opened, using the raw driver so inspection queries never appear in the SQL statistics.
func RegisterSQL ¶
RegisterSQL wraps the named drivers ("mysql", "pgx", ...) and registers measuring variants under "<name>:isutools". Prefer SQLDriverName, which also resolves the on/off decision. No-op when disabled.
func SQLDriverName ¶
SQLDriverName registers a measuring wrapper for the named driver and returns the driver name the application should open. When disabled — or if registration fails — it returns the raw name unchanged, so measurement can never break application startup (fail-open). On success it also starts the admin server once.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package accesslog parses and aggregates explicitly configured nginx access logs.
|
Package accesslog parses and aggregates explicitly configured nginx access logs. |
|
adapters
|
|
|
chiv5
module
|
|
|
echov4
module
|
|
|
Package buildinfo resolves the git revision and dirty state of the running binary: from Go's embedded VCS stamps when available, otherwise from ldflags-injected variables or environment variables.
|
Package buildinfo resolves the git revision and dirty state of the running binary: from Go's embedded VCS stamps when available, otherwise from ldflags-injected variables or environment variables. |
|
Package dbinspect captures the database schema state (tables, row counts, indexes) so every benchmark snapshot records what indexes existed BEFORE the run.
|
Package dbinspect captures the database schema state (tables, row counts, indexes) so every benchmark snapshot records what indexes existed BEFORE the run. |
|
Package httpstats provides bounded, in-memory HTTP request measurements.
|
Package httpstats provides bounded, in-memory HTTP request measurements. |
|
internal
|
|
|
agg
Package agg is the shared aggregation core: a concurrency-safe, bounded key→latency table with log2-bucket histograms for approximate percentiles.
|
Package agg is the shared aggregation core: a concurrency-safe, bounded key→latency table with log2-bucket histograms for approximate percentiles. |
|
generation
Package generation provides atomic collector generation swaps.
|
Package generation provides atomic collector generation swaps. |
|
health
Package health records collector degradation without making failures fatal to the instrumented application.
|
Package health records collector degradation without making failures fatal to the instrumented application. |
|
sysinfo
Package sysinfo resolves static host facts (CPU model, core count, total memory, OS) shown in every report so measurements are always attributable to the hardware they ran on.
|
Package sysinfo resolves static host facts (CPU model, core count, total memory, OS) shown in every report so measurements are always attributable to the hardware they ran on. |
|
Package procstats measures per-process CPU and RSS over a reset-to-snapshot interval using Linux procfs.
|
Package procstats measures per-process CPU and RSS over a reset-to-snapshot interval using Linux procfs. |
|
Package sqlstats wraps database/sql drivers with a measuring proxy and aggregates every query into an in-memory table.
|
Package sqlstats wraps database/sql drivers with a measuring proxy and aggregates every query into an in-memory table. |
|
Package web renders isutools measurements: a live report, a self-contained downloadable snapshot.html, machine-readable JSON, and a reset endpoint.
|
Package web renders isutools measurements: a live report, a self-contained downloadable snapshot.html, machine-readable JSON, and a reset endpoint. |