chore: OpenTelemetry SDK to v2 with compat matrix#361
Merged
Conversation
- @opentelemetry/sdk-metrics: ^1.29.0 -> ^2.0.0 - @opentelemetry/sdk-trace-base: ^1.29.0 -> ^2.0.0 - @opentelemetry/exporter-trace-otlp-http: ^0.57.1 -> ^0.200.0 - @opentelemetry/api peer dep: ^1.7.0 -> ^1.9.0 - Migrate BasicTracerProvider.addSpanProcessor() to constructor spanProcessors option (removed in SDK v2) - Production code unchanged (uses only @opentelemetry/api)
Documents the supported @opentelemetry/api, SDK, and Node.js versions. Clarifies that SDK packages are dev-only (not shipped to consumers) and explains the OTel experimental version scheme for exporters.
- Add peerDependenciesMeta to document @opentelemetry/api as required - Clarify in README that SDK packages are not needed by consumers - Package uses only the API facade; consumers bring their own SDK
Verify @peac/telemetry-otel works with only @opentelemetry/api (no SDK packages). Four tests: - All public exports resolve via dynamic import - createOtelProvider works with no-op API (no SDK registered) - Provider methods do not throw with no-op meter/tracer - package.json: SDK packages are devDependencies only Also applies Prettier formatting to README.md.
Add scripts/otel-smoke.sh that packs @peac/telemetry-otel and its workspace deps into tarballs, installs them in a temp project with only @opentelemetry/api, and verifies createOtelProvider resolves and works. Fix exports maps for @peac/privacy and @peac/telemetry-otel: add "default" condition so CJS require() resolves correctly when loaded outside the workspace (the smoke test caught this).
Robustness improvements: - Use parallel arrays instead of associative arrays (bash compat) - Pin @opentelemetry/api to peer range from package.json, not @latest - Deterministic package directory map instead of pnpm --filter exec pwd - Assert tarball files exist with diagnostics on failure - Verify resolved dependency tree has all expected packages Wire the smoke test into CI as a step after pack-and-install gate.
The domain guard forbids npm invocations outside an allowlist. otel-smoke.sh uses npm install to simulate consumer installs from tarballs, which is an intentional npm usage pattern (same as pack-install-smoke.sh).
- Portable shebang (#!/usr/bin/env bash) - Assert OTEL_API_RANGE is non-empty before proceeding - Use argv array for pnpm filter args (no string-splitting) - Add --ignore-scripts --no-package-lock to npm install - Remove 2>/dev/null from pnpm pack (failures should be visible)
8a64cc4 to
fd47244
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@opentelemetry/sdk-metricsandsdk-trace-basefrom v1 to^2.0.0(dev deps only)@opentelemetry/apipeer dep to^1.9.0(still stable 1.x)BasicTracerProvider.addSpanProcessor()-> constructorspanProcessorsoption^0.200.0(version-locked to SDK v2)Roadmap tie-in
v0.10.11 PR 3.2 -- dev dependency modernization.
Risk level
Low. SDK packages are dev dependencies only -- NOT shipped to consumers.
@opentelemetry/api(the only production peer dep) stays at stable v1. No runtime behavior changes for consumers.Compatibility matrix
@opentelemetry/api^1.9.0@opentelemetry/sdk-metrics^2.0.0@opentelemetry/sdk-trace-base^2.0.0@opentelemetry/exporter-*^0.200.0Gates
pnpm buildpnpm lintpnpm typecheck:corepnpm testbash scripts/guard.shTest plan