lambda-node-opentelemetry icon indicating copy to clipboard operation
lambda-node-opentelemetry copied to clipboard

pino logs are not recieved by baselime

Open Mdev303 opened this issue 10 months ago • 3 comments

I am trying to setup logging to baselime using pino , I can see my traces but logs don't seem to work. In the log pannel of the trace I get the message: "There are no events matching the criteria in the selected timeframe The query didn't return any event."

this is the otel config I am using

/* eslint-disable @typescript-eslint/no-var-requires */
const { PinoInstrumentation } = require('@opentelemetry/instrumentation-pino')

const { BaselimeSDK } = require('@baselime/node-opentelemetry')
const {
	getNodeAutoInstrumentations
} = require('@opentelemetry/auto-instrumentations-node')

const sdk = new BaselimeSDK({
	instrumentations: [getNodeAutoInstrumentations(), new PinoInstrumentation()],
	service: 'server',
	baselimeKey: 'MY_KEY'
})

sdk.start()

and this is how I log

import pino from 'pino'
const logger = pino()

logger.info("posts")

In the console I can see the log being printed

 {"level":30,"time":1712507245438,"pid":16972,"hostname":"DESKTOP-IE8MVRK","trace_id":"cca13668880673edd47b43217a6c984c","span_id":"2117231e1a362282","trace_flags":"01","msg":"posts"

but no logs in baselime baselime_2 baselime_1

Mdev303 avatar Apr 07 '24 16:04 Mdev303

Hi @Mdev303,

This is the wrong repo. Have you tried our pino transport to send logs from pino to baselime?

https://github.com/baselime/pino-transport

Ankcorn avatar Apr 07 '24 18:04 Ankcorn

@Ankcorn sorry for the repo, it works with the transport but because it's not exported by otel , opentelemettry will create traces for the request sending the logs and send them to baselime it's not ideal.

Mdev303 avatar Apr 07 '24 19:04 Mdev303

What do you mean by not ideal?

Ankcorn avatar Apr 08 '24 09:04 Ankcorn