Merge "Adding in Logic to hold Split 1/3 - InitPhase" into udc-dev

This commit is contained in:
Arpan Kaphle
2023-03-07 22:13:10 +00:00
committed by Android (Google) Code Review
3 changed files with 80 additions and 11 deletions

View File

@@ -18,6 +18,9 @@ package com.android.server.credentials.metrics;
/** /**
* The central candidate provider metric object that mimics our defined metric setup. * 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+ * TODO(b/270403549) - iterate on this in V3+
*/ */
public class CandidateProviderMetric { public class CandidateProviderMetric {

View File

@@ -22,6 +22,9 @@ import com.android.server.credentials.MetricUtilities;
/** /**
* The central chosen provider metric object that mimics our defined metric setup. * 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+ * TODO(b/270403549) - iterate on this in V3+
*/ */
public class ChosenProviderMetric { public class ChosenProviderMetric {
@@ -65,12 +68,12 @@ public class ChosenProviderMetric {
/** /**
* In order for a chosen provider to be selected, the call must have successfully begun. * 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. * this chosen provider metric.
* *
* @param preQueryPhaseLatencyMicroseconds the millisecond latency for the service start, * @param preQueryPhaseLatencyMicroseconds the millisecond latency for the service start,
* typically passed in through the * typically passed in through the
* {@link PreCandidateMetric} * {@link InitialPhaseMetric}
*/ */
public void setPreQueryPhaseLatencyMicroseconds(int preQueryPhaseLatencyMicroseconds) { public void setPreQueryPhaseLatencyMicroseconds(int preQueryPhaseLatencyMicroseconds) {
mPreQueryPhaseLatencyMicroseconds = preQueryPhaseLatencyMicroseconds; mPreQueryPhaseLatencyMicroseconds = preQueryPhaseLatencyMicroseconds;
@@ -112,7 +115,7 @@ public class ChosenProviderMetric {
/** /**
* Returns the full (platform invoked to response) latency in microseconds. Expects the * 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() { public int getEntireLatencyMicroseconds() {
return (int) ((this.mFinalFinishTimeNanoseconds return (int) ((this.mFinalFinishTimeNanoseconds
@@ -123,11 +126,11 @@ public class ChosenProviderMetric {
/** /**
* In order for a chosen provider to be selected, the call must have successfully begun. * 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. * chosen provider metric.
* *
* @param serviceBeganTimeNanoseconds the timestamp moment when the platform was called, * @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) { public void setServiceBeganTimeNanoseconds(long serviceBeganTimeNanoseconds) {
mServiceBeganTimeNanoseconds = serviceBeganTimeNanoseconds; mServiceBeganTimeNanoseconds = serviceBeganTimeNanoseconds;
@@ -188,8 +191,6 @@ public class ChosenProviderMetric {
- this.mServiceBeganTimeNanoseconds) / 1000); - this.mServiceBeganTimeNanoseconds) / 1000);
} }
/* ----------- Provider Status -------------- */ /* ----------- Provider Status -------------- */
public int getChosenProviderStatus() { public int getChosenProviderStatus() {

View File

@@ -18,19 +18,34 @@ package com.android.server.credentials.metrics;
/** /**
* This handles metrics collected prior to any remote calls to providers. * 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+ * TODO(b/270403549) - iterate on this in V3+
*/ */
public class PreCandidateMetric { public class InitialPhaseMetric {
private static final String TAG = "PreCandidateMetric"; 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 // Raw timestamps in nanoseconds, *the only* one logged as such (i.e. 64 bits) since it is a
// reference point. // reference point.
private long mCredentialServiceStartedTimeNanoseconds = -1; 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; private long mCredentialServiceBeginQueryTimeNanoseconds = -1;
public PreCandidateMetric() {
public InitialPhaseMetric() {
} }
/* ---------- Latencies ---------- */ /* ---------- Latencies ---------- */
@@ -62,4 +77,54 @@ public class PreCandidateMetric {
public long getCredentialServiceBeginQueryTimeNanoseconds() { public long getCredentialServiceBeginQueryTimeNanoseconds() {
return mCredentialServiceBeginQueryTimeNanoseconds; 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;
}
} }