public void Dispose() { if (_disposed) return; var httpContext = GetHttpContextFrom(_context); if (httpContext == null) return; // handle any final request logging here (GraphQL query errors, success, etc) if (_context.Result.Errors is null) { _operation.Telemetry.Success = true; _operation.Telemetry.ResponseCode = "200"; } else { HandleErrors(_context.Result.Errors); _operation.Telemetry.Success = false; _operation.Telemetry.ResponseCode = "500"; } // Then stop the operation. This completes the request. _telemetryClient.StopOperation(_operation); _disposed = true; }