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

Retrieve and refresh integration insight on demand #499

Merged
merged 6 commits into from
Jan 6, 2022

Conversation

etsai-stripe
Copy link
Contributor

@etsai-stripe etsai-stripe commented Jan 6, 2022

https://jira.corp.stripe.com/browse/DX-7061

dependent on PR stripe/stripe-cli#803

Integration insight retrieved on demand. Refreshed when log becomes available on ES

Screen Shot 2022-01-05 at 5 41 39 PM
Screen Shot 2022-01-05 at 5 42 14 PM

Integration insight retrieved successfully. Matches the insight from dashboard

Screen Shot 2022-01-06 at 8 51 16 AM

Screen Shot 2022-01-06 at 8 51 33 AM

@etsai-stripe etsai-stripe requested review from vcheung-stripe and ianjabour-stripe and removed request for vcheung-stripe January 6, 2022 16:53
Copy link
Contributor

@ianjabour-stripe ianjabour-stripe left a comment

Choose a reason for hiding this comment

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

LGTM - walked through changes with @etsai-stripe and everything makes sense 👍

Copy link
Collaborator

@vcheung-stripe vcheung-stripe left a comment

Choose a reason for hiding this comment

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

I had a couple questions but it looks awesome!

Comment on lines 115 to 117
if (error.code === 12) {
// https://grpc.github.io/grpc/core/md_doc_statuscodes.html
// 12: UNIMPLEMENTED
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: the grpc library should have these error codes built in as constants.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i will use the grpc constants

Comment on lines 118 to 120
vscode.window.showErrorMessage(
'Please upgrade your Stripe CLI to the latest version to retrieve integration insight.',
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like we're not resolving the promise in this case. Would this cause the log to load indefinitely?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch!

// if insight has not been retrieved or previously failed to be retrieved, then retrieve it
if (!('insight' in logDetails) || logDetails.insight.includes('Failed to retrieve insight') || logDetails.insight.includes('Please check back later')) {
const insight = await getIntegrationInsight(logId, daemonClient);
logDetails.insight = insight;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: I wonder if we should avoid setting this field if there's no insight. So the user won't see an empty string. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

currently there could be empty insight. i am trying to distinguish between insight not retrieved yet and actual empty insight, so we dont keep retrieving insight for the same log.

@etsai-stripe etsai-stripe merged commit 40a884a into master Jan 6, 2022
@etsai-stripe etsai-stripe deleted the etsai/dx-7042 branch January 6, 2022 21:00
etsai-stripe added a commit that referenced this pull request Jan 19, 2022
etsai-stripe added a commit that referenced this pull request Jan 19, 2022
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.

4 participants