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(gatsby-source-shopify): Add query runtime warning for CI environments #36142

Merged
merged 2 commits into from
Jul 29, 2022

Conversation

imjoshin
Copy link
Contributor

Description

In non-CI environments, we have an activity to track when queries are long-running. In CI environments (CI=1), we have no knowledge of long-running queries. This should help us have more insight into a shopify site's long build times.

Example:

warning Operation gid://shopify/BulkOperation/{SOME_ID} is still running after 60 seconds with status "RUNNING"
warning Operation gid://shopify/BulkOperation/{SOME_ID} is still running after 120 seconds with status "RUNNING" 

[sc-51358]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 15, 2022
@imjoshin imjoshin added topic: source-shopify Related to the gatsby-source-shopify plugin and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jul 15, 2022
@@ -68,6 +72,19 @@ export function createOperations(
while (!finishedStatuses.includes(currentBulkOperation.status)) {
await new Promise(resolve => setTimeout(resolve, 1000))
currentBulkOperation = (await currentOperation()).currentBulkOperation

// add warning for CI environments
Copy link
Contributor

Choose a reason for hiding this comment

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

@j0sh77 aren't there activities in Gatsby Cloud as well? What's different about CI vs local?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To be honest, I'm not sure what qualifies to be shown in Gatsby Cloud or not. I'm not seeing anything around these long-running queries in Cloud currently. The site I'm testing with definitely has a long running query that I can reproduce locally.

@LekoArts would you happen to know if there's other qualifies an activity to show up?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe the activityTimer call needs an id or parentSpan to show up in the UI? 🤔 For example this activity timer shows up there https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/commands/build.ts#L358-L363

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that could be. I think this warning is still a valuable add outside of the activity timer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have a screenshot of what this looks like on Gatsby Cloud? Just want to make sure it doesn't look super messy in the structured logs view.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

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 also added a slowdown. After the first few alerts, it starts increasing the time in which it warns.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I mean in the structured logs view. But since it's slowing down over time now it should be good :) I was just worried about getting a super long page in the structured view

@imjoshin imjoshin dismissed a stale review via ab2b338 July 28, 2022 12:01
@imjoshin imjoshin merged commit e90448f into master Jul 29, 2022
@imjoshin imjoshin deleted the shopify-query-warning branch July 29, 2022 14:49
imjoshin added a commit that referenced this pull request Aug 1, 2022
…ments (#36142)

* Add query runtime warning for CI environments

* Make timer better

(cherry picked from commit e90448f)
imjoshin added a commit that referenced this pull request Aug 1, 2022
…ments (#36142) (#36296)

* Add query runtime warning for CI environments

* Make timer better

(cherry picked from commit e90448f)

Co-authored-by: Josh Johnson <jcjohnson77@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-shopify Related to the gatsby-source-shopify plugin
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants