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(instrumentation-dataloader): Enhance dataloader instrumentation. #2449

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

onurtemizkan
Copy link
Contributor

@onurtemizkan onurtemizkan commented Sep 24, 2024

Which problem is this PR solving?

  • Adds missing instrumentation for prime, clear and clearAll methods of dataloader

Short description of the changes

Related: getsentry/sentry-javascript#13664 and getsentry/sentry-javascript#13724

The current implementation of dataloader instrumentation creates spans for only load, loadMany and batch operations. With this PR, the instrumentation starts creating spans for synchronous 'non-read' operations, prime, clear, and clearAll.

Copy link

codecov bot commented Sep 24, 2024

Codecov Report

Attention: Patch coverage is 94.54545% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.79%. Comparing base (dfb2dff) to head (904a05b).
Report is 247 commits behind head on main.

Files with missing lines Patch % Lines
.../instrumentation-dataloader/src/instrumentation.ts 94.54% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2449      +/-   ##
==========================================
- Coverage   90.97%   90.79%   -0.19%     
==========================================
  Files         146      156      +10     
  Lines        7492     7766     +274     
  Branches     1502     1589      +87     
==========================================
+ Hits         6816     7051     +235     
- Misses        676      715      +39     
Files with missing lines Coverage Δ
.../instrumentation-dataloader/src/instrumentation.ts 97.38% <94.54%> (-1.70%) ⬇️

... and 76 files with indirect coverage changes

@onurtemizkan onurtemizkan force-pushed the onur/dataloader-improvements branch 7 times, most recently from 30b8494 to 3529ca6 Compare September 25, 2024 09:35
@@ -242,10 +250,139 @@ export class DataloaderInstrumentation extends InstrumentationBase<DataloaderIns
// .loadMany never rejects, as errors from internal .load
// calls are caught by dataloader lib
return original.call(this, ...args).then(value => {
span.setAttribute('cache.key', Array.from(args[0]));
span.setAttribute(
'cache.hit',
Copy link
Member

Choose a reason for hiding this comment

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

Unfortunately these are not official OTEL semantic conventions, so I think we cannot add these here. I think we'll need requestHook and add these ourselves. For now we should remove this.

There are no cache conventions for OTEL yet. We're thinking about donating our conventions upstream for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@AbhiPrasad - Should we add the requestHook with these updates, or in a separate PR?

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 add requestHook in a separate PR

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

Successfully merging this pull request may close these issues.

2 participants