summaryrefslogtreecommitdiff
path: root/common/error_code_utils.cc
diff options
context:
space:
mode:
authorAmin Hassani <ahassani@chromium.org>2019-08-17 00:27:44 -0700
committerCommit Bot <commit-bot@chromium.org>2019-09-11 17:31:48 +0000
commitd3d84218cafbc1a95e7d6bbb775b495d1bebf4d2 (patch)
treefcfb47b000776c42b18f199565a43f0ab44e27d1 /common/error_code_utils.cc
parentc14801d0aaceefb0f67227c6ab7826061141fa12 (diff)
update_engine: Add internal error codes that used for metrics.
Whenever we are dealing with some problem that require defining error codes and sending UMA metrics, we need to define a new ErrorCode enum value. These error codes then will be used to send which UMA metric value to send. Some of the UMA metrics seems to have circumvent this process by introducing their own error codes without adding them to the global list of error codes. This CL introduces three new error codes: - kInternalLibCurlError - kUnresolvedHostError - kUnresolvedHostRecovered (Technically not an error code, but fits the description and use case of it.) That are then translated to the UMA metric values we send for DownloadErrorCode. In addition, this CL moves the responsibility of sending these UMA metrics from LibCurlHttpFetcher to OmahaRequestAction which is the more correct place to send it because that's where the operations are completed (success or failure) and we can safely decide on the value of UMA without risking to send overlapping or duplicated metrics. For example, previously we send kInternalLibCurlError in conjunction with the kUnresolvedHostError. But doing this can hide the fact that these two error codes might be related and caused by the same underlying issue. Same goes for kUnresolvedHostError and kUnresolvedHosRecovered. If we send both these metrics at the same time, then we need to subtract the number of kUnresolvedHosRecovered from kUnresolvedHostError to figure out the number of unresolved host errors that did not recover. By exclusively sending one or another. We can see exactly how many are recovered and how many did not. Although this might change the meaning of kUnresolvedHostError metric, in the long term it will not be an issue as all the results will converge to the new behavior. The enum.xml (chrome) is updated in crrev.com/c/1774101 BUG=None TEST=cros_workon_make --board=amd64-generic --test --noreconf update_engine Change-Id: I3c7bb5f6159a0bc3a37d55666572b9cd6730f3cb Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1759544 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
Diffstat (limited to 'common/error_code_utils.cc')
-rw-r--r--common/error_code_utils.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/common/error_code_utils.cc b/common/error_code_utils.cc
index b0bbbd4a..5bcbaa40 100644
--- a/common/error_code_utils.cc
+++ b/common/error_code_utils.cc
@@ -161,6 +161,12 @@ string ErrorCodeToString(ErrorCode code) {
return "ErrorCode::kFirstActiveOmahaPingSentPersistenceError";
case ErrorCode::kVerityCalculationError:
return "ErrorCode::kVerityCalculationError";
+ case ErrorCode::kInternalLibCurlError:
+ return "ErrorCode::kInternalLibCurlError";
+ case ErrorCode::kUnresolvedHostError:
+ return "ErrorCode::kUnresolvedHostError";
+ case ErrorCode::kUnresolvedHostRecovered:
+ return "ErrorCode::kUnresolvedHostRecovered";
// Don't add a default case to let the compiler warn about newly added
// error codes which should be added here.
}