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

feat(node): Add dataloader integration #13664

Merged
merged 3 commits into from
Sep 19, 2024
Merged

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Sep 11, 2024

Resolves: #13313

Adds integration for dataloader using @opentelemetry/instrumentation-dataloader on the background.

A few notes:

  • We currently don't have access to the lookup / request as there is no hook from @opentelemetry/instrumentation-dataloader. So, we don't have cache.hit, cache.key, cache.item_size and so on, in this integration. I can try to implement those upstream, but if you have another way in mind to access those please let me know.
  • @opentelemetry/instrumentation-dataloader only records spans for load, loadMany and batch, which all are cache.get operations. There are also prime, clear, clearAll. We also can implement those upstream and update the integration in future.

Copy link
Contributor

github-actions bot commented Sep 11, 2024

size-limit report 📦

Path Size % Change Change
@sentry/browser 22.52 KB - -
@sentry/browser - with treeshaking flags 21.3 KB - -
@sentry/browser (incl. Tracing) 34.8 KB - -
@sentry/browser (incl. Tracing, Replay) 71.26 KB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 61.7 KB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 75.61 KB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 88.39 KB - -
@sentry/browser (incl. Tracing, Replay, Feedback, metrics) 90.23 KB - -
@sentry/browser (incl. metrics) 26.83 KB - -
@sentry/browser (incl. Feedback) 39.66 KB - -
@sentry/browser (incl. sendFeedback) 27.19 KB - -
@sentry/browser (incl. FeedbackAsync) 31.96 KB - -
@sentry/react 25.28 KB - -
@sentry/react (incl. Tracing) 37.77 KB - -
@sentry/vue 26.72 KB - -
@sentry/vue (incl. Tracing) 36.67 KB - -
@sentry/svelte 22.66 KB - -
CDN Bundle 23.83 KB - -
CDN Bundle (incl. Tracing) 36.56 KB - -
CDN Bundle (incl. Tracing, Replay) 71.02 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 76.33 KB - -
CDN Bundle - uncompressed 69.81 KB - -
CDN Bundle (incl. Tracing) - uncompressed 108.44 KB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 220.21 KB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 233.43 KB - -
@sentry/nextjs (client) 37.53 KB - -
@sentry/sveltekit (client) 35.37 KB - -
@sentry/node 121.77 KB +0.56% +685 B 🔺
@sentry/node - without tracing 93.41 KB -0.01% -1 B 🔽
@sentry/aws-serverless 103.11 KB -0.01% -1 B 🔽

View base workflow run

@onurtemizkan onurtemizkan changed the title feat(node): Add dataloader instrumentation feat(node): Add dataloader integration Sep 11, 2024
@onurtemizkan onurtemizkan requested review from mydea, AbhiPrasad and Lms24 and removed request for mydea September 11, 2024 13:07
@onurtemizkan onurtemizkan marked this pull request as ready for review September 11, 2024 13:08
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's create a GH issue in this repo to track the follow-up improvement to dataloader. We can then create GH issues in the OTEL repo accordingly.

Could you also link some example traces that have dataloader spans?


const INTEGRATION_NAME = 'Dataloader';

export const instrumentDataloader = generateInstrumentOnce(INTEGRATION_NAME, () => new DataloaderInstrumentation({}));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should set requireParentSpan to be true by default, and then expose config to change it accordingly, but I'm open to other opinions.

@mydea what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's set requireParentSpan to be true by default @onurtemizkan. We don't need to expose config for now, we can add that later based on user request.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realised it's also true by default in DataloaderIntegration. Still, passed true from our side, and we can expose it later if we need to.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this sounds reasonable to me, I guess you rarely want this to be a transaction!

@onurtemizkan
Copy link
Collaborator Author

Could you also link some example traces that have dataloader spans?

@AbhiPrasad, here's the trace of what we test in the integration tests. Link

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright let's get this in, and work toward improving stuff on it upstream!

@AbhiPrasad AbhiPrasad merged commit 2ab7518 into develop Sep 19, 2024
130 checks passed
@AbhiPrasad AbhiPrasad deleted the onur/dataloader-integration branch September 19, 2024 13:57
s1gr1d added a commit that referenced this pull request Sep 20, 2024
Adds the PR link to the changelog for easier access.

An entry would look like this:

> - feat(node): Add `dataloader` integration
([#13664](#13664))
> ```
> - feat(node): Add `dataloader` integration
([#13664](#13664))
> ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add dataloaderIntegration to Node
3 participants