Loading services/credentials/java/com/android/server/credentials/metrics/CandidateProviderMetric.java +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.server.credentials.metrics; /** * The central candidate provider metric object that mimics our defined metric setup. * Some types are redundant across these metric collectors, but that has debug use-cases as * these data-types are available at different moments of the flow (and typically, one can feed * into the next). * TODO(b/270403549) - iterate on this in V3+ */ public class CandidateProviderMetric { Loading services/credentials/java/com/android/server/credentials/metrics/ChosenProviderMetric.java +8 −7 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import com.android.server.credentials.MetricUtilities; /** * The central chosen provider metric object that mimics our defined metric setup. * Some types are redundant across these metric collectors, but that has debug use-cases as * these data-types are available at different moments of the flow (and typically, one can feed * into the next). * TODO(b/270403549) - iterate on this in V3+ */ public class ChosenProviderMetric { Loading Loading @@ -65,12 +68,12 @@ public class ChosenProviderMetric { /** * In order for a chosen provider to be selected, the call must have successfully begun. * Thus, the {@link PreCandidateMetric} can directly pass this initial latency figure into * Thus, the {@link InitialPhaseMetric} can directly pass this initial latency figure into * this chosen provider metric. * * @param preQueryPhaseLatencyMicroseconds the millisecond latency for the service start, * typically passed in through the * {@link PreCandidateMetric} * {@link InitialPhaseMetric} */ public void setPreQueryPhaseLatencyMicroseconds(int preQueryPhaseLatencyMicroseconds) { mPreQueryPhaseLatencyMicroseconds = preQueryPhaseLatencyMicroseconds; Loading Loading @@ -112,7 +115,7 @@ public class ChosenProviderMetric { /** * Returns the full (platform invoked to response) latency in microseconds. Expects the * start time to be provided, such as from {@link PreCandidateMetric}. * start time to be provided, such as from {@link InitialPhaseMetric}. */ public int getEntireLatencyMicroseconds() { return (int) ((this.mFinalFinishTimeNanoseconds Loading @@ -123,11 +126,11 @@ public class ChosenProviderMetric { /** * In order for a chosen provider to be selected, the call must have successfully begun. * Thus, the {@link PreCandidateMetric} can directly pass this initial timestamp into this * Thus, the {@link InitialPhaseMetric} can directly pass this initial timestamp into this * chosen provider metric. * * @param serviceBeganTimeNanoseconds the timestamp moment when the platform was called, * typically passed in through the {@link PreCandidateMetric} * typically passed in through the {@link InitialPhaseMetric} */ public void setServiceBeganTimeNanoseconds(long serviceBeganTimeNanoseconds) { mServiceBeganTimeNanoseconds = serviceBeganTimeNanoseconds; Loading Loading @@ -188,8 +191,6 @@ public class ChosenProviderMetric { - this.mServiceBeganTimeNanoseconds) / 1000); } /* ----------- Provider Status -------------- */ public int getChosenProviderStatus() { Loading services/credentials/java/com/android/server/credentials/metrics/PreCandidateMetric.java→services/credentials/java/com/android/server/credentials/metrics/InitialPhaseMetric.java +69 −4 Original line number Diff line number Diff line Loading @@ -18,19 +18,34 @@ package com.android.server.credentials.metrics; /** * This handles metrics collected prior to any remote calls to providers. * Some types are redundant across these metric collectors, but that has debug use-cases as * these data-types are available at different moments of the flow (and typically, one can feed * into the next). * TODO(b/270403549) - iterate on this in V3+ */ public class PreCandidateMetric { public class InitialPhaseMetric { private static final String TAG = "PreCandidateMetric"; // The api being called, default set to unknown private int mApiName = ApiName.UNKNOWN.getMetricCode(); // The caller uid of the calling application, default to -1 private int mCallerUid = -1; // The session id to unite multiple atom emits, default to -1 private long mSessionId = -1; // A sequence id to order united emits, default to -1 private int mSequenceId = -1; private int mCountRequestClassType = -1; // Raw timestamps in nanoseconds, *the only* one logged as such (i.e. 64 bits) since it is a // reference point. private long mCredentialServiceStartedTimeNanoseconds = -1; // A reference point to give this object utility to capture latency. Can be directly handed // over to the next latency object. private long mCredentialServiceBeginQueryTimeNanoseconds = -1; public PreCandidateMetric() { public InitialPhaseMetric() { } /* ---------- Latencies ---------- */ Loading Loading @@ -62,4 +77,54 @@ public class PreCandidateMetric { public long getCredentialServiceBeginQueryTimeNanoseconds() { return mCredentialServiceBeginQueryTimeNanoseconds; } /* ------ ApiName ------ */ public void setApiName(int apiName) { mApiName = apiName; } public int getApiName() { return mApiName; } /* ------ CallerUid ------ */ public void setCallerUid(int callerUid) { mCallerUid = callerUid; } public int getCallerUid() { return mCallerUid; } /* ------ SessionId ------ */ public void setSessionId(long sessionId) { mSessionId = sessionId; } public long getSessionId() { return mSessionId; } /* ------ SequenceId ------ */ public void setSequenceId(int sequenceId) { mSequenceId = sequenceId; } public int getSequenceId() { return mSequenceId; } /* ------ Count Request Class Types ------ */ public void setCountRequestClassType(int countRequestClassType) { mCountRequestClassType = countRequestClassType; } public int getCountRequestClassType() { return mCountRequestClassType; } } Loading
services/credentials/java/com/android/server/credentials/metrics/CandidateProviderMetric.java +3 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.server.credentials.metrics; /** * The central candidate provider metric object that mimics our defined metric setup. * Some types are redundant across these metric collectors, but that has debug use-cases as * these data-types are available at different moments of the flow (and typically, one can feed * into the next). * TODO(b/270403549) - iterate on this in V3+ */ public class CandidateProviderMetric { Loading
services/credentials/java/com/android/server/credentials/metrics/ChosenProviderMetric.java +8 −7 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import com.android.server.credentials.MetricUtilities; /** * The central chosen provider metric object that mimics our defined metric setup. * Some types are redundant across these metric collectors, but that has debug use-cases as * these data-types are available at different moments of the flow (and typically, one can feed * into the next). * TODO(b/270403549) - iterate on this in V3+ */ public class ChosenProviderMetric { Loading Loading @@ -65,12 +68,12 @@ public class ChosenProviderMetric { /** * In order for a chosen provider to be selected, the call must have successfully begun. * Thus, the {@link PreCandidateMetric} can directly pass this initial latency figure into * Thus, the {@link InitialPhaseMetric} can directly pass this initial latency figure into * this chosen provider metric. * * @param preQueryPhaseLatencyMicroseconds the millisecond latency for the service start, * typically passed in through the * {@link PreCandidateMetric} * {@link InitialPhaseMetric} */ public void setPreQueryPhaseLatencyMicroseconds(int preQueryPhaseLatencyMicroseconds) { mPreQueryPhaseLatencyMicroseconds = preQueryPhaseLatencyMicroseconds; Loading Loading @@ -112,7 +115,7 @@ public class ChosenProviderMetric { /** * Returns the full (platform invoked to response) latency in microseconds. Expects the * start time to be provided, such as from {@link PreCandidateMetric}. * start time to be provided, such as from {@link InitialPhaseMetric}. */ public int getEntireLatencyMicroseconds() { return (int) ((this.mFinalFinishTimeNanoseconds Loading @@ -123,11 +126,11 @@ public class ChosenProviderMetric { /** * In order for a chosen provider to be selected, the call must have successfully begun. * Thus, the {@link PreCandidateMetric} can directly pass this initial timestamp into this * Thus, the {@link InitialPhaseMetric} can directly pass this initial timestamp into this * chosen provider metric. * * @param serviceBeganTimeNanoseconds the timestamp moment when the platform was called, * typically passed in through the {@link PreCandidateMetric} * typically passed in through the {@link InitialPhaseMetric} */ public void setServiceBeganTimeNanoseconds(long serviceBeganTimeNanoseconds) { mServiceBeganTimeNanoseconds = serviceBeganTimeNanoseconds; Loading Loading @@ -188,8 +191,6 @@ public class ChosenProviderMetric { - this.mServiceBeganTimeNanoseconds) / 1000); } /* ----------- Provider Status -------------- */ public int getChosenProviderStatus() { Loading
services/credentials/java/com/android/server/credentials/metrics/PreCandidateMetric.java→services/credentials/java/com/android/server/credentials/metrics/InitialPhaseMetric.java +69 −4 Original line number Diff line number Diff line Loading @@ -18,19 +18,34 @@ package com.android.server.credentials.metrics; /** * This handles metrics collected prior to any remote calls to providers. * Some types are redundant across these metric collectors, but that has debug use-cases as * these data-types are available at different moments of the flow (and typically, one can feed * into the next). * TODO(b/270403549) - iterate on this in V3+ */ public class PreCandidateMetric { public class InitialPhaseMetric { private static final String TAG = "PreCandidateMetric"; // The api being called, default set to unknown private int mApiName = ApiName.UNKNOWN.getMetricCode(); // The caller uid of the calling application, default to -1 private int mCallerUid = -1; // The session id to unite multiple atom emits, default to -1 private long mSessionId = -1; // A sequence id to order united emits, default to -1 private int mSequenceId = -1; private int mCountRequestClassType = -1; // Raw timestamps in nanoseconds, *the only* one logged as such (i.e. 64 bits) since it is a // reference point. private long mCredentialServiceStartedTimeNanoseconds = -1; // A reference point to give this object utility to capture latency. Can be directly handed // over to the next latency object. private long mCredentialServiceBeginQueryTimeNanoseconds = -1; public PreCandidateMetric() { public InitialPhaseMetric() { } /* ---------- Latencies ---------- */ Loading Loading @@ -62,4 +77,54 @@ public class PreCandidateMetric { public long getCredentialServiceBeginQueryTimeNanoseconds() { return mCredentialServiceBeginQueryTimeNanoseconds; } /* ------ ApiName ------ */ public void setApiName(int apiName) { mApiName = apiName; } public int getApiName() { return mApiName; } /* ------ CallerUid ------ */ public void setCallerUid(int callerUid) { mCallerUid = callerUid; } public int getCallerUid() { return mCallerUid; } /* ------ SessionId ------ */ public void setSessionId(long sessionId) { mSessionId = sessionId; } public long getSessionId() { return mSessionId; } /* ------ SequenceId ------ */ public void setSequenceId(int sequenceId) { mSequenceId = sequenceId; } public int getSequenceId() { return mSequenceId; } /* ------ Count Request Class Types ------ */ public void setCountRequestClassType(int countRequestClassType) { mCountRequestClassType = countRequestClassType; } public int getCountRequestClassType() { return mCountRequestClassType; } }