open-telemetry / opentelemetry-js

OpenTelemetry JavaScript Client
https://opentelemetry.io
Apache License 2.0
2.75k stars 809 forks source link

Support for react-native environment. #1089

Open aravindpl opened 4 years ago

aravindpl commented 4 years ago

Hi,

Is there plan to support react-native environment also part of opentelemetry-js ?

longility commented 2 years ago

Has anyone made an attempt at hooking in Otel or have a simple approach or workaround?

PritamSangani commented 2 years ago

same question as @longility - is there anyway to use in react native? Or are there plans to create a react native sdk?

kirmayrcosta commented 2 years ago

I have the same problem, I try test use open telemetry web, but the problem is because need specific customization in a package web in the webpack. React Native don't is node and web. Node uses native libraries and web use the DOM and native variables =/

dyladan commented 2 years ago

Short answer here is no. Longer answer is that someone actually has been working on trying to get OTel working in react native but they're actually using OTel java SDK and OTel JS instrumentations because react native doesn't run in a node environment. I don't have details but I would not expect it to be a simple task.

dyladan commented 2 years ago

Closing this as wontfix since we don't have sufficient bandwidth

dyladan commented 2 years ago

Actually i'm going to reopen this for now and talk about it at the SIG today to make sure, but I do expect this to be closed most likely.

rauno56 commented 2 years ago

Discussed it during a SIG(2022-07-06).

@MSNev mentioned a related implementation: https://github.com/microsoft/ApplicationInsights-JS/tree/master/extensions/applicationinsights-react-native

Decided to agree on a blanket rule or at least some guidelines on when we close issues we don't have bandwidth for.

jimethn commented 2 years ago

Would be nice to have react native support. We are looking at instrumenting our web and mobile, and it's looking like we can't use opentelemetry because of lack of mobile support.

dyladan commented 2 years ago

You should be able to use OTel java for your mobile application, you will just not be able to auto-instrument the UI layer

jimethn commented 2 years ago

@dyladan The UI is the main problem, but thanks for the pointer

hwo411 commented 2 years ago

+1 for having it supported or at least having some guidance how to integrate it (at least partially)

Also, I discovered that DataDog support react native: https://github.com/DataDog/dd-sdk-reactnative

Could it be helpful in some way?

nikordaris commented 2 years ago

Posthog also does auto-instrument for react-native which might be helpful when implementing it for otel. https://github.com/PostHog/posthog-js-lite/tree/master/posthog-react-native

vvydier commented 2 years ago

is there a plan to work on adding support for react-native in otel-js ?

mhennoch commented 2 years ago

We have been working on RN support. It uses subset of otel-js and otel java/swift. It is in early alpha and it will take couple of weeks before I am able to make it public. The plan is to upstream it at some point. I'll post it here when it is public.

shawna-donnelly commented 1 year ago

Any more updates on this?

mhennoch commented 1 year ago

It is public now but still in very early stages: https://github.com/signalfx/splunk-otel-react-native. No expo support yet and only sends zipkin. If you have any questions/suggestions don't hesitate to message me on CNCF slack or open an issue.

shawna-donnelly commented 1 year ago

Thanks @mhennoch!

AdityaSakhadeo commented 9 months ago

Reading the above comments I think currently there is no way we can use opentelemetry for react-native is there any other way to use opentelemetry or similar software for react-native

evelant commented 9 months ago

@AdityaSakhadeo sentry has tracing that works well on react-native https://docs.sentry.io/platforms/react-native/performance/

AdityaSakhadeo commented 9 months ago

@AdityaSakhadeo sentry has tracing that works well on react-native https://docs.sentry.io/platforms/react-native/performance/

Thank you so much @evelant

yuriy-yarosh commented 9 months ago

It should be possible to use otlp http exporters exporter-logs-otlp-http exporter-trace-otlp-http opentelemetry-exporter-metrics-otlp-http for react-native.

Himanshu0301 commented 8 months ago

@mhennoch is RN support free to use? or it has a pricing plan?

KrysKruk commented 6 months ago

Current version of OT-JS 1.24.1 can be used for manual instrumentation of react-native apps. Here is a minimal code I've used to get it started:

import {
  SimpleSpanProcessor,
  WebTracerProvider,
} from "@opentelemetry/sdk-trace-web";
import { Resource } from "@opentelemetry/resources";
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";

const provider = new WebTracerProvider({
  resource: new Resource({
    "service.name": "app",
  }),
});

provider.addSpanProcessor(
  new SimpleSpanProcessor(
    new OTLPTraceExporter({
      url: "{URL}",
    })
  )
);

provider.register();