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

Home Page:https://signoz.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom Attributes for traces not showing in Signoz

StevenJBorik opened this issue · comments

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({
[SemanticResourceAttributes.SERVICE_NAME]: 'fretlabs_client',
}),
});

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!

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