baselime / lambda-node-opentelemetry

OpenTelemetry auto tracer for Node.JS based AWS Lambda functions
https://baselime.io
Apache License 2.0
40 stars 3 forks source link

pino logs are not recieved by baselime #65

Open Mdev303 opened 6 months ago

Mdev303 commented 6 months ago

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

Ankcorn commented 6 months ago

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

Mdev303 commented 6 months ago

@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.

Ankcorn commented 6 months ago

What do you mean by not ideal?