General sensitivity analysis in data assimilation