Skip to content

feat(node-server): report offline core provider SDK diagnostics - #482

Draft
btthomas wants to merge 5 commits into
sameerank/node-core-provider-offline-initfrom
blake.thomas/core-provider-telemetry
Draft

btthomas wants to merge 5 commits into
sameerank/node-core-provider-offline-initfrom
blake.thomas/core-provider-telemetry

Conversation

@btthomas

Copy link
Copy Markdown
Contributor

Motivation

Report SDK initialization and configuration-fetch diagnostics for the offline Node core provider. Integrations can use the same callback, event schema, and refresh-reporting methods as DatadogNodeServerProvider.

This PR is stacked on #469.

Changes

  • Add optional onDiagnostic to DatadogCoreProvider and reuse the existing SDKDiagnostics implementation.
  • Measure synchronous construction, snapshot validation, and provider setup. Report ready or failed before construction completes. Preserve constructor errors.
  • Add reportConfigurationFetchStart() and reportConfigurationFetchResult(success) for caller-owned refresh. Reuse outage suppression and cooldown behavior. Cancellation is not a failed fetch.
  • Stop diagnostics at close. Keep synchronous OpenFeature readiness and add no diagnostic work to evaluation paths.
  • Export the same SDKDiagnostic type from /rules-based, regenerate declarations, and document delivery ordering. Integrations start delivery before construction and add SDK/service/environment identity.
  • Add lifecycle, callback-safety, schema, packed runtime, and cross-entrypoint type tests.

The tracer catch-up remains a separate change. This provider performs no polling or event uploading. Fetching and parsing completed before construction are outside its initialization timings.

Test instructions

  • All 1,039 Node provider tests passed, including 12 new core diagnostic tests.
  • Core and Node builds, Node typecheck, repository lint, formatting, and diff checks passed.
  • Isolated packed consumers passed without OpenFeature, with minimum supported OpenFeature versions (1.15.0 / 1.3.0), and with repository versions (1.22.0 / 1.11.0). Runtime, package-purity, and classic/Node16/NodeNext TypeScript checks passed. The no-OpenFeature scenario explicitly verifies the SDK is absent.
  • All nine existing browser bootstrap tests passed after building their required browser artifact.
  • No staging or tracer end-to-end test was run.

Checklist

  • Updated Documentation
  • Tested locally
  • Tested on staging
  • Added unit tests for this change.
  • Added e2e/integration tests for this change (packed-package consumers).

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

OpenFeature Browser Provider Bundle Sizes

Measured from the Vite production output after installing packed @datadog/flagging-core and @datadog/openfeature-browser tarballs.

Both scenarios initialize an OpenFeature provider, evaluate a boolean flag, change context, and evaluate again. Telemetry is disabled for DatadogProvider; no tracking hooks are registered for DatadogCoreProvider. DatadogProvider fetches precomputed assignments for each context; DatadogCoreProvider receives rules from fetchRulesConfiguration once and evaluates locally.

Sizes include OpenFeature and the same small scenario harness. Configuration responses are supplied by Playwright and are not bundled. These are complete scenario JS sizes, not configuration payload sizes or isolated provider/Protobuf costs; the difference between rows is not a decoder-only delta.

Scenario HTML JS Assets Raw JS Gzip JS Protobuf Markers
DatadogProvider (precomputed fetching) provider.html 14 307.9 KiB 95.4 KiB no
DatadogCoreProvider + fetchRulesConfiguration core-provider.html 14 397.5 KiB 120.2 KiB yes

Dependency checks passed: no Protobuf markers in default/precomputed scenarios; markers present in rules-based scenarios.

OpenFeature Browser Tracking Hook Bundle Sizes

Synthetic entrypoints import and call tracking hook factories from the packed @datadog/openfeature-browser/rules-based ESM package. Deltas are measured against the no-hook baseline from the same Vite production build.

Scenario HTML JS Assets Raw JS Raw Δ Gzip JS Gzip Δ
tracking hook baseline tracking-baseline.html 5 13.0 KiB 0 B 5.4 KiB 0 B
exposure logging hook tracking-exposure.html 9 242.2 KiB +229.2 KiB 73.7 KiB +68.3 KiB
evaluation logging hook tracking-evaluation.html 10 237.5 KiB +224.5 KiB 72.3 KiB +66.9 KiB
RUM tracking hook tracking-rum.html 7 33.5 KiB +20.5 KiB 12.1 KiB +6.7 KiB
all tracking hooks tracking-all.html 12 249.8 KiB +236.8 KiB 77.0 KiB +71.7 KiB

OpenFeature Node Server Bundle Sizes

Independent Webpack production builds of the installed core and Node SDK tarballs, targeting Node 18 with ESM (module export condition). Node built-ins remain external. OpenFeature, dd-trace, and configuration fixtures are not bundled.

Scenario Raw JS Gzip JS Protobuf Modules
Node provider only 62.0 KiB 18.4 KiB no
SSR helpers only (fetch client rules + serialize) 85.1 KiB 25.0 KiB yes
Node provider + SSR helpers 145.4 KiB 42.1 KiB yes
Precompute only (parsed rules) 54.9 KiB 18.1 KiB no
Node provider + precompute 83.2 KiB 25.4 KiB no
Precomputed fetch + serialize (root) 16.3 KiB 5.9 KiB no
Precomputed fetch + serialize (/rules-based) 16.3 KiB 5.9 KiB no

Adding SSR helpers to the provider adds 83.4 KiB raw / 23.7 KiB gzip in this build. This includes fetching, parsing, and serialization, not just the decoder. SSR helpers fetch rules for the browser, not for configuring that provider (which uses its existing JSON API).

Adding precomputation to the provider adds 21.2 KiB raw / 7.0 KiB gzip in this build. Both precompute scenarios import precomputeConfiguration from /rules-based and receive already-parsed rules from the test harness; they do not fetch, parse, or serialize configuration.

These are bundler sizes, not npm install sizes, unbundled Node require/import costs, payload sizes, or latency. Gzip compares compressed artifacts. Deltas compare scenarios in this build, not changes against the base branch. The browser scenarios include OpenFeature and a different harness, so their sizes are not directly comparable.

Dependency checks passed: no Protobuf runtime or generated schema modules in the provider-only, precompute, or precomputed-fetch bundles; present in both rules-fetch SSR bundles (checked using Webpack module statistics).

This report shows current PR artifact sizes only; it does not compare against the base branch.

This branch has not been deployed

No deployments
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.

1 participant