gax-nodejs icon indicating copy to clipboard operation
gax-nodejs copied to clipboard

Provide additional call site context when exception originates in gRPC

Open bcoe opened this issue 3 years ago • 1 comments

Errors like RESOURCE_EXHAUSTED to not provide contextual information about where the exception occurs in a user's application:

Error: 8 RESOURCE_EXHAUSTED: Bandwidth exhausted
    at Object.callErrorFromStatus (/root/repo/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
    at Http2CallStream.<anonymous> (/root/repo/node_modules/@grpc/grpc-js/build/src/client.js:96:33)
    at Http2CallStream.emit (events.js:215:7)
    at Http2CallStream.EventEmitter.emit (domain.js:476:20)
    at /root/repo/node_modules/@grpc/grpc-js/build/src/call-stream.js:75:22
    at processTicksAndRejections (internal/process/task_queues.js:75:11) {
  code: 8,
  details: 'Bandwidth exhausted',
  metadata: Metadata { internalRepr: Map {}, options: {} },
  note: 'Exception occurred in retry method that was not classified as transient'
}

It would be nice if we knew the specific method call that triggered exceptions.

Refs: https://github.com/googleapis/nodejs-datastore/issues/525

bcoe avatar Mar 12 '21 22:03 bcoe

Facing the same issue over here.

Maybe an approach similar to what grpc implemented in https://github.com/grpc/grpc-node/commit/01823377be02b78869c92d8c147944a1b789139b would makes sense for gax.

On our case are calls with Cloud Tasks client. For what I've been able to see, the stack trace could be obtained until this promise at the createApiCall starts executing.

I think the calling context of the stack trace could be stored on the OnGoingCallPromise, then appended to the stack when the rejection function is called.

galaxyfeeder avatar Aug 21 '24 09:08 galaxyfeeder