Skip to content

feat: Add logging, metrics, and checks for v0.1.0 - #2

Merged
0xmc merged 4 commits into
mainfrom
feat/v0.1.0
Oct 13, 2026
Merged

0xmc merged 4 commits into
mainfrom
feat/v0.1.0

Conversation

@0xmc

@0xmc 0xmc commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Go services each wire their own logs and metrics, so metrics end up registered where nothing exports them and label names collide with the ones our collection pipelines set.

This is the first release of the shared library proposed in datum-cloud/enhancements#927. It creates metrics on the registry services actually serve, builds the standard logger, and defines one set of label names for both.

It also ships tests a service adds to fail when its metrics aren't exported or its logs bypass the standard logger. In scratch copies, locations and network-services-operator migrated with all checks and their own tests passing.

Test plan

  • CI passes on the Go 1.25 floor, the latest Go, and the newest controller-runtime.
  • A metric created with the library appears on a real scrape of controller-runtime's metrics server, and a promauto metric in the same test does not.
  • Each check fails on its fixture of the defect it targets and passes on clean code.

Fixes #1

🤖 Generated with Claude Code

0xmc and others added 4 commits October 13, 2026 15:34
The repository holds a library that Apache-2.0 projects such as
resource-metrics need to import, so it is licensed Apache-2.0 rather than
the AGPL-3.0 used elsewhere in milo-os. The observability team owns it.

Key changes:
- replace the AGPL-3.0 license with the canonical Apache-2.0 text
- add CODEOWNERS assigning everything to @milo-os/observability
- add Claude settings enabling the datum plugins marketplace
- ignore build output, editor files, and local Claude state

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A change that passes locally must never fail in CI, so GitHub CI runs a
single command, task ci, and every version it depends on is pinned in the
Taskfile rather than taken from the runner.

Key changes:
- add the go.miloapis.com/instrumentation module with a Go 1.25.0 floor,
  the lowest version its likely adopters use
- add task ci: floor check, tidy, vet, golangci-lint, actionlint, and
  race-enabled tests on the floor and latest Go toolchains
- pin GOTOOLCHAIN per task so a newer local Go cannot diverge from CI
- run task ci as the only CI step, with task itself pinned

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Go service wires its own logs and metrics, and the mistakes stay
invisible: metrics registered on a registry the manager never serves, and
label names that collide with the collection pipelines' own.

Key changes:
- add labels, generated from labels.yaml, naming subject, build, and
  reserved labels for metrics and log keys alike
- add metrics constructors that register on controller-runtime's served
  registry, refuse reserved and build labels, and hold one definition
  per metric name; add Handler for servers that are not managers
- add logging with controller-runtime's defaults minus sampling, UTC
  timestamps, and build versions on every line; it does not redact
- add buildinfo for build_version and instrumentation_version, and the
  instrumentation_build_info metric
- add instrumenttest checks that read source: AssertNothingStranded,
  AssertStandardLogger, and Lint
- add a default task, generated-code checks, and a CI leg against the
  newest controller-runtime

Closes #1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setup-go sets GOTOOLCHAIN=local in CI, and Task does not override a
variable already in the environment, so every `env:` pin was ignored there
and all tests ran on the runner's Go. The newest controller-runtime leg
failed because it needs Go 1.26.

Key changes:
- set GOTOOLCHAIN inline on each Go command instead of through `env:`
- fail a test run whose Go version differs from the one it pins, so a
  silent override cannot recur

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0xmc
0xmc merged commit 5a456e1 into main Oct 13, 2026
1 check passed
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.

Services have no shared, tested way to emit logs and metrics

3 participants