Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Spans and nesting #226

Open
tsteckenborn opened this issue Sep 4, 2024 · 2 comments
Open

Custom Spans and nesting #226

tsteckenborn opened this issue Sep 4, 2024 · 2 comments
Labels

Comments

@tsteckenborn
Copy link

Hello everyone,

What's the current strategy and behaviour around doing your own spans within your coding?

trace
.getActiveSpan()!
.spanContext(),

Doesn't seem to work anymore with the latest updates, yet you can get e.g. the context via:

context
.active()
// @ts-expect-error
.getValue(cds?.context?._otelKey)
.spanContext(),

In case we use this data to create custom spans having the cap span as a parent, are further spans by the plugin taking the currently active span, or the span set by the plugin?

@github-actions github-actions bot added the new label Sep 4, 2024
@tsteckenborn
Copy link
Author

Hi @sjvans, might be interesting to also enable users to easily create
a) custom spans
b) span events (or e.g. also add cap logs to the span events)
so that everything can easily be seen or more fine granularily watched via otel traces

@soccermax
Copy link
Contributor

Hi @tsteckenborn,

yes some guidance would be nice. I managed to include telemetry into my NPM package with the following coding:
https://github.com/cap-js-community/event-queue/blob/23728cb3a1020f2ac512a102b6670a77ab473ae1/src/shared/openTelemetry.js#L15

This is nesting traces: always you call the trace function it's creates a span below the parent span. At the end it looks like this:

image

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

No branches or pull requests

2 participants