GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(node): Add context info for missing instrumentation by chargome · Pull Request #12639 · getsentry/sentry-javascript

Conversation

@chargome

@chargome chargome commented Jun 25, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Adds context to the scope for missing instrumentation of node frameworks.

Fixes #12346

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chargome
feat(node): add context info for missing intrumentation
6fa2ccb
@chargome
chargome requested review from andreiborza and mydea June 25, 2024 11:34
@andreiborza

andreiborza commented Jun 25, 2024

Copy link
Copy Markdown
Member

Could we add a test for this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mydea
mydea reviewed Jun 25, 2024
View reviewed changes
Comment thread packages/node/src/utils/ensureIsWrapped.ts Outdated
}
});

getCurrentScope().setContext('Instrumentation', {

@mydea mydea Jun 25, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

m: This should be getGlobalScope(), I'd say - the current scope is very "volatile", putting this on the global scope ensures it will always be there!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chargome reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@chargome chargome Jun 25, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Was not sure about the scope, for the case if we have multiple frameworks in a project, would they overwrite each other?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@mydea mydea Jun 25, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

yes, the last would win! IMHO that's probably OK, but maybe you can also check with other folks on the team what they think about this :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mydea
mydea reviewed Jun 25, 2024
View reviewed changes
Comment thread packages/node/src/utils/ensureIsWrapped.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

chargome added 2 commits June 25, 2024 14:53
@chargome
feat: rename package attribute and add isCjs to context
49b5cbd
@chargome
test: Add e2e test for missing instrumentation
a26d2e9
andreiborza
andreiborza reviewed Jun 25, 2024
View reviewed changes
Comment thread dev-packages/e2e-tests/test-applications/node-express-incorrect-instrumentation/src/app.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

andreiborza
andreiborza approved these changes Jun 25, 2024
View reviewed changes

@andreiborza andreiborza left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

nice!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chargome reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@chargome
chargome marked this pull request as ready for review June 25, 2024 13:10
@chargome
chargome requested a review from mydea June 25, 2024 13:33
AbhiPrasad
AbhiPrasad previously requested changes Jun 25, 2024
View reviewed changes
Comment thread packages/node/src/utils/ensureIsWrapped.ts Outdated
}
});

getGlobalScope().setContext('Instrumentation', {

@AbhiPrasad AbhiPrasad Jun 25, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Suggested change
getGlobalScope().setContext('Instrumentation', {
getGlobalScope().setContext('instrumentation', {

If we are adding new context, let's please make sure this is documented in https://develop.sentry.dev/sdk/event-payloads/contexts/

I also fear that instrumentation is a pretty big namespace to take, and could collide with custom contexts relatively easily. Could we think about a name that potentially has less collisions?

We can discuss naming, and evaluate what exact fields should be here in the PR to develop https://develop.sentry.dev/sdk/event-payloads/contexts/. We might want to re-evaluate isCjs for example because it is JS specific, and contexts should be agnostic to language as much as possible.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mydea reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

@AbhiPrasad AbhiPrasad Jun 25, 2024

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

alternate is to namespace the context javascript_instrumentation - but we should still make sure it shows up in develop.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@chargome chargome Jun 25, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

@AbhiPrasad

What about missing_instrumentation?

If we exclude the isCjs, it might make sense to replace the new context altogether with just a tag?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@andreiborza andreiborza Jun 25, 2024

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Or have a generic extra object? Not sure if that's compatible tho, just thinking out loud.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@AbhiPrasad AbhiPrasad Jun 25, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I like missing_instrumentation. isCjs does seems important, but we can get around this by namespacing the context keys with javascript.X to indicate language specific instrumentation errors.

contexts also tend to follow snake case as they are formatted for the backend.

interface MissingInstrumentationContext {
  // Note: This seems redundant because the existence of `missing_instrumentation` context should
  // indicate `is_missing: true`
  is_missing: boolean;
  // package name
  // this should probably be required
  package: string;
  ['javascript.is_cjs']?: boolean;
}

The SDK should avoid setting tags as much as possible because tags are meant for user-set values. In fact tags we "automatically" add like browser and os are actually converted from contexts to tags by the sentry backend during event ingestion. Tags are indexed and searchable in our backend, so setting new one's automatically puts a burden on the infrastructure that we'd much rather be able to control dynamically (hence the mechanism to "promote" certain contexts to tags like we do for browser).

extra also makes sense, but it is soft-deprecated, and the product/relay does not have code (like it does for contexts) to handle it.

Hence I think picking contexts is the right vehicle for this because we can easily adapt relay/frontend/backend in the product-side to read contexts and use them, and it makes sense for the product to use these values for better onboarding/troubleshooting.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chargome and andreiborza reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

@chargome chargome Jun 25, 2024

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Got it, thanks for the clarification on tags!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@chargome
feat: update context for missing instrumentation
eae9855
@chargome
chargome force-pushed the cg/add-instrumentation-info-to-ctx branch from c06cca0 to eae9855 Compare June 25, 2024 15:45
AbhiPrasad
AbhiPrasad reviewed Jun 25, 2024
View reviewed changes
Comment thread packages/node/src/integrations/context.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@AbhiPrasad
AbhiPrasad dismissed their stale review June 25, 2024 18:21

Don't want to block merge

@chargome
ref: Move context create fn to utils
83cda6b
andreiborza
andreiborza reviewed Jun 26, 2024
View reviewed changes
Comment thread packages/types/src/context.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

andreiborza
andreiborza approved these changes Jun 26, 2024
View reviewed changes
@chargome
chargome merged commit c7f21ca into develop Jun 26, 2024
@chargome
chargome deleted the cg/add-instrumentation-info-to-ctx branch June 26, 2024 07:57
@chargome chargome self-assigned this Jun 26, 2024
@chargome chargome mentioned this pull request Jun 26, 2024
feat: Add docs for missing instrumentation context getsentry/develop#1320
Merged
@q1blue q1blue mentioned this pull request Jul 18, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.13.0 https-quantumblockchainai-atlassian-net/ossinsight#773
Open
@FengShangWuQi FengShangWuQi mentioned this pull request Jul 21, 2024
[Snyk] Upgrade @sentry/gatsby from 7.20.0 to 8.13.0 FengShangWuQi/fengshangwuqi.github.io#1909
Closed
@TheSlimvReal TheSlimvReal mentioned this pull request Jul 25, 2024
[Snyk] Upgrade @sentry/browser from 8.13.0 to 8.14.0 Aam-Digital/ndb-core#2477
Merged
This was referenced Jul 26, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.14.0 https-quantumblockchainai-atlassian-net/ossinsight#781
Open
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.15.0 https-quantumblockchainai-atlassian-net/ossinsight#783
Open
@aam-digital-ci aam-digital-ci mentioned this pull request Jul 27, 2024
[Snyk] Upgrade @sentry/browser from 8.13.0 to 8.15.0 Aam-Digital/ndb-core#2482
Closed
This was referenced Jul 30, 2024
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.16.0 https-quantumblockchainai-atlassian-net/ossinsight#787
Open
[Snyk] Upgrade @sentry/react from 7.16.0 to 8.17.0 https-quantumblockchainai-atlassian-net/ossinsight#791
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@andreiborza andreiborza andreiborza approved these changes
@mydea mydea Awaiting requested review from mydea
+1 more reviewer
@AbhiPrasad AbhiPrasad AbhiPrasad left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@chargome chargome

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add info about missing instrumentation to SDK context

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@chargome @andreiborza @mydea @AbhiPrasad
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.