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-drupal): Add tracing for full/delta fetches and http requests #33142

Merged
merged 6 commits into from
Sep 13, 2021

Conversation

KyleAMathews
Copy link
Contributor

@KyleAMathews KyleAMathews commented Sep 10, 2021

Trace the key parts of the gatsby-source-drupal lifecycle.

Full fetch:
Screen Shot 2021-09-10 at 11 42 30 AM

Delta fetch (fastbuilds):
Screen Shot 2021-09-10 at 11 42 53 AM

I've been working out a schema we can use across source plugins. The idea being that each source plugin is semantically similar so if we use span names then we can directly compare source plugins to each other.

Rules:

  • all span names in plugins are prefixed by the lifecycle method e.g. sourceNodes.fetch
  • set the plugin name as a tag on each span
  • source nodes fetch, touch nodes (if the fetch is delta), and create nodes. Name these spans sourceNodes.fetch, sourceNodes.touchNodes, and sourceNodes.createNodes
    • for fetch, set as tag if the fetch is full or delta
    • for touchNoes, set the count for how many nodes are touched
    • for createNodes, set if the fetch is delta or full & the count

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 10, 2021
@@ -375,6 +375,7 @@ const runAPI = async (plugin, api, args, activity) => {
const apiCallArgs = [
{
...args,
parentSpan: pluginSpan,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

plugin spans were being set as children of the run-api span instead of the run-plugin span — this fixes that

res.body.entities.length
)

const touchNodesSpan = tracer.startSpan(`touchNodes`, {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

touchNodes seems to start taking an inordinate amount of time as the node count grows. So let's track it.

agent,
cache: false,
// request: http2wrapper.auto,
// http2: true,
...options,
})

httpSpan.setTag(`http.status_code`, response.statusCode)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@KyleAMathews KyleAMathews added topic: source-drupal Related to Gatsby's integration with Drupal type: bug An issue or pull request relating to a bug in Gatsby and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Sep 10, 2021
benrobertsonio
benrobertsonio previously approved these changes Sep 13, 2021
Copy link
Contributor

@benrobertsonio benrobertsonio left a comment

Choose a reason for hiding this comment

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

looks good to me :)

@KyleAMathews KyleAMathews merged commit 91187da into master Sep 13, 2021
@KyleAMathews KyleAMathews deleted the drupal-tracing branch September 13, 2021 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-drupal Related to Gatsby's integration with Drupal type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants