Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

How can I add instrumentation to a GraphQL execution? #335

Answered by michael-fl
michael-fl asked this question in Q&A
Discussion options

You must be logged in to vote

Answering my own question. In the meantime I managed to do it this way:

final class RequestLoggingInstrumentation extends SimpleInstrumentation {

    private static final Logger logger = LoggerFactory.getLogger(RequestLoggingInstrumentation.class);

    @Override
    public InstrumentationContext<ExecutionResult> beginExecution(InstrumentationExecutionParameters parameters) {
        long startMillis = System.currentTimeMillis();
        var executionId = parameters.getExecutionInput().getExecutionId();

        if (logger.isInfoEnabled()) {
            logger.info("GraphQL execution {} started", executionId);

            var query = parameters.getQuery();
            logger.info("[{}] …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by oliemansm
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #335 on December 19, 2020 20:00.