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

ref(getting-started-docs): Source sdks version from sentry release registry #54675

Conversation

priscilawebdev
Copy link
Member

@priscilawebdev priscilawebdev commented Aug 14, 2023

We're getting the SDK version from the sentry release registry and showing it for platforms that suggest a specific version for users to install.

It will be quite fast, but if the endpoint takes a bit longer to respond, a small '...loading' text will appear instead of a version number. During this time, users can't manually copy the code, and the button to copy it to the clipboard won't show up.

closes: #53921

Preview:

Screen.Recording.2023-08-17.at.14.57.14.mov

Related required PRs:

@priscilawebdev priscilawebdev requested a review from a team as a code owner August 14, 2023 11:38
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 14, 2023
@@ -275,6 +279,7 @@ export class Client {
this.baseUrl = options.baseUrl ?? '/api/0';
this.headers = options.headers ?? Client.JSON_HEADERS;
this.activeRequests = {};
this.credentials = options.credentials ?? 'include';
Copy link
Member Author

@priscilawebdev priscilawebdev Aug 14, 2023

Choose a reason for hiding this comment

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

This was creating a problem related to accessing data from another source (cross-origin issue) while trying to get information from the sentry release registry. With this update, we can now pass a custom credentials as this PR does for the getting-started-docs, passing omit

Comment on lines 27 to 29
sentry = "0.31.5"
sentry = "${sourcePackageRegistries?.data?.['sentry.rust'] ?? '0.30.0'}"
Copy link
Member

Choose a reason for hiding this comment

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

Should this be "0.31.5"?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh yes, I went through this list 2x but missed this one. Thanks 🙏

Comment on lines 24 to 30
const {isLoading, data} = useApiQuery<ReleaseRegistrySdk>(
['https://release-registry.services.sentry.io/sdks'],
{
staleTime: Infinity,
},
API_CLIENT
);
Copy link
Member

Choose a reason for hiding this comment

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

Do we have an OOTB error handling here? We should get a sentry error when this request fails so that we know that versions in the onboarding are defaulting to hardcoded ones (those might be ancient at that point in time).

Copy link
Member Author

@priscilawebdev priscilawebdev Aug 14, 2023

Choose a reason for hiding this comment

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

it is a good idea, but if this request fails, sentry should capture it OOTB or? I am not aware of places where we handle isError, other than in a few try...catch

Copy link
Member

Choose a reason for hiding this comment

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

sentry should capture it OOTB or?

yeah, that's what I'm wondering as well because I don't know by heart if we capture it by default these days

it's pretty important that we log this, otherwise, we won't notice this error is happening and people will just install old versions of the SDK - is there some way we can validate whether we log it or not? just for peace of mind

Copy link
Member Author

Choose a reason for hiding this comment

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

you are right... unfortunately we our react-query layer still doesn't capture a request fail error

Comment on lines 27 to 29
sentry = "0.31.5"
sentry = "${sourcePackageRegistries?.data?.['sentry.rust'] ?? '0.30.0'}"
Copy link
Member Author

Choose a reason for hiding this comment

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

oh yes, I went through this list 2x but missed this one. Thanks 🙏

static/app/gettingStartedDocs/rust/rust.tsx Outdated Show resolved Hide resolved
@priscilawebdev priscilawebdev requested a review from a team as a code owner August 14, 2023 13:31
@priscilawebdev priscilawebdev requested review from a team August 14, 2023 13:31
@priscilawebdev priscilawebdev requested a review from a team as a code owner August 14, 2023 13:31
@priscilawebdev priscilawebdev requested review from a team August 14, 2023 13:31
@priscilawebdev priscilawebdev requested review from a team as code owners August 14, 2023 13:31
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 14, 2023
@github-actions
Copy link
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

@priscilawebdev priscilawebdev force-pushed the priscila/feat/getting-started-docs-source-sdk-version-from-sentry-release-registry branch from 3797eff to 51a106f Compare August 14, 2023 13:33
@priscilawebdev priscilawebdev removed the request for review from a team August 14, 2023 13:34
Comment on lines +35 to +42
useEffect(() => {
if (releaseRegistrySdk.error) {
handleXhrErrorResponse(
'Failed to fetch sentry release registry',
releaseRegistrySdk.error
);
}
}, [releaseRegistrySdk.error]);
Copy link
Member Author

Choose a reason for hiding this comment

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

this is meh but according to our slack discussion, we don't capture response errors out of the box as it was too noisy before and when we need to track them, we shall use handleXhrErrorResponse

Comment on lines +10 to +13
sourcePackageRegistries,
}: Partial<
Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
> = {}): LayoutProps['steps'] => [
Copy link
Member

Choose a reason for hiding this comment

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

I wish we could simplify this. It's quite clunky, especially because we repeat it in lots of places.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, I talked to Arthur about it too... we should definitely simplify this, but would prefer to do that in a separate PR

Comment on lines 36 to 45
? new Error(message, {
cause: {
responseText: err.responseText,
responseJSON: err.responseJSON,
status: err.status,
statusText: err.statusText,
name: err.name,
stack: err.stack,
},
})
Copy link
Member

Choose a reason for hiding this comment

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

This should ideally be a separate PR - I have very little confidence reviewing this peace. Do we know which field is causing troubles? The only difference I can see is cause,message vs responseJSON.

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.

The main benefit of having this "layer" between the frontend and the release registry is the cache as mentioned above. A process runs every 5 minutes to get the list from the registry, but is this really a big advantage? We're also using caching in the UI with React Query.

I think it's just so we have a single way of grabbing this data - but since it requires more backend changes not worth the effort IMO.

We can keep iterating on these views after merge!

@priscilawebdev
Copy link
Member Author

priscilawebdev commented Aug 17, 2023

This should ideally be a separate PR - I have very little confidence reviewing this peace. Do we know which field is causing troubles? The only difference I can see is cause,message vs responseJSON.

I am not sure if the problem is because we pass cause as a sub-property of cause but with this change, everything seems to be working well.. I will create a separate PR for this, but until then, probably we won't be capturing request errors.

I also asked Billy but he is not sure why this is not working

@priscilawebdev priscilawebdev enabled auto-merge (squash) August 17, 2023 14:08
@priscilawebdev priscilawebdev merged commit d5615b9 into master Aug 17, 2023
49 checks passed
@priscilawebdev priscilawebdev deleted the priscila/feat/getting-started-docs-source-sdk-version-from-sentry-release-registry branch August 17, 2023 14:37
@priscilawebdev priscilawebdev added the Trigger: Revert Add to a merged PR to revert it (skips CI) label Aug 17, 2023
@getsentry-bot
Copy link
Contributor

PR reverted: 0f1c8ff

getsentry-bot added a commit that referenced this pull request Aug 17, 2023
…lease registry (#54675)"

This reverts commit d5615b9.

Co-authored-by: priscilawebdev <29228205+priscilawebdev@users.noreply.github.com>
@priscilawebdev
Copy link
Member Author

Reverting this PR since after merging there is a cross-origin issue 😞

image

@priscilawebdev priscilawebdev restored the priscila/feat/getting-started-docs-source-sdk-version-from-sentry-release-registry branch August 17, 2023 15:31
@priscilawebdev priscilawebdev removed the Trigger: Revert Add to a merged PR to revert it (skips CI) label Aug 17, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[EPIC] Source SDK versions from release registry
6 participants