Julien-R44/pino-loki

Doesn't work at all with recent pino versions

sammko opened this issue · 3 comments

Let me know if I'm doing something wrong, but the following program

import { pino } from "pino";

const transport = pino.transport({
  target: 'pino-loki',
  options: { host: 'http://localhost:3100/', labels: { app: 'test' } }
})
const log = pino(transport)

for (let i = 0; i < 10; i++) {
  log.info({ i }, "asdf")
}

log.flush()

does not send anything to Loki. Other transports such as pino-pretty or pino/file work correctly. This is in a clean environment. I've tried an assortment of node versions from 17 to 20.

Downgrading to pino 8.0.0 (almost a year old) and setting "batching: false" in the options seems to help. I found this to be the breaking commit in pino, between 8.0 and 8.1. pinojs/pino@0395233

Ah, adding a

setTimeout(() => { }, 2000)

at the end together with "batching: false" ( or "batching: true, interval: 1") also works with recent pino versions.

So maybe this is the same issue as #7 after all.

Gonna take a look asap. thanks !

Should be fixed with 2.1.0. There was indeed an issue with it. Worker thread executing pino-loki was killed without sending the pending batch

Feel free to continue the discussion in #7 if issue persist for you