SigNoz / signoz

SigNoz is an open-source observability platform native to OpenTelemetry with logs, traces and metrics in a single application. An open-source alternative to DataDog, NewRelic, etc. 🔥 🖥. 👉 Open source Application Performance Monitoring (APM) & Observability tool
https://signoz.io
Other
17.56k stars 1.09k forks source link

Custom Attributes for traces not showing in Signoz #5301

Closed StevenJBorik closed 12 hours ago

StevenJBorik commented 1 week ago

Good evening,

I have the following scenario I was able to get working in flask environment very quickly but struggling with node.js.

I'm trying to switch out the default name/operations (fs open, middleware - query, fs stat, etc) that my client application is sending with custom attributes.

I have the standard tracer.js file:

'use` strict'; const process = require('process'); const opentelemetry = require('@opentelemetry/sdk-node'); const { getNodeAutoInstrumentations, } = require('@opentelemetry/auto-instrumentations-node'); const { OTLPTraceExporter, } = require('@opentelemetry/exporter-trace-otlp-http'); const { Resource } = require('@opentelemetry/resources'); const { SemanticResourceAttributes, } = require('@opentelemetry/semantic-conventions');

const exporterOptions = { url: 'http://localhost:4318/v1/traces', };

const traceExporter = new OTLPTraceExporter(exporterOptions); const sdk = new opentelemetry.NodeSDK({ traceExporter, instrumentations: [getNodeAutoInstrumentations()], // highlight-start resource: new Resource({

}), });

sdk.start();

process.on('SIGTERM', () => { sdk .shutdown() .then(() => console.log('Tracing terminated')) .catch((error) => console.log('Error terminating tracing', error)) .finally(() => process.exit(0)); });`

In my component I've tried something like:

const tracer = trace.getTracer('default'); const span = tracer.startSpan('fetch-user-profile', { attributes: { component: 'Profile', operation: 'fetchUserProfile', },

Also have tried the following, which I found in one of your sample applications:

span.setAttribute('fetchStatus', 'success');
span.setAttribute('userId', data.id);

I would expect to see traces like fetchUserProfile, fetchStatus, but instead my dashboard looks like:

image

Love the product, thank you!

welcome[bot] commented 1 week ago

Thanks for opening this issue. A team member should give feedback soon. In the meantime, feel free to check out the contributing guidelines.