https://signoz.io logo
#support
Title
# support
e

Elie Ghazal

01/26/2023, 9:52 PM
I started implementing SigNoz with nestJs and GraphQL hosted on a K8S cluster. However, I have a question At a first look, I'm not able to see the body of the requests being captured in the traces Do you know where I can check the body of the requests? This is the trace.ts that I'm using.
Copy code
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'
import { Resource } from '@opentelemetry/resources'
import process from 'process'
import { GraphQLInstrumentation } from '@opentelemetry/instrumentation-graphql'
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http'
import { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core'
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
import { NodeSDK } from '@opentelemetry/sdk-node'
import { ConfigService } from '@nestjs/config'

export async function initTrace(configService: ConfigService<Record<string, unknown>, false>) {
    const exporterOptions = {
      url: configService.get<string>('gateway-graphql.APM_URL') || '0.0.0.0',
    }
    const traceExporter = new OTLPTraceExporter(exporterOptions)
  
    const tracer = new NodeSDK({
      traceExporter,
      instrumentations: [new GraphQLInstrumentation(),new HttpInstrumentation(),new NestInstrumentation()],
      resource: new Resource({
        [SemanticResourceAttributes.SERVICE_NAME]: 'gateway-graphql',
      }),
    })
  
    tracer
      .start()
      .then(() => console.log('Tracing initialized'))
      .catch((error) => console.log('Error initializing tracing', error))
  
  
  
    // gracefully shut down the SDK on process exit
    process.on('SIGTERM', () => {
      tracer
        .shutdown()
        .then(() => console.log('Tracing terminated'))
        .catch((error) => console.log('Error terminating tracing', error))
        .finally(() => process.exit(0))
    })
  
    await tracer.start()
    console.log('tracer.started')
  }
s

Srikanth Chekuri

01/27/2023, 12:11 AM
The request (or response) body is not captured. And there are many reasons to not capture. Non-exhaustive reasons 1. the amount of data will grow multifold 2. It will contain sensitive info. 3. It will lead to SDK’s poor performance of the additional overhead this introduces in terms of CPU, memory, and many more. In general practice, the request body is not captured as a part of tracing telemetry. If there is something you are interested in, you would instead make it something like a header and just capture it (that has config options).
e

Elie Ghazal

01/27/2023, 11:41 AM
Thank you @Srikanth Chekuri for he response.
Where to configure these kind of options ?
Plus, I got part of the body captured and the whole one, like only this one
Any way I can configure the rest ?
s

Srikanth Chekuri

01/27/2023, 12:07 PM
What configuration are you referring to? Can you be more specific?
e

Elie Ghazal

01/27/2023, 12:12 PM
The one you mentioned, where can to find a documentation for this configuration
s

Srikanth Chekuri

01/27/2023, 12:14 PM
Each instrumentation readme includes the detailed usage here https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/plugins/node
e

Elie Ghazal

01/27/2023, 12:16 PM
Will check it, thank you for the help !
7 Views