Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Set a span parent without using the context #176

Open
Azim-Palmer opened this issue Jul 20, 2022 · 0 comments
Open

Set a span parent without using the context #176

Azim-Palmer opened this issue Jul 20, 2022 · 0 comments

Comments

@Azim-Palmer
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant