react-native-otel 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -581,18 +581,8 @@ class MySampler implements Sampler {
581
581
  Span processors run synchronously at span start and end. Use them to enrich spans with extra attributes, filter spans, or forward to a custom exporter without going through the SDK exporter chain.
582
582
 
583
583
  ```ts
584
- import {
585
- SimpleSpanProcessor,
586
- NoopSpanProcessor,
587
- } from 'react-native-otel';
588
- import type { SpanProcessor, ReadonlySpan } from 'react-native-otel';
589
- import type { Span } from 'react-native-otel';
590
-
591
- // SimpleSpanProcessor: wraps an exporter — calls export() immediately on end().
592
- otel.init({
593
- serviceName: 'my-app',
594
- processors: [new SimpleSpanProcessor(myCustomExporter)],
595
- });
584
+ import { SimpleSpanProcessor } from 'react-native-otel';
585
+ import type { SpanProcessor, ReadonlySpan, Span } from 'react-native-otel';
596
586
 
597
587
  // Custom processor: enrich every span with a 'session.id' attribute.
598
588
  class SessionProcessor implements SpanProcessor {
@@ -605,7 +595,10 @@ class SessionProcessor implements SpanProcessor {
605
595
  otel.init({
606
596
  serviceName: 'my-app',
607
597
  exporter: new OtlpHttpExporter({ endpoint: '...' }),
608
- processors: [new SessionProcessor()],
598
+ processors: [
599
+ new SessionProcessor(), // enrich spans
600
+ new SimpleSpanProcessor(myExporter), // also forward to a second exporter
601
+ ],
609
602
  });
610
603
  ```
611
604
 
@@ -911,8 +904,6 @@ otel.init({
911
904
  });
912
905
  ```
913
906
 
914
- > `AsyncStorage` is not compatible — the adapter must be synchronous.
915
-
916
907
  ---
917
908
 
918
909
  ## Connectivity-Aware Flushing
@@ -973,12 +964,17 @@ navigation.reset({ routes: [{ name: 'Login' }] });
973
964
 
974
965
  ### otel.shutdown()
975
966
 
976
- Ends the active screen span, flushes all buffers, clears flush timers, and removes the network listener.
967
+ Ends the active screen span, flushes all buffers, clears flush timers, and removes the network listener. Call it once when the application is truly done — for example, during a logout flow or before a controlled restart. It is a one-way teardown; do not call it on every background transition.
977
968
 
978
969
  ```ts
970
+ // Flush buffered data when the app moves to the background.
979
971
  AppState.addEventListener('change', (state) => {
980
- if (state === 'background') otel.shutdown();
972
+ if (state === 'background') otel.flush();
981
973
  });
974
+
975
+ // Full teardown on logout (optional).
976
+ await api.logout();
977
+ await otel.shutdown();
982
978
  ```
983
979
 
984
980
  ---
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  // Single source of truth for the SDK version string.
4
- // Update this when bumping the package version.
5
-
6
- export const SDK_VERSION = require('../package.json').version;
4
+ // This is updated automatically by the release workflow when package.json is bumped.
5
+ export const SDK_VERSION = '0.1.8';
7
6
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SDK_VERSION","require","version"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA;;AAEA,OAAO,MAAMA,WAAmB,GAC9BC,OAAO,CAAC,iBAAiB,CAAC,CAC1BC,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["SDK_VERSION"],"sourceRoot":"../../src","sources":["version.ts"],"mappings":";;AAAA;AACA;AACA,OAAO,MAAMA,WAAW,GAAG,OAAO","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION: string;
1
+ export declare const SDK_VERSION = "0.1.8";
2
2
  //# sourceMappingURL=version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,EAAE,MAEjB,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-otel",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Lightweight OpenTelemetry SDK for React Native",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
package/src/version.ts CHANGED
@@ -1,6 +1,3 @@
1
1
  // Single source of truth for the SDK version string.
2
- // Update this when bumping the package version.
3
-
4
- export const SDK_VERSION: string = (
5
- require('../package.json') as { version: string }
6
- ).version;
2
+ // This is updated automatically by the release workflow when package.json is bumped.
3
+ export const SDK_VERSION = '0.1.8';