0.6.2 • Published 3 days ago

@hyperdx/node-opentelemetry v0.6.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

HyperDX OpenTelemetry Node

OpenTelemetry Node Library for HyperDX

Install HyperDX OpenTelemetry Instrumentation Package

Use the following command to install the OpenTelemetry package.

npm install @hyperdx/node-opentelemetry

or

yarn add @hyperdx/node-opentelemetry

Add The Logger Transport

To collect logs from your application, you'll need to add a few lines of code to configure your logging module.

Winston Transport

import winston from 'winston';
import { getWinsonTransport } from '@hyperdx/node-opentelemetry';

const MAX_LEVEL = 'info';

const logger = winston.createLogger({
  level: MAX_LEVEL,
  format: winston.format.json(),
  transports: [
    new winston.transports.Console(),
    getWinsonTransport(MAX_LEVEL), // append this to the existing transports
  ],
});

export default logger;

Pino Transport

import pino from 'pino';
import { getPinoTransport } from '@hyperdx/node-opentelemetry';

const MAX_LEVEL = 'info';

const logger = pino(
  pino.transport({
    targets: [
      getPinoTransport(MAX_LEVEL),
      // other transports
    ],
  }),
);

Configure Environment Variables

Afterwards you'll need to configure the following environment variables in your shell to ship telemetry to HyperDX:

export HYPERDX_API_KEY=<YOUR_HYPERDX_API_KEY_HERE> \
OTEL_SERVICE_NAME='<NAME_OF_YOUR_APP_OR_SERVICE>'

Run the Application with HyperDX OpenTelemetry CLI

Option 1 (Recommended)

Now you can run the application with the HyperdxDX opentelemetry-instrument CLI.

npx opentelemetry-instrument index.js

Option 2

In case you want to run the application with a custom entry point (nodemon, ts-node, etc.).

Run your application with the following command (example using ts-node):

ts-node -r '@hyperdx/node-opentelemetry/build/src/tracing' index.js
0.7.0-next.2

3 days ago

0.7.0-next.1

6 days ago

0.7.0-next.0

6 days ago

0.6.2

13 days ago

0.6.2-next.0

13 days ago

0.6.1

2 months ago

0.6.0

2 months ago

0.6.0-next.0

2 months ago

0.5.0

2 months ago

0.5.0-next.0

2 months ago

0.4.2

4 months ago

0.4.2-next.2

5 months ago

0.4.2-next.1

5 months ago

0.4.2-next.0

5 months ago

0.4.1-next.1

5 months ago

0.4.1-next.0

5 months ago

0.4.1

5 months ago

0.4.0

5 months ago

0.1.7-next.0

10 months ago

0.1.7-next.1

10 months ago

0.4.0-next.2

6 months ago

0.4.0-next.3

6 months ago

0.2.0-next.3

9 months ago

0.2.0-next.2

9 months ago

0.2.0-next.1

9 months ago

0.2.0-next.0

9 months ago

0.3.4-next.1

6 months ago

0.3.3-next.0

7 months ago

0.3.0

7 months ago

0.2.1

8 months ago

0.3.3-next.1

7 months ago

0.2.0

8 months ago

0.2.0-next.5

9 months ago

0.2.0-next.4

9 months ago

0.1.8

9 months ago

0.1.7

10 months ago

0.1.9

9 months ago

0.3.2

7 months ago

0.2.3

8 months ago

0.3.1

7 months ago

0.2.2

8 months ago

0.3.4-next.0

6 months ago

0.3.3

7 months ago

0.0.10

12 months ago

0.1.0

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.0.9

12 months ago

0.0.8

12 months ago

0.1.4

11 months ago

0.0.5

1 year ago

0.1.3

11 months ago

0.0.4

1 year ago

0.1.6

11 months ago

0.0.7

12 months ago

0.1.5

11 months ago

0.0.6

12 months ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago