Skip to content

Commit

Permalink
docs: add changeset + update README
Browse files Browse the repository at this point in the history
  • Loading branch information
wrn14897 committed Jun 27, 2024
1 parent 980f8ee commit 65b9b2e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/silly-ravens-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperdx/node-opentelemetry': patch
---

fix: introduce pino mixin function to handle trace/span id injection issue
19 changes: 11 additions & 8 deletions packages/node-opentelemetry/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ configure your logging module.

```ts
import winston from 'winston';
import { getWinstonTransport } from '@hyperdx/node-opentelemetry';
import * as HyperDX from '@hyperdx/node-opentelemetry';

const MAX_LEVEL = 'info';

Expand All @@ -34,7 +34,7 @@ const logger = winston.createLogger({
format: winston.format.json(),
transports: [
new winston.transports.Console(),
getWinstonTransport(MAX_LEVEL), // append this to the existing transports
HyperDX.getWinstonTransport(MAX_LEVEL), // append this to the existing transports
],
});

Expand All @@ -45,18 +45,21 @@ export default logger;

```ts
import pino from 'pino';
import { getPinoTransport } from '@hyperdx/node-opentelemetry';
import * as HyperDX from '@hyperdx/node-opentelemetry';

const MAX_LEVEL = 'info';

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

export default logger;
```

### Configure Environment Variables
Expand Down
13 changes: 7 additions & 6 deletions packages/node-opentelemetry/examples/dummy.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ const mongoose = require('mongoose');
const mysql = require('mysql');
const mysql2 = require('mysql2');
const pg = require('pg');
const pino = require('pino');
const winston = require('winston');
const pino = require('pino');

const HyperDX = require('../build/src');

HyperDX.init({
apiKey: 'blabla',
apiKey: '',
});

// setTimeout(() => {
Expand Down Expand Up @@ -80,14 +80,15 @@ const logger = winston.createLogger({
],
});

const pinoLogger = pino(
pino.transport({
const pinoLogger = pino({
mixin: HyperDX.getPinoMixinFunction,
transport: {
targets: [
HyperDX.getPinoTransport('info'),
// other transports
],
}),
);
},
});

const bunyanLogger = bunyan.createLogger({ name: 'myapp' });

Expand Down

0 comments on commit 65b9b2e

Please sign in to comment.