void ClangdServer::applyTweak(PathRef File, Range Sel, StringRef TweakID,
Callback<Tweak::Effect> CB) {
- // Tracks number of times a tweak has been applied.
+ // Tracks number of times a tweak has been attempted.
static constexpr trace::Metric TweakAttempt(
"tweak_attempt", trace::Metric::Counter, "tweak_id");
+ // Tracks number of times a tweak has failed to produce edits.
+ static constexpr trace::Metric TweakFailed(
+ "tweak_failed", trace::Metric::Counter, "tweak_id");
TweakAttempt.record(1, TweakID);
auto Action = [File = File.str(), Sel, TweakID = TweakID.str(),
CB = std::move(CB),
if (llvm::Error Err = reformatEdit(E, Style))
elog("Failed to format {0}: {1}", It.first(), std::move(Err));
}
+ } else {
+ TweakFailed.record(1, TweakID);
}
return CB(std::move(*Effect));
};