File tree Expand file tree Collapse file tree 11 files changed +37
-16
lines changed
internal-plugins/functions
state-machines/query-running Expand file tree Collapse file tree 11 files changed +37
-16
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { Renderer } from "react-dom"
33import { EventEmitter } from "events"
44import { WindowLocation , NavigateFn , NavigateOptions } from "@reach/router"
55import { Reporter } from "gatsby-cli/lib/reporter/reporter"
6+ import { Span } from "opentracing"
67export { Reporter }
78import {
89 EnumTypeComposerAsObjectDefinition as ComposeEnumTypeConfig ,
@@ -916,7 +917,7 @@ export interface WrapRootElementNodeArgs extends NodePluginArgs {
916917}
917918
918919export interface ParentSpanPluginArgs extends NodePluginArgs {
919- parentSpan : object
920+ parentSpan : Span
920921}
921922
922923export interface NodePluginArgs {
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ export async function bootstrap(
6868
6969 await createPages ( context )
7070
71- await handleStalePageData ( )
71+ await handleStalePageData ( parentSpan )
7272
7373 await rebuildSchemaWithSitePage ( context )
7474
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ module.exports = async function build(program: IBuildArgs): Promise<void> {
205205 rewriteActivityTimer . end ( )
206206 }
207207
208- await flushPendingPageDataWrites ( )
208+ await flushPendingPageDataWrites ( buildSpan )
209209 markWebpackStatusAsDone ( )
210210
211211 if ( telemetry . isTrackingEnabled ( ) ) {
Original file line number Diff line number Diff line change @@ -327,8 +327,11 @@ let isFirstBuild = true
327327export async function onPreBootstrap ( {
328328 reporter,
329329 store,
330+ parentSpan,
330331} : ParentSpanPluginArgs ) : Promise < void > {
331- const activity = reporter . activityTimer ( `Compiling Gatsby Functions` )
332+ const activity = reporter . activityTimer ( `Compiling Gatsby Functions` , {
333+ parentSpan,
334+ } )
332335 activity . start ( )
333336
334337 const {
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export const startPluginRunner = (): void => {
6868 if ( node . internal . type === `SitePage` ) {
6969 apiRunnerNode ( `onCreateNode` , {
7070 node,
71+ parentSpan : action . parentSpan ,
7172 traceTags : { nodeId : node . id , nodeType : node . internal . type } ,
7273 } )
7374 }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { IGatsbyCLIState } from "gatsby-cli/src/reporter/redux/types"
66import { ThunkAction } from "redux-thunk"
77import { InternalJob , JobResultInterface } from "../utils/jobs/manager"
88import { ITypeMetadata } from "../schema/infer/inference-metadata"
9+ import { Span } from "opentracing"
910
1011type SystemPath = string
1112type Identifier = string
@@ -790,6 +791,9 @@ export interface ICreateNodeAction {
790791 type : `CREATE_NODE`
791792 payload : IGatsbyNode
792793 oldNode ?: IGatsbyNode
794+ traceId : string
795+ parentSpan : Span
796+ followsSpan : Span
793797}
794798
795799export interface IAddFieldToNodeAction {
Original file line number Diff line number Diff line change @@ -107,7 +107,9 @@ export async function createPages({
107107 `Deleted ${ deletedPages . length } page${ deletedPages . length === 1 ? `` : `s` } `
108108 )
109109
110- const tim = reporter . activityTimer ( `Checking for changed pages` )
110+ const tim = reporter . activityTimer ( `Checking for changed pages` , {
111+ parentSpan,
112+ } )
111113 tim . start ( )
112114
113115 const { changedPages } = findChangedPages (
Original file line number Diff line number Diff line change @@ -427,9 +427,13 @@ export async function initialize({
427427
428428 // Init plugins once cache is initialized
429429 if ( _CFLAGS_ . GATSBY_MAJOR === `4` ) {
430- await apiRunnerNode ( `onPluginInit` )
430+ await apiRunnerNode ( `onPluginInit` , {
431+ parentSpan : activity . span ,
432+ } )
431433 } else {
432- await apiRunnerNode ( `unstable_onPluginInit` )
434+ await apiRunnerNode ( `unstable_onPluginInit` , {
435+ parentSpan : activity . span ,
436+ } )
433437 }
434438
435439 activity . end ( )
Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ export async function sourceNodes({
3131
3232 reporter . verbose ( `Checking for deleted pages` )
3333
34- const tim = reporter . activityTimer ( `Checking for changed pages` )
34+ const tim = reporter . activityTimer ( `Checking for changed pages` , {
35+ parentSpan,
36+ } )
3537 tim . start ( )
3638
3739 const { changedPages, deletedPages } = findChangedPages (
Original file line number Diff line number Diff line change 77} from "xstate"
88import { enqueueFlush } from "../../utils/page-data"
99
10- export const flushPageData = ( ) : void => {
11- enqueueFlush ( )
10+ export const flushPageData = ( context : IQueryRunningContext ) : void => {
11+ enqueueFlush ( context . parentSpan )
1212}
1313
1414export const assignDirtyQueries = assign <
You can’t perform that action at this time.
0 commit comments