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](https://private-user-images.githubusercontent.com/98104308/341666618-2f4a7a36-e76b-4594-a1da-8024bca10937.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI3MTU1MjMsIm5iZiI6MTcyMjcxNTIyMywicGF0aCI6Ii85ODEwNDMwOC8zNDE2NjY2MTgtMmY0YTdhMzYtZTc2Yi00NTk0LWExZGEtODAyNGJjYTEwOTM3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAzVDIwMDAyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQzOTRmODE3OThmMGNkZjk1M2RjM2Y2Mjc1NjI3MjFkZDU3NWFmOTI0NWMxNzhhNWVjOTk5ZGZhOTI0NDM1NWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nCocxpEMReP9psVBAEKFqQxCND40qjJtdKd3XzwgaQs)
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.