Set a span parent without using the context
Azim-Palmer opened this issue · 0 comments
I'm struggling to see how to manually set a span's parent in the JS library
var tracer = tracingManager.getTracer();
const appStartupSpan = tracer.startSpan("AppStartup");
appStartupSpan.addEvent("IronHide starting");
// Some time later in
var childSpan = tracingManager.startSpan('AppStartup-ConnectToMetricsDatabase');
Reason for doing this is I have a node app, as soon as it loads I'd like to create a span called "AppStartup" so I know that process has started, however after several additional steps are done as part of startup that I can't wrap into a single execution function etc.
Ideally I can get the parents spanId and use that to manually connect spans I explicitly know are children of this span. I believe this works even when the parent span has already finished. This way I can tie together the 5 or so services that independently start but would be super useful to tie together under the AppStartup.
Looking at the source for tracer.startSpan I believe it would be reasonable to add a spanParentId onto the option object which overrides everything else.
Happy to create a PR.