Skip to content

feat(adapters): OpenTelemetry + SQL adapter modules#10

Merged
canaan5 merged 1 commit into
mainfrom
feat/adapter-modules
Jun 4, 2026
Merged

feat(adapters): OpenTelemetry + SQL adapter modules#10
canaan5 merged 1 commit into
mainfrom
feat/adapter-modules

Conversation

@canaan5

@canaan5 canaan5 commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

First production integrations toward v1 (roadmap B2), delivered as separate modules so the core's stdlib-only module graph is unchanged (go list -m all for the core still shows zero third-party deps).

adapters/otelruntime.Observer over OpenTelemetry

  • Spans (StartSpan/End/SetError/SetAttr), Int64Counter, Float64Histogram; runtime.Attrattribute.KeyValue.
  • New(tracerProvider, meterProvider) or Default() (global providers).
  • Verified with an in-memory tracetest.SpanRecorder (asserts span name, attributes, and error status) + noop-provider smoke tests. go test -race green.

adapters/sqlstore.Store over database/sql

  • Portable UPDATE-then-INSERT upsert (no dialect-specific ON CONFLICT); per-dialect placeholders via SQLite / MySQL / Postgres Dialects.
  • Caller supplies the *sql.DB, so the adapter imports no driver — zero third-party deps in this module.
  • Unit tests cover dialects + table validation; the round-trip test is env-gated on a real DB (ISOPACE_SQL_DRIVER/_DSN). go test green.

Module hygiene

  • Each adapter: require github.com/teqpace-services/isopace v0.3.0 + replace => ../... In-repo/CI builds use the working tree; external consumers use the tag. The replace is ignored when the adapter is imported as a dependency.
  • .github/workflows/adapters.yml builds/vets/tests each module independently (the root CI's ./... does not descend into separate modules — by design, so the core license scan stays stdlib-only).

Follow-ups (noted in ROADMAP-to-v1.md)

  • Add a Postgres service container to CI to run the SQL round-trip on every build.
  • B1 (HSM/PKCS#11) is the next adapter; B2 also lists NATS/JetStream for space (post-v1).

Independent of #8 and #9; no overlapping files.

Deliver the first production integrations (roadmap B2) as separate modules so
the core's stdlib-only module graph is unchanged.

- adapters/otel: implements runtime.Observer over OpenTelemetry (spans, counters,
  histograms; runtime.Attr -> attribute.KeyValue). New(tp, mp) or Default() from
  the global providers. Verified with an in-memory span recorder (name,
  attributes, error status) plus noop-provider smoke tests.
- adapters/sql: implements store.Store over database/sql with a portable
  UPDATE-then-INSERT upsert and per-dialect placeholders (SQLite/MySQL/Postgres).
  The caller supplies the *sql.DB, so the adapter imports no driver. Unit tests
  cover dialects and validation; the round-trip is env-gated on a real database.
- Each adapter is its own module (require isopace v0.3.0 + replace => ../..), so
  external consumers ignore the replace and the core graph stays stdlib-only.
- .github/workflows/adapters.yml builds/vets/tests each module independently.

Both modules: gofmt clean, go vet clean, go test -race passing.
@canaan5 canaan5 merged commit 1ad59d9 into main Jun 4, 2026
6 checks passed
@canaan5 canaan5 deleted the feat/adapter-modules branch June 4, 2026 01:56
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 4, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant