-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[4338] Improve the information available to debug performance issues
Bug: #4338 Signed-off-by: Stéphane Bégaudeau <[email protected]>
- Loading branch information
1 parent
4b778e9
commit e561110
Showing
11 changed files
with
143 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
= How to debug performance related issues | ||
|
||
== Backend | ||
|
||
In order to activate the log dedicated to performance measurement, you should use the configuration property `logging.level.sirius.web.performance=DEBUG`. | ||
Once activated it will also log all AQL expressions taking more than 200ms to execute. | ||
|
||
On top of that, it is recommended to debug performance issues to activate the GraphQL tracing support to find the time taken by each datafetcher. | ||
It can be done using the configuration property `sirius.web.graphql.tracing=true`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
packages/sirius-web/frontend/sirius-web-application/src/graphql/ApolloLoggerLink.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024, 2025 Obeo. | ||
* This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v2.0 | ||
* which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Obeo - initial API and implementation | ||
*******************************************************************************/ | ||
import { ApolloLink, FetchResult, NextLink, Observable, Operation } from '@apollo/client'; | ||
import { DefinitionNode, Kind, OperationDefinitionNode } from 'graphql/language'; | ||
|
||
const isOperationDefinitionNode = (definitionNode: DefinitionNode): definitionNode is OperationDefinitionNode => | ||
definitionNode.kind === Kind.OPERATION_DEFINITION; | ||
|
||
export class ApolloLoggerLink extends ApolloLink { | ||
override request(operation: Operation, forward: NextLink): Observable<FetchResult> | null { | ||
const node = operation.query.definitions.find((definitionNode) => isOperationDefinitionNode(definitionNode)); | ||
|
||
const operationKind: string = isOperationDefinitionNode(node) ? node.operation : 'unknown kind'; | ||
const operationName: string = isOperationDefinitionNode(node) ? node.name?.value : 'unknwown name'; | ||
|
||
console.debug(`${operationKind} ${operationName}: request sent`); | ||
|
||
if ('subscription' === operationKind) { | ||
return forward(operation); | ||
} | ||
|
||
return forward(operation).map((fetchResult) => { | ||
console.debug(`${operationKind} ${operationName}: response received`); | ||
return fetchResult; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters