https://signoz.io logo
#general
Title
# general
k

Krishan Kant

09/22/2022, 6:27 AM
Hi team , facing issue with nextjs integration
p

Pranay

09/22/2022, 6:28 AM
hey @Krishan Kant welcome to SigNoz community do share more details on what you have tried and what issue you are facing
k

Krishan Kant

09/22/2022, 6:31 AM
Getting some GRPC ERROR while running the app
@Pranay
p

Pranay

09/22/2022, 6:39 AM
@Ashu do you have ideas on this
a

Ashu

09/22/2022, 6:41 AM
@Krishan Kant can you share your
tracing.js
code?
k

Krishan Kant

09/22/2022, 6:42 AM
'use strict' const opentelemetry = require('@opentelemetry/sdk-node'); const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node'); const { OTLPTraceExporter } = require('@opentelemetry/exporter-otlp-grpc'); const {trace} = require("@opentelemetry/api"); const { Resource } = require('@opentelemetry/resources'); const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions'); // custom nextjs server const { startServer } = require('./server'); // configure the SDK to export telemetry data to the console // enable all auto-instrumentations from the meta package const exporterOptions = { url: 'http://localhost:4317', } const traceExporter = new OTLPTraceExporter(exporterOptions); const sdk = new opentelemetry.NodeSDK({ resource: new Resource({ [SemanticResourceAttributes.SERVICE_NAME]: 'Test-nach' }), traceExporter, instrumentations: [getNodeAutoInstrumentations()] }); const tracer = trace.getTracer( 'my-service-tracer' ); // initialize the SDK and register with the OpenTelemetry API // this enables the API to record telemetry sdk.start() .then(() => console.log('Tracing initialized')) .then(() => startServer()) .catch((error) => console.log('Error initializing tracing', error)); // 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)); }); module.exports = {sdk,tracer}
@Ashu
a

Ashu

09/22/2022, 6:47 AM
Can you update your
exporterOptions
to include the following and let me know: const exporterOptions = { url: 'http://localhost:4317', credentials: grpc.credentials.createInsecure(), } @Krishan Kant
k

Krishan Kant

09/22/2022, 6:57 AM
same issue @Ashu
a

Ashu

09/22/2022, 6:59 AM
Okay. Tagging @Vishal Sharma to help you out. Give us sometime to get back.
k

Krishan Kant

09/22/2022, 7:00 AM
sure
v

Vishal Sharma

09/22/2022, 7:23 AM
@Krishan Kant Which doc/tutorial did you follow? Please follow this: https://signoz.io/blog/opentelemetry-nextjs/
k

Krishan Kant

09/22/2022, 7:43 AM
followed the same @Vishal Sharma
4 Views