private static ApolloTracingResultBuilder CreateBuilder(
        IDictionary <string, object?> contextData)
    {
        var builder = new ApolloTracingResultBuilder();

        contextData[nameof(ApolloTracingResultBuilder)] = builder;
        return(builder);
    }
 public ValidateDocumentScope(
     ApolloTracingResultBuilder builder,
     ITimestampProvider timestampProvider)
 {
     _builder           = builder;
     _timestampProvider = timestampProvider;
     _startTimestamp    = timestampProvider.NowInNanoseconds();
 }
 public ResolveFieldValueScope(
     IMiddlewareContext context,
     ApolloTracingResultBuilder builder,
     ITimestampProvider timestampProvider)
 {
     _context           = context;
     _builder           = builder;
     _timestampProvider = timestampProvider;
     _startTimestamp    = timestampProvider.NowInNanoseconds();
 }
 public RequestScope(
     IRequestContext context,
     DateTime startTime,
     ApolloTracingResultBuilder builder,
     ITimestampProvider timestampProvider)
 {
     _context           = context;
     _startTime         = startTime;
     _builder           = builder;
     _timestampProvider = timestampProvider;
 }
    public override IDisposable ExecuteRequest(IRequestContext context)
    {
        if (IsEnabled(context.ContextData))
        {
            DateTime startTime = _timestampProvider.UtcNow();

            ApolloTracingResultBuilder builder = CreateBuilder(context.ContextData);

            builder.SetRequestStartTime(
                startTime,
                _timestampProvider.NowInNanoseconds());

            return(new RequestScope(context, startTime, builder, _timestampProvider));
        }
        return(EmptyScope);
    }