https://github.com/trentm/otellogsplay
/me playing with OTel logging
https://github.com/trentm/otellogsplay
logging opentelemetry
Last synced: about 1 month ago
JSON representation
/me playing with OTel logging
- Host: GitHub
- URL: https://github.com/trentm/otellogsplay
- Owner: trentm
- License: apache-2.0
- Created: 2023-07-10T23:05:15.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-10T23:28:17.000Z (almost 3 years ago)
- Last Synced: 2025-01-24T12:25:35.396Z (over 1 year ago)
- Topics: logging, opentelemetry
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
/me playing with OTel logging
Currently this is a proof-of-concept for an OTel Logs SDK appender for
[Bunyan](https://github.com/trentm/node-bunyan).
# Usage
```sh
npm install
node bunyan-otel.js
```
This creates a Bunyan logger with an "OTelBunyanAppender" stream. The OTel Logs
SDK is setup to emit records to the console. Any Bunyan logger methods are
emitted to the stdout (the default) and through the Logs SDK.
The [Bunyan appender is here](lib/OTelBunyanAppender.js).
# Open Questions and TODOs
- See "TODO"s in "lib/OTelBunyanAppender.js"
- See "Open questions" in "lib/OTelBunyanAppender.js"
- Call these "appenders" or Logger-specific naming (e.g. a "stream" for bunyan)?
- What package name?
- Where would these live? In opentelemetry-js-contrib/plugins/node?
In opentelemetry-js-contrib/packages?
In opentelemetry-js-contrib/experimental/packages?
- How, if at all, to interact with
https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node/opentelemetry-instrumentation-bunyan/
# TODO later
```js
// TODO: test with *only* the otel appender.
// var log = bunyan.createLogger({
// name: 'myapp',
// streams: [
// {
// type: 'raw',
// stream: new OTelBunyanAppender()
// }
// ]
// });
// log.info({time: 'foo'}, 'hi'); // Testing edge case with a given 'time' field.
```