2929import com .microsoft .identity .common .java .interfaces .INameValueStorage ;
3030import com .microsoft .identity .common .java .interfaces .IPlatformComponents ;
3131import com .microsoft .identity .common .java .opentelemetry .AttributeName ;
32+ import com .microsoft .identity .common .java .opentelemetry .OTelUtility ;
3233import com .microsoft .identity .common .java .opentelemetry .SpanExtension ;
3334import com .microsoft .identity .common .java .providers .oauth2 .OAuth2Strategy ;
3435import com .microsoft .identity .common .java .providers .oauth2 .OAuth2TokenCache ;
@@ -278,6 +279,7 @@ public ICacheRecord save(@NonNull AccountRecord accountRecord,
278279 @ Nullable RefreshTokenRecord refreshTokenRecord ,
279280 @ Nullable String familyId ) throws ClientException {
280281 final String methodName = ":save (5 args)" ;
282+ final long saveStartTime = System .currentTimeMillis ();
281283
282284 final ICacheRecord result ;
283285
@@ -319,7 +321,7 @@ public ICacheRecord save(@NonNull AccountRecord accountRecord,
319321 familyId ,
320322 mUid
321323 );
322-
324+ OTelUtility . recordElapsedTime ( AttributeName . elapsed_time_save_aggregated_account_data . name (), saveStartTime );
323325 return result ;
324326 }
325327
@@ -366,6 +368,7 @@ public synchronized List<ICacheRecord> saveAndLoadAggregatedAccountData(
366368 private List <ICacheRecord > loadAggregatedAccountData (final @ NonNull AbstractAuthenticationScheme authScheme ,
367369 final @ NonNull ICacheRecord cacheRecord ) {
368370 final String methodName = ":loadAggregatedAccountData" ;
371+ final long loadStartTime = System .currentTimeMillis ();
369372
370373 final String clientId = cacheRecord .getAccessToken ().getClientId ();
371374 final String target = cacheRecord .getAccessToken ().getTarget ();
@@ -386,14 +389,17 @@ private List<ICacheRecord> loadAggregatedAccountData(final @NonNull AbstractAuth
386389 return null ;
387390 }
388391
389- return cache .loadWithAggregatedAccountData (
392+ List < ICacheRecord > cacheRecordList = cache .loadWithAggregatedAccountData (
390393 clientId ,
391394 applicationIdentifier ,
392395 mamEnrollmentIdentifier ,
393396 target ,
394397 cacheRecord .getAccount (),
395398 authScheme
396399 );
400+ OTelUtility .recordElapsedTime (AttributeName .elapsed_time_load_aggregated_account_data .name (),
401+ loadStartTime );
402+ return cacheRecordList ;
397403 }
398404
399405 @ Override
0 commit comments