This is an Expo project created with create-expo-app
demonstrating how to integrate Honeycomb into a React Native app using OpenTelemetry SDKs.
To use this app:
- Run
npm ci
to install dependencies. - Update the
serviceName
andhoneycombKey
in app/honeycomb.tsx. - Run
npm run ios
To add Honeycomb to an existing React Native app, follow these steps:
-
Add metro.config.js to the root of your repo and enable
config.resolver.unstable_enablePackageExports
. This is required for OpenTelemetry to be able to properly import its dependencies. -
Install OpenTelemetry dependencies to your app.
npm install --save \
@opentelemetry/api \
@opentelemetry/api-logs@0.55.0 \
@opentelemetry/sdk-logs@0.55.0 \
@opentelemetry/sdk-metrics \
@opentelemetry/sdk-trace-web \
@opentelemetry/exporter-logs-otlp-http@0.55.0 \
@opentelemetry/exporter-metrics-otlp-http@0.55.0 \
@opentelemetry/exporter-trace-otlp-http@0.55.0
-
Add OpenTelemetry configuration code as found in app/honeycomb.tsx. This code can be customized as desired.
-
Update the
serviceName
andhoneycombKey
inhoneycomb.tsx
for your particular project. -
Call
configureHoneycomb();
from the top level of your app, such as in theRootLayout
function. -
See examples in app/(tabs)/demo.tsx for how to create manual telemetry.
For more information, including how to configure auto-instrumentation for fetch
and other libraries, see the OpenTelemetry Demo documentation for React Native.