Hi Team, I am new to SigNoz, I have a nest js appl...
# general
v
Hi Team, I am new to SigNoz, I have a nest js application running standalone and using nestjs-pino library for logging.. my logs are not exported to SigNoz.. can you help on this? instrumentations: [getNodeAutoInstrumentations()],
p
So OpenTelemetry for NodeJS today does not support exporting logs directly from the app level instrumentation Today we write the logs to a file and use the filelog receiver with the otel-collector to send the log to signoz https://signoz.io/docs/userguide/collect_logs_from_file/ this doc should help you understand better
v
Thanks Pranay. My production scenaio is deploy the application in kubernetes cluster.. will it automatically export logs? or still i have to write the logs in file
p
You will have to run a otel-collector either as a sidecar with each service or on the node / namespace level Today we run a sidecar otel-collector with each service and write logs to a shared volume between our app, nginx and otel-col where the otel-collector reads the log file from the shared volume and sends it upstream
We do it as a sidecar since we use ECS with Fargate ^^ but same logic should play well with k8s as well
v
Thanks Pranay
Hi Pranay
image.png
how to populate trace_id in log details.. trace id coming as part of body
I tried this way..
processors: attributes/log: actions: - key: trace_id action: upsert from_attribute: log.body.req.trace_id
logs: receivers: [otlp, tcplog/docker] processors: [attributes/log, batch] exporters: [clickhouselogsexporter]
but it’s not working
p
We managed to do it using Log Pipelines /
so we were able to extract it from the log
v
okay.. i will try that
Hi Pranay, FYI. I managed to populate trace_id and span_id from my log body with below processor configurations in otel-collector-config.yaml file
logstransform/json_parser: operators: - type: json_parser parse_from: body parse_to: attributes logstransform/trace: operators: - type: trace_parser if: ‘“trace_id” in attributes or “span_id” in attributes’ trace_id: parse_from: attributes.trace_id span_id: parse_from: attributes.span_id output: remove_trace_id - id: remove_trace_id type: remove if: ‘“trace_id” in attributes’ field: attributes.trace_id output: remove_span_id - id: remove_span_id type: remove if: ‘“span_id” in attributes’ field: attributes.span_id
no need to create pipelines
p
Oh thats great, might end up using that to have this done on the initial collector itself
v
Hi Pranay, I have a NestJS application which use Prisma library to interact with Postgres database.. I enabled both PrismaInstrumentation and PgInstrumentation.. but traces and DB metrics are not captured in SigNoz
p
Did you enable the Prisma previewFeature for instrumentation ?
v
yes i did.. but no luck
p
I remember getting it to work very recently like last week, could you share your instrumentation file?
v
Hi Pranay, now that Prisma instrumentation are captured. but DB metrics showing no data.. Enabled PgInstrumentation as well.
‘use strict’; import { OTLPTraceExporter } from ‘@opentelemetry/exporter-trace-otlp-http’; import { HttpInstrumentation } from ‘@opentelemetry/instrumentation-http’; import { NestInstrumentation } from ‘@opentelemetry/instrumentation-nestjs-core’; import { PinoInstrumentation } from ‘@opentelemetry/instrumentation-pino’; import { ExpressInstrumentation } from ‘@opentelemetry/instrumentation-express’; import { PrismaInstrumentation } from ‘@prisma/instrumentation’; import { PgInstrumentation } from ‘@opentelemetry/instrumentation-pg’; import { Resource } from ‘@opentelemetry/resources’; import * as opentelemetry from ‘@opentelemetry/sdk-node’; import { SimpleSpanProcessor, ConsoleSpanExporter } from ‘@opentelemetry/sdk-trace-base’; import { SEMRESATTRS_SERVICE_NAMESPACE, SEMRESATTRS_SERVICE_NAME } from ‘@opentelemetry/semantic-conventions’; import { getNodeAutoInstrumentations } from ‘@opentelemetry/auto-instrumentations-node’; // // Enable logging for debugging // import { diag, DiagConsoleLogger, DiagLogLevel } from ‘@opentelemetry/api’; // diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); // Configure the SDK to export telemetry data to the console // Enable all auto-instrumentations from the meta package const exporterOptions = { url: ‘http://localhost:4318/v1/traces’, }; const traceExporter = new OTLPTraceExporter(exporterOptions); const sdk = new opentelemetry.NodeSDK({ traceExporter, instrumentations: [ // getNodeAutoInstrumentations(), new NestInstrumentation(), new HttpInstrumentation(), // new PinoInstrumentation(), new ExpressInstrumentation(), new PgInstrumentation(), new PrismaInstrumentation({ middleware: true }) ], resource: new Resource({ [SEMRESATTRS_SERVICE_NAMESPACE]: ‘Testnet’, [SEMRESATTRS_SERVICE_NAME]: ‘Portal’ }), }); // initialize the SDK and register with the OpenTelemetry API // this enables the API to record telemetry sdk.start(); // gracefully shut down the SDK on process exit process.on(‘SIGTERM’, () => { sdk .shutdown() .then(() => console.log(‘Tracing terminated’)) .catch((error) => console.log(‘Error terminating tracing’, error)) .finally(() => process.exit(0)); }); export default sdk;
image.png,image.png
p
Yeah im not sure how to get those in, someone from the signoz team might be able to help better with taht
v
Hi, I am getting below exception while deploying signoz to AWS EKS cluster [2:21 PM] Vinoth Kumar Mohanraj {“level”“FATAL”,“timestamp”“2024-05-21T084937.434Z”,“caller”“clickhouseReader/reader.go145",“msg”:“failed to initialize ClickHouse”,“error”:“error connecting to primary db: code: 516, message: admin: Authentication failed: password is incorrect, or there is no user with such name.“,”stacktrace”:“go.signoz.io/signoz/pkg/query-service/app/clickhouseReader.NewReader\n\t/home/runner/work/signoz/signoz/pkg/query-service/app/clickhouseReader/reader.go:145\ngo.signoz.io/signoz/ee/query-service/app/db.NewDataConnector\n\t/home/runner/work/signoz/signoz/ee/query-service/app/db/reader.go:29\ngo.signoz.io/signoz/ee/query-service/app.NewServer\n\t/home/runner/work/signoz/signoz/ee/query-service/app/server.go139\nmain.main\n\t/home/runner/work/signoz/signoz/ee/query service/main.go146\nruntime.main\n\t/opt/hostedtoolcache/go/1.21.9/x64/src/runtime/proc.go:267”} [2:22 PM] Vinoth Kumar Mohanraj can someone help?