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/
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";
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