@otelic/open-telemetry
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

@otelic/open-telemetry

Otelic.com - easiest way to add Logs, Traces & Alerts to NodeJS app

Affordable, searchable logs and traces for your application. Start for free. No monthly payments. Get your FREE API Key in the Workspace Settings at Otelic. Enjoy searchable logs, traces and alerts.

Continue using default console methods, just logs will be available to search, create alerts, see trends at https://app.otelic.com

console.log("Hello");
console.info("Hello");
console.warn("Hello");
console.error("Hello");
console.debug("Hello");

This will also add automatic traces instrumentation. Traces allow to see exactly what happen during the call.

Learn more at https://otelic.com/

Step 1: Create instrumentation file

instrumentation.ts File can be js too with any name, any path.

process.env.OTELIC_API_KEY = "Get your free API KEY at https://app.otelic.com";
process.env.OTELIC_APP_NAME = "NodeJS App";
process.env.OTELIC_SERVICE_NAME = "My Service";
process.env.OTELIC_SERVICE_VERSION = "v1";

import "@otelic/open-telemetry";

Step 2: Load instrumentation before main app with -r

This works with JavaScript and TypeScript

package.json

{
  "scripts": {
    "start": "node -r ./instrumentation.ts app.ts"
  }
}

The -r flag in Node.js stands for --require, and it allows you to preload a module before your main script runs.

If you need to preload multiple modules before your app, just use -r multiple times like so: node -r instrumentation.js -r else.js app.js

You can preload multiple modules with multiple -r flags:

  node -r ./instrumentation.ts -r ./otherSetup.ts app.ts

Step 3: Check https://app.otelic.com

  • Searchable logs
  • Create alert to trigger when errors happen for automations
  • Explore traces

**Otelic.com - easiest way to add Logs, Traces & Alerts to NodeJS app **

Package Sidebar

Install

npm i @otelic/open-telemetry

Homepage

otelic.com

Weekly Downloads

6

Version

1.0.11

License

MIT

Unpacked Size

21.3 kB

Total Files

11

Last publish

Collaborators

  • liesislukas