Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -393,26 +393,3 @@ jobs:
verify/e2e/.e2e/
if-no-files-found: ignore
include-hidden-files: true

budget:
needs: [static-fast, e2e-android-bare, e2e-ios-bare, e2e-android-expo, e2e-ios-expo, e2e-web]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Check PR time budget
env:
GH_TOKEN: ${{ github.token }}
BUDGET: ${{ vars.PR_BUDGET_MINUTES }}
run: |
started=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }} --jq .run_started_at)
minutes=$(( ($(date +%s) - $(date -d "$started" +%s)) / 60 ))
echo "CI duration: ${minutes} min (budget: ${BUDGET:-unset})"
if [ -n "$BUDGET" ] && ! [[ "$BUDGET" =~ ^[0-9]+$ ]]; then
echo "::error::PR_BUDGET_MINUTES must be a whole number, got '$BUDGET'"
exit 1
fi
if [ -n "$BUDGET" ] && [ "$minutes" -gt "$BUDGET" ]; then
echo "::error::CI took ${minutes} min, over the ${BUDGET} min budget"
exit 1
fi
2 changes: 1 addition & 1 deletion ReactNativeOpenTelemetry.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require "json"

package = JSON.parse(File.read(File.join(__dir__, "package.json")))

# The Nitro adapter (Swift with C++ interop) over the pure Swift core pod (R24, spec §4.2).
# The Nitro adapter (Swift with C++ interop) over the pure Swift core pod (spec §4.2).
Pod::Spec.new do |s|
s.name = "ReactNativeOpenTelemetry"
s.version = package["version"]
Expand Down
2 changes: 1 addition & 1 deletion android/src/main/java/com/callstack/otel/core/OtelCore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class OtelCore(config: CoreConfig, testMode: Boolean = false, distroVersion: Str
private set

/**
* Idempotent. The first result sticks, a failed one too (R16): later calls never retry. A call without config
* Idempotent. The first result sticks, a failed one too: later calls never retry. A call without config
* before any init is an error but is not remembered, so the real init can still follow.
*/
@Synchronized fun initialize(config: CoreConfig?, testMode: Boolean = false, distroVersion: String = "unknown"): InitResult {
Expand Down
20 changes: 9 additions & 11 deletions docs/superpowers/specs/2026-11-10-rn-otel-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class NativeHandOffProcessor implements SpanProcessor {
- iOS: the core (`ios/Core/*.swift`) takes opentelemetry-swift types only. Nitro's
generated Swift structs are typealiases of C++ structs, so code using them needs C++
interop, and the core must not (below): the Nitro adapter pod builds `SpanData` from
the seam structs and hands the core `ReadableSpan`s. *(R24: the app's non-interop Swift `AppDelegate` cannot import a Nitro C++-interop module, so iOS ships
the seam structs and hands the core `ReadableSpan`s. *(The app's non-interop Swift `AppDelegate` cannot import a Nitro C++-interop module, so iOS ships
two pods: pure-Swift `ReactNativeOpenTelemetryCore` (`ios/Core` + `RNOtel`) and the Nitro adapter pod that
depends on it. Autolinking links one podspec per package, so apps add `pod 'ReactNativeOpenTelemetryCore',
:path => '../node_modules/react-native-open-telemetry'` to their Podfile.)*
Expand Down Expand Up @@ -514,7 +514,7 @@ ships TC39 AsyncContext (Stage 2).
## 7. Web (decided)

Same `@opentelemetry/api` surface and the same ContextManager; spans live in the JS SDK and
export directly from JS. **Changed in v0 implementation (R7, pending author review):** web
export directly from JS. **Changed in v0 implementation:** web
builds its own `sdk-trace` `TracerProvider` + `BatchSpanProcessor` + upstream
`@opentelemetry/exporter-trace-otlp-proto` (fetch), not `startBrowserSdk`. Why:
browser-sdk 0.9.1 takes no `idGenerator` (no `0a` test-mode IDs, so no exact web goldens),
Expand Down Expand Up @@ -565,8 +565,8 @@ Sequencing (from review; council review 2026-11-21 added step 0):
`nest-after-await` e2e test per platform. Proves the seam compiles, the native SDKs link,
and the e2e tooling can drive the app, before parallel work builds on it.
1. **First milestone: the context patch in a real RN app** (real Hermes, RN's timers,
Promise, scheduler, `InteractionManager`) with real `sdk-trace` spans. Scenarios include
React batching, `InteractionManager`, intervals, thrown errors in callbacks, EventEmitter
Promise, scheduler) with real `sdk-trace` spans. Scenarios include
React batching, intervals, thrown errors in callbacks, EventEmitter
listeners. The spike only used a stand-in Hermes host.
2. JS-only slice asserting on output with the fake collector.
3. The seam on one platform, with shared payload fixtures and an early device e2e; then
Expand Down Expand Up @@ -601,7 +601,7 @@ tests: they don't care about internals, so internals can be rewritten freely.
- **explicit timestamps**: v0 scenarios create all spans themselves, so they pass
`startTime` / `end(t)` explicitly (JS and native), in whole microseconds. iOS cannot
represent them exactly: opentelemetry-swift exports `Date`, a ~238–256 ns grid, so iOS times
are compared within 256 ns (R22, measured floor in verify/VERIFY.md). Clock stubs (Java `setClock`/`TestClock` in test source sets
are compared within 256 ns (measured floor in verify/VERIFY.md). Clock stubs (Java `setClock`/`TestClock` in test source sets
only; Swift `with(clock:)`) are only a fallback for implicit reads.
- sequential test ID generators, namespaced per side (JS `0a…01`, native `0b…01`) via
upstream hooks: JS `sdk-trace` `idGenerator`, Java `setIdGenerator`, Swift
Expand Down Expand Up @@ -755,10 +755,8 @@ Two apps cover both init paths: the bare example inits natively in
fallback (also the Expo-managed path the spec promises). Both produce the same expected
files, which proves the paths are equivalent.

**PR time budget:** the PR pipeline (stages 1–4) gets a fixed wall-clock budget, set from
the first full green run plus headroom, enforced with GitHub's `timeout-minutes` per job and
one final `needs:` job that checks total wall-clock time. When a PR run exceeds it, the fix is an agent task
(cache native builds, shard targets, trim slow scenarios), never dropping a target: the full
**PR time:** each job has a `timeout-minutes`. When PR runs get slow, the fix is caching
native builds, sharding targets or trimming slow scenarios, never dropping a target: the full
matrix on every PR is decided.

**Releases:** manual with changesets (`bun run version`, then `bun run publish`), from `main`
Expand Down Expand Up @@ -840,7 +838,7 @@ Left out until needed:
pre-`async_hooks`).
- Upstream code reuse estimate: ~4% of running code is ours (~3.7k of ~89k lines).
- Review: builder check + council (OTel-upstream, RN/native, skeptic) on 2026-11-10.
- CI shape (pre-commit static checks, PR time budget, release only from fully green
- CI shape (pre-commit static checks, release only from fully green
commits, staged release) adapted from
[Kun Chen on validation categories](https://x.com/kunchenguid/status/2122391325081579618)
(2026-11-16); the full device matrix stays on every PR by decision.
Expand Down Expand Up @@ -892,7 +890,7 @@ direct precedent was found; treat those as the highest-risk parts.
| P11 | Links instead of parents for batched/multi-cause work; interval ticks as new roots (5, 6.2) | OTel spec: links represent batched operations; React notes it can't attribute batched updates without AsyncContext | [Spec: Links between spans](https://github.com/open-telemetry/opentelemetry-specification/blob/a03fa4e26b3982da42aa0010aaebcd9f694cb037/specification/overview.md#L207-L214) · [React `ReactFiberAsyncAction.js`](https://github.com/facebook/react/blob/fe719f77ba3e4b5fb3ebe13787bfbd0ed911da19/packages/react-reconciler/src/ReactFiberAsyncAction.js#L42) |
| P12 | *(removed: the staleness rule was cut in council review, see 6.2)* | | |
| P13 | *(removed: the pre-init buffer was cut in council review, see 4.3)* | | |
| P14 | *(Superseded by R8: upstream timing kept, no offset.)* Clock offset `Date.now() - performance.now()`, recomputed on foreground (4.3) | OTel JS derives span times from `performance.timeOrigin` + `performance.now()`; Sentry RN guards an unreliable `performance.timeOrigin` | [Sentry `timeOrigin` guard](https://github.com/getsentry/sentry-react-native/blob/794a52a9e80ca0a7c4ee005264cd9cd3ee1533de/packages/core/src/js/sdk.tsx#L76-L80) |
| P14 | *(Superseded: upstream timing kept, no offset.)* Clock offset `Date.now() - performance.now()`, recomputed on foreground (4.3) | OTel JS derives span times from `performance.timeOrigin` + `performance.now()`; Sentry RN guards an unreliable `performance.timeOrigin` | [Sentry `timeOrigin` guard](https://github.com/getsentry/sentry-react-native/blob/794a52a9e80ca0a7c4ee005264cd9cd3ee1533de/packages/core/src/js/sdk.tsx#L76-L80) |
| P15 | Custom names under a reverse-domain prefix, never `otel.*` (4.5) | OTel naming guidance | [naming.md: app developers](https://github.com/open-telemetry/semantic-conventions/blob/2d91ead21027a8a58fbb7488b12d80238e7c0ac5/docs/general/naming.md#L183-L187) · [`otel.*` reserved](https://github.com/open-telemetry/semantic-conventions/blob/2d91ead21027a8a58fbb7488b12d80238e7c0ac5/docs/general/naming.md#L217-L227) |
| P16 | Option names mirror `startBrowserSdk`; invalid config returns a no-op SDK instead of throwing (4.4) | OTel Browser SIG browser SDK | [browser-sdk README](https://github.com/open-telemetry/opentelemetry-browser/tree/main/packages/sdk) |
| P17 | Exact expected-output files (goldens) for traces (9.1) | OTel Collector tests compare traces against golden files | [collector-contrib `pkg/golden`](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/c64840337cf400792cb684037ed998428b268197/pkg/golden) · [`ptracetest` compare options](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/c64840337cf400792cb684037ed998428b268197/pkg/pdatatest/ptracetest/options.go#L102-L149) |
Expand Down
2 changes: 1 addition & 1 deletion example-expo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {startReactNativeSdk} from 'react-native-open-telemetry';
import {ScenariosScreen} from '../example/src/ScenariosScreen';

// JS-fallback init: no native init in this app, so this call initializes native from the config (spec §4.4).
// No serviceVersion: the test-mode resource is service.name only (R2). Same collector and headers as the bare app.
// No serviceVersion: the test-mode resource is service.name only. Same collector and headers as the bare app.
startReactNativeSdk({
serviceName: 'verify',
exportConfig: {
Expand Down
2 changes: 1 addition & 1 deletion example-expo/plugins/withOtelExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tasks.matching { it.name.startsWith("createBundle") }.configureEach {

/**
* Example-only: what the bare example's native projects carry by hand, applied at `expo prebuild`. The Core
* pod (R24) comes from the package's own plugin (`react-native-open-telemetry` in app.json), as in a real Expo app.
* pod comes from the package's own plugin (`react-native-open-telemetry` in app.json), as in a real Expo app.
*/
module.exports = config => {
config = withAppBuildGradle(config, c => {
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if linkage != nil
end

target 'OpenTelemetryExample' do
# Autolinking links only the Nitro pod; the pure Swift core pod (RNOtel, imported by AppDelegate) is declared here (R24).
# Autolinking links only the Nitro pod; the pure Swift core pod (RNOtel, imported by AppDelegate) is declared here.
pod 'ReactNativeOpenTelemetryCore', :path => '../..'
config = use_native_modules!

Expand Down
2 changes: 1 addition & 1 deletion example/modules/test-native/TestNative.podspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Example-only Nitro module (R25): app native code using the public RNOtel API.
# Example-only Nitro module: app native code using the public RNOtel API.
Pod::Spec.new do |s|
s.name = "TestNative"
s.version = "0.0.0"
Expand Down
2 changes: 1 addition & 1 deletion example/modules/test-native/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Example-only Nitro module (R25). Versions follow the app (rootProject.ext), as autolinked libraries do.
// Example-only Nitro module. Versions follow the app (rootProject.ext), as autolinked libraries do.
apply plugin: "com.android.library"
apply plugin: "org.jetbrains.kotlin.android"
apply from: "../nitrogen/generated/android/TestNative+autolinking.gradle"
Expand Down
2 changes: 1 addition & 1 deletion ios/Adapter/HybridOtel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import NitroModules
import ReactNativeOpenTelemetryCore

/// The seam: JS spans are wrapped as otel `ReadableSpan`s here and queued in the core (pod `ReactNativeOpenTelemetryCore`,
/// R24). The core stays free of Nitro's C++-backed types, so the app's AppDelegate can import it without C++ interop.
/// spec §4.2). The core stays free of Nitro's C++-backed types, so the app's AppDelegate can import it without C++ interop.
class HybridOtel: HybridOtelSpec {
func initialize(config: SeamConfig?) throws -> SeamInitResult {
let r = RNOtel.initialize(config.map {
Expand Down
4 changes: 2 additions & 2 deletions ios/Adapter/JsReadableSpan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func attributes(of list: [SeamAttribute]) -> [String: AttributeValue] {
return out
}

/// OTel HrTime `[seconds, nanos]`; missing elements read as 0 (C4). R22: `Date` holds a Double of seconds, so whole µs
/// OTel HrTime `[seconds, nanos]`; missing elements read as 0. `Date` holds a Double of seconds, so whole µs
/// come back on a ~256 ns grid (verify/VERIFY.md).
private func date(_ t: [Double]) -> Date {
Date(timeIntervalSince1970: (t.count > 0 ? t[0] : 0) + (t.count > 1 ? t[1] : 0) / 1e9)
Expand Down Expand Up @@ -72,7 +72,7 @@ private final class FixedClock: Clock {
}

/**
* A finished JS span handed over the seam (R19): the frozen `ReadableSpan` the native BatchSpanProcessor queues. It
* A finished JS span handed over the seam: the frozen `ReadableSpan` the native BatchSpanProcessor queues. It
* keeps Nitro's struct; only the span context is built on the JS thread (onEnd checks `sampled`), `toSpanData()` runs
* on the BSP worker. SpanData has no public initializer, so it is built through the SDK's own `SpanSdk`, the public
* factory upstream uses.
Expand Down
2 changes: 1 addition & 1 deletion ios/Core/OtelCore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ package final class OtelCore {
private static var state: InitResult?
package private(set) static var instance: OtelCore?

/// Idempotent. The first result sticks, a failed one too (R16): later calls never retry. A call without config
/// Idempotent. The first result sticks, a failed one too: later calls never retry. A call without config
/// before any init is an error but is not remembered, so the real init can still follow.
@discardableResult
package static func initialize(_ config: CoreConfig?, testMode: Bool = false, distroVersion: String = "unknown") -> InitResult {
Expand Down
2 changes: 1 addition & 1 deletion react-native.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// https://github.com/react-native-community/cli/blob/main/docs/dependencies.md
// Nitro: the native code and nitrogen/generated are wired by android/build.gradle and the podspec.
// Two podspecs sit at the root; autolinking links only the Nitro adapter (apps add the Core pod, R24). podspecPath says
// Two podspecs sit at the root; autolinking links only the Nitro adapter (apps add the Core pod). podspecPath says
// which; RN CLI 20.2 and Expo 58 do not read it yet (CLI: the first `*.podspec` glob hit; Expo: the first sorted, both
// ReactNativeOpenTelemetry.podspec today).
module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/__tests__/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ test('a partial config names the missing fields, not native\'s "no config"', ()
expect(String(err.mock.calls[0])).toMatch(/serviceName and exportConfig\.url are required/);
});

test('a failed native-first init (sticky, R16) was reported by native: no second report', () => {
test('a failed native-first init (sticky) was reported by native: no second report', () => {
fakeOtel({initialized: true, error: 'invalid exportUrl'});
const h = startReactNativeSdk();
expect(err).not.toHaveBeenCalled();
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {noopHandle} from './noop';

export const TAG = '[react-native-open-telemetry]';

/** Stamps every tracer (C3), makes `provider` the global one, starts the probe; returns the handle. */
/** Stamps every tracer, makes `provider` the global one, starts the probe; returns the handle. */
export function register(provider: TracerProvider): SdkHandle {
const getTracer = provider.getTracer.bind(provider);
provider.getTracer = (name, version, options) => stampScope(getTracer(name, version, options));
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function start(config: SdkConfig | undefined): SdkHandle {
const seam = config && toSeamConfig(config);
const result = native.initialize(seam);
if (result.error) {
// alreadyInitialized: a failed native-first init sticks (R16) and native already reported it, once
// alreadyInitialized: a failed native-first init sticks and native already reported it, once
if (result.alreadyInitialized) return noopHandle();
if (config && !seam) {
console.error(`${TAG} serviceName and exportConfig.url are required to initialize native; telemetry is off.`);
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/start.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ function start(config: SdkConfig | undefined): SdkHandle {
);
}

/** Web: spans export straight from JS over OTLP/proto (§7, R7). Never throws: failures give one error and a no-op handle. */
/** Web: spans export straight from JS over OTLP/proto (§7). Never throws: failures give one error and a no-op handle. */
export const startReactNativeSdk = (config?: SdkConfig): SdkHandle => startOnce(start, config);
Loading
Loading