Skip to content

Commit

Permalink
feat: Measure duration of driver separately from duration of resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
peacekeeper committed Jun 26, 2024
1 parent 305145a commit 0c2271d
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,16 @@ private ResolveResult resolveOrResolveRepresentation(String didString, Map<Strin

// [resolve]

long driverStart = 0, driverStop = -1;

if (! extensionStatus.skipResolve()) {

if (log.isInfoEnabled()) log.info("Resolving DID: " + did);

driverStart = System.currentTimeMillis();
ResolveResult driverResolveResult = this.resolveOrResolveRepresentationWithDrivers(did, resolutionOptions, resolveRepresentation);
driverStop = System.currentTimeMillis();

if (driverResolveResult != null) {
if (resolveResult instanceof ResolveDataModelResult) ((ResolveDataModelResult) resolveResult).setDidDocument(((ResolveDataModelResult) driverResolveResult).getDidDocument());
if (resolveResult instanceof ResolveRepresentationResult) ((ResolveRepresentationResult) resolveResult).setDidDocumentStream(((ResolveRepresentationResult) driverResolveResult).getDidDocumentStream());
Expand All @@ -144,6 +149,7 @@ private ResolveResult resolveOrResolveRepresentation(String didString, Map<Strin

long stop = System.currentTimeMillis();
resolveResult.getDidResolutionMetadata().put("duration", stop - start);
resolveResult.getDidResolutionMetadata().put("driverDuration", driverStop - driverStart);
resolveResult.getDidResolutionMetadata().put("did", did.toMap(false));

// done
Expand Down

0 comments on commit 0c2271d

Please sign in to comment.