Skip to content

Commit

Permalink
Refactor execute.next log event
Browse files Browse the repository at this point in the history
Reviewed By: tyao1

Differential Revision: D60399405

fbshipit-source-id: c3b74be2ab1accb72eb198144beee88af11d0b5e
  • Loading branch information
gordyf authored and facebook-github-bot committed Jul 30, 2024
1 parent 98b104f commit e995563
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,11 @@ describe('logging', () => {
networkRequestId: 100000,
},
{
name: 'execute.next',
name: 'execute.next.start',
executeId: 100001,
},
{
name: 'execute.next.end',
executeId: 100001,
},
{
Expand Down Expand Up @@ -1141,7 +1145,11 @@ describe('logging', () => {
networkRequestId: 100001,
},
{
name: 'execute.next',
name: 'execute.next.start',
executeId: 100002,
},
{
name: 'execute.next.end',
executeId: 100002,
},
{
Expand Down
14 changes: 8 additions & 6 deletions packages/relay-runtime/store/OperationExecutor.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,18 @@ class Executor<TMutation: MutationParameters> {
// Handle a raw GraphQL response.
_next(_id: number, response: GraphQLResponse): void {
this._schedule(() => {
const [start, duration] = withStartAndDuration(() => {
this._handleNext(response);
this._maybeCompleteSubscriptionOperationTracking();
this._log({
name: 'execute.next.start',
executeId: this._executeId,
response,
operation: this._operation,
});
this._handleNext(response);
this._maybeCompleteSubscriptionOperationTracking();
this._log({
name: 'execute.next',
name: 'execute.next.end',
executeId: this._executeId,
response,
duration,
start,
operation: this._operation,
});
});
Expand Down
16 changes: 11 additions & 5 deletions packages/relay-runtime/store/RelayStoreTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,12 +652,17 @@ export type ExecuteStartLogEvent = {
+cacheConfig: CacheConfig,
};

export type ExecuteNextLogEvent = {
+name: 'execute.next',
export type ExecuteNextStartLogEvent = {
+name: 'execute.next.start',
+executeId: number,
+response: GraphQLResponse,
+operation: OperationDescriptor,
};

export type ExecuteNextEndLogEvent = {
+name: 'execute.next.end',
+executeId: number,
+response: GraphQLResponse,
+duration: number,
+start: number,
+operation: OperationDescriptor,
};

Expand Down Expand Up @@ -778,7 +783,8 @@ export type LogEvent =
| NetworkCompleteLogEvent
| NetworkUnsubscribeLogEvent
| ExecuteStartLogEvent
| ExecuteNextLogEvent
| ExecuteNextStartLogEvent
| ExecuteNextEndLogEvent
| ExecuteAsyncModuleLogEvent
| ExecuteErrorLogEvent
| ExecuteCompleteLogEvent
Expand Down

0 comments on commit e995563

Please sign in to comment.