Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Remix documentation #86

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
60 changes: 60 additions & 0 deletions Remix_Documentation/Remix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Remix

HyperDX comes with simple to use out-of-the box Remix support via our [browser SDK](https://www.hyperdx.io/docs/install/browser). The browser SDK allows you to intrument your frontend application to send events, route logs, and session data to HyperDX. We also have multiple backend integrations depending on your Remix Stack, for example when using [Node.js](https://www.hyperdx.io/docs/install/javascript) servers like Express, Vercel, Netlify, Architect, etc.

## Getting Started

### Install

```bash
npm install @hyperdx/browser
```

### Initialize HyperDX in root.tsx file

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be more appropriate in entry.client.tsx?


```js
import HyperDX from '@hyperdx/browser';

HyperDX.init({
apiKey: '<YOUR_API_KEY_HERE>',
service: 'my-frontend-app',
tracePropagationTargets: [/api.myapp.domain/i], // Set to link traces from frontend to backend requests
consoleCapture: true, // Capture console logs (default false)
advancedNetworkCapture: true, // Capture full HTTP request/response headers and bodies (default false)
});
```

## (Optional) Use [opentelemetry-instrumentation-remix](https://github.com/justindsmith/opentelemetry-instrumentations-js/tree/main/packages/instrumentation-remix) package for Node.js servers.

This will enable additional remix.request specific spans.

### Install
MikeShi42 marked this conversation as resolved.
Show resolved Hide resolved

```bash
npm install opentelemetry-instrumentation-remix
```

#### Create instrument.js file in application folder

```js
const { initSDK } = require('@hyperdx/node-opentelemetry');
const { RemixInstrumentation } = require('opentelemetry-instrumentation-remix');


initSDK({
consoleCapture: true, // optional, default: true
advancedNetworkCapture: true, // optional, default: false
additionalInstrumentations: [new RemixInstrumentation()]
});
```

### Run the Application with HyperDX

#### Using NPX

```bash
HYPERDX_API_KEY='<YOUR_HYPERDX_API_KEY>' OTEL_SERVICE_NAME='<YOUR_APP_NAME>' NODE_OPTIONS='-r <REALATIVE_TRACKING.JS_PATH>' remix dev
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also want to make sure this works with the command in prod env

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this assume users have 'remix' cli installed ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you guys already discussed this, but I'm wondering if it's better to just bundle remix into the default SDK setup so Remix users get a first-class experience as well?

```