Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Create New Spans In gRPC Server RPC Methods #656

@chrisalexander55

Description

@chrisalexander55

Hi Everyone,

I am trying to create additional trace spans inside my gRPC rpc methods. I reviewed the API docs and examples but have not seen any firm guidance or working implementation. When I do call trace#createChildSpan, a null is returned. What am I doing wrong here? Here is an abbreviated code block from my server.js file:

const traceApi = require("@google-cloud/trace-agent").start({ projectId: "festivals-183900", keyFilename: googleSvcAccount }); server.addService(smtpTemplateProto.templatesPackage.SmtpTemplateSvc.service, { addBindable: (call: any, cb: any) => { let clientCn: Client; let data: Object; let rollBack: boolean = false; let spanAddBindable: any; try { // create spanAddBindable span spanAddBindable = traceApi.createChildSpan({ name: "Svc.BindableController#addBindable" }); console.log(spanAddBindable); <== evals as null! spanAddBindable.endSpan(); } catch(err) {} } }

Metadata

Metadata

Assignees

Labels

api: cloudtraceIssues related to the googleapis/cloud-trace-nodejs API.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions