Collecting origin in logging system
A first in the V4 injections into the framework, this quickly adds origin into the logging collection system. Over time, more collections will be added, with only an uncomment required after PWG review is complete, and the atom is checked in, for the emit. Bug: 271135048 Test: Build Test Change-Id: Ie5aa355abd451a2738de99d59aeeeb9194f3c348
This commit is contained in:
@@ -61,6 +61,8 @@ public final class CreateRequestSession extends RequestSession<CreateCredentialR
|
||||
super(context, sessionCallback, lock, userId, callingUid, request, callback,
|
||||
RequestInfo.TYPE_CREATE,
|
||||
callingAppInfo, enabledProviders, cancellationSignal, startedTimestamp);
|
||||
mRequestSessionMetric.collectCreateFlowInitialMetricInfo(
|
||||
/*origin=*/request.getOrigin() != null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,8 @@ public class GetRequestSession extends RequestSession<GetCredentialRequest,
|
||||
int numTypes = (request.getCredentialOptions().stream()
|
||||
.map(CredentialOption::getType).collect(
|
||||
Collectors.toSet())).size(); // Dedupe type strings
|
||||
mRequestSessionMetric.collectGetFlowInitialMetricInfo(numTypes);
|
||||
mRequestSessionMetric.collectGetFlowInitialMetricInfo(numTypes,
|
||||
/*origin=*/request.getOrigin() != null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -287,6 +287,8 @@ public class MetricUtilities {
|
||||
/* count_credential_request_classtypes */
|
||||
initialPhaseMetric.getCountRequestClassType()
|
||||
// TODO(b/271135048) - add total count of request options
|
||||
// TODO(b/271135048) - Uncomment once built past PWG review -
|
||||
// initialPhaseMetric.isOriginSpecified()
|
||||
);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Unexpected error during metric logging: " + e);
|
||||
|
||||
@@ -59,7 +59,8 @@ public class PrepareGetRequestSession extends GetRequestSession {
|
||||
int numTypes = (request.getCredentialOptions().stream()
|
||||
.map(CredentialOption::getType).collect(
|
||||
Collectors.toSet())).size(); // Dedupe type strings
|
||||
mRequestSessionMetric.collectGetFlowInitialMetricInfo(numTypes);
|
||||
mRequestSessionMetric.collectGetFlowInitialMetricInfo(numTypes,
|
||||
/*origin=*/request.getOrigin() != null);
|
||||
mPrepareGetCredentialCallback = prepareGetCredentialCallback;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,10 @@ public class InitialPhaseMetric {
|
||||
// over to the next latency object.
|
||||
private long mCredentialServiceBeginQueryTimeNanoseconds = -1;
|
||||
|
||||
// Indicates if the origin was specified when making this API request
|
||||
// TODO(b/271135048) - Emit once metrics approved
|
||||
private boolean mOriginSpecified = false;
|
||||
|
||||
|
||||
public InitialPhaseMetric() {
|
||||
}
|
||||
@@ -115,4 +119,12 @@ public class InitialPhaseMetric {
|
||||
public int getCountRequestClassType() {
|
||||
return mCountRequestClassType;
|
||||
}
|
||||
|
||||
public void setOriginSpecified(boolean originSpecified) {
|
||||
mOriginSpecified = originSpecified;
|
||||
}
|
||||
|
||||
public boolean isOriginSpecified() {
|
||||
return mOriginSpecified;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,13 +149,28 @@ public class RequestSessionMetric {
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects request class type count in the RequestSession flow.
|
||||
* Collects initializations for Create flow metrics.
|
||||
*
|
||||
* @param origin indicates if an origin was passed in or not
|
||||
*/
|
||||
public void collectCreateFlowInitialMetricInfo(boolean origin) {
|
||||
try {
|
||||
mInitialPhaseMetric.setOriginSpecified(origin);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Unexpected error during metric logging: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Collects initializations for Get flow metrics.
|
||||
*
|
||||
* @param requestClassTypeCount the number of class types in the request
|
||||
* @param origin indicates if an origin was passed in or not
|
||||
*/
|
||||
public void collectGetFlowInitialMetricInfo(int requestClassTypeCount) {
|
||||
public void collectGetFlowInitialMetricInfo(int requestClassTypeCount, boolean origin) {
|
||||
try {
|
||||
mInitialPhaseMetric.setCountRequestClassType(requestClassTypeCount);
|
||||
mInitialPhaseMetric.setOriginSpecified(origin);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Unexpected error during metric logging: " + e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user