Skip to content

cleanup: minor fixes (flag init, HTTP timeouts) - #15

Merged
dobbi84 merged 2 commits into
mainfrom
cleanup/minor-fixes
Jun 4, 2026
Merged

cleanup: minor fixes (flag init, HTTP timeouts)#15
dobbi84 merged 2 commits into
mainfrom
cleanup/minor-fixes

Conversation

@dobbi84

@dobbi84 dobbi84 commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Two small, independent cleanups, one per commit.

Commits

  1. refactor: simplify initCollectorFlags — remove the no-op collectors[name] = collector reassignment (the value is already a pointer) and the discarded disableFlag variable. The --no-collector.X flag is still registered for parsing and flag.Visit detection.
  2. fix: set read/write/idle timeouts on HTTP server — previously only ReadHeaderTimeout was set. Add ReadTimeout and IdleTimeout, plus a WriteTimeout sized generously above a normal multi-device scrape (each nvme call is bounded by the existing 30s command timeout) to avoid truncating responses.

Note

A third planned cleanup (replacing the map[string]interface{} in flattenNewStructure with a typed struct) was dropped: it triggers a lint conflict — musttag requires json tags, tagliatelle requires camelCase tags, but the keys must stay PascalCase to match what the collectors read via gjson. The existing map approach avoids all of this.

Testing

  • go build ./...
  • go vet ./...

dobbi84 added 2 commits June 4, 2026 10:47
Remove the no-op reassignment of the map entry (collector is already a
pointer) and the discarded disableFlag variable. The --no-collector.X
flag is still registered for parsing and flag.Visit detection.
Previously only ReadHeaderTimeout was set. Add ReadTimeout and
IdleTimeout to bound slow/idle connections, and a generous WriteTimeout
sized above a normal multi-device scrape.
@dobbi84
dobbi84 requested a review from LemonySnippet as a code owner June 4, 2026 08:52
@dobbi84 dobbi84 self-assigned this Jun 4, 2026
@dobbi84 dobbi84 added bug Something isn't working enhancement New feature or request go Pull requests that update go code labels Jun 4, 2026
@dobbi84
dobbi84 force-pushed the cleanup/minor-fixes branch 2 times, most recently from e536aea to 25271fd Compare June 4, 2026 08:59
@dobbi84 dobbi84 changed the title cleanup: minor fixes (flag init, HTTP timeouts, typed flatten) cleanup: minor fixes (flag init, HTTP timeouts) Jun 4, 2026
@dobbi84
dobbi84 merged commit 1012924 into main Jun 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant