Skip to content

Refactor/v0.2.0 best practices#3

Merged
arvarik merged 22 commits intomainfrom
refactor/v0.2.0-best-practices
Feb 23, 2026
Merged

Refactor/v0.2.0 best practices#3
arvarik merged 22 commits intomainfrom
refactor/v0.2.0-best-practices

Conversation

@arvarik
Copy link
Owner

@arvarik arvarik commented Feb 23, 2026

Updating dashboard to include new stats and displaying onto dashboard

image

- Add .golangci.yml with curated linter set (gosec, misspell, prealloc, gocritic)
- Add internal/version package with ldflags-injected Version/Commit/BuildDate
- Add unit tests: config (6), retry (4), writers (5) — 15 total
- Makefile: ldflags injection, test/version targets, -race flag
- Dockerfile: pin Alpine 3.21, build ARGs for version, strip flags
- CI: add go test -race step
- auth.go: unexport SessionFile, add os.MkdirAll in saveSession
- main.go: add signal.Stop(), log version at startup
- retry.go: use structured slog args
- Pre-commit: add go vet before lint
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the eero-stats daemon toward a more production-ready v0.2.0 setup: tiered polling with structured writers, build-time version metadata, improved CI/dev tooling, and a regenerated Grafana dashboard.

Changes:

  • Implemented tiered polling (fast/medium/slow) with new InfluxDB writer functions and retry logic (+ tests).
  • Added build/version metadata plumbing (Go internal/version, Makefile ldflags, Dockerfile build args) and improved operational boot/shutdown logging.
  • Replaced the previous Grafana dashboard with a generated “Eero Network Telemetry” dashboard + generator script; updated docs and tooling (CI, golangci-lint config, pre-commit hook).

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
internal/poller/poller.go Refactors polling loop into fast/medium/slow tiers with panic-safe wrappers.
internal/poller/writers.go Adds InfluxDB measurements/tags/fields for devices, nodes, network health/config, profiles.
internal/poller/retry.go + *_test.go Adds exponential backoff retry helper with unit tests.
internal/auth/auth.go Improves session caching behavior (mkdir, error handling) and clarifies path handling.
internal/db/influx.go Documents and configures aggressive batching; adds Shutdown API (context parameter).
scripts/build_dashboard.py New dashboard generator producing Grafana JSON with Flux queries and panels.
grafana/dashboards/eero.json New provisioned dashboard JSON (generated).
grafana/dashboards/eero-overview.json Removes old dashboard.
internal/version/version.go Adds build-time version/commit/date variables for ldflags injection.
cmd/eero-stats/main.go Logs version metadata; improves graceful shutdown and Influx shutdown helper.
README.md Updates architecture, setup instructions, and new dashboard positioning.
Makefile / Dockerfile Adds ldflags/versioning, tests target, dashboard target; pins Alpine runtime.
.github/workflows/ci.yml / .golangci.yml / .githooks/pre-commit Tightens CI checks, lint config, and local pre-commit verification.
.dockerignore Adds ignores for local data and env files.
Comments suppressed due to low confidence (1)

internal/db/influx.go:56

  • Shutdown accepts a context and the comment states it can be used for timeout control, but the implementation ignores ctx. Either remove the context parameter/comment, or honor ctx (e.g., by running Flush/Close in a goroutine and returning early when ctx.Done() fires).
// Shutdown flushes all buffered writes to disk and closes the InfluxDB
// connection. The provided context can be used for timeout control.
func (i *InfluxClient) Shutdown(ctx context.Context) {
	slog.Info("Flushing InfluxDB memory buffers to disk...")
	i.WriteAPI.Flush()
	i.Client.Close()
	slog.Info("InfluxDB connection closed")

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Pin datasource UID in provisioning to match dashboard generator
- Rename 'Offline / Stale Devices (>24h)' → 'Currently Disconnected Devices'
- Fix README session path from container to host path
- Parameterize Grafana admin password via GF_ADMIN_PASSWORD env var
- Regenerate dashboard JSON
@arvarik arvarik merged commit da17989 into main Feb 23, 2026
1 check passed
@arvarik arvarik deleted the refactor/v0.2.0-best-practices branch February 23, 2026 04:06
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.

2 participants