Skip to content

Commit

Permalink
add processing time
Browse files Browse the repository at this point in the history
  • Loading branch information
aarshi0301 committed Nov 28, 2024
1 parent 60fc7de commit bcc0af4
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,8 @@ private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex)

private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex, Set<String> attributes) throws AtlasBaseException {
AtlasPerfMetrics.MetricRecorder metricRecorder = RequestContext.get().startMetricRecord("mapVertexToAtlasEntityHeader");
AtlasPerfMetrics.MetricRecorder attributeProcessingRecorder = null;
boolean metricEnded = false;
AtlasEntityHeader ret = new AtlasEntityHeader();
try {
//pre-fetching the properties
Expand Down Expand Up @@ -1068,6 +1070,7 @@ private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex,
}

if (CollectionUtils.isNotEmpty(attributes)) {
attributeProcessingRecorder = RequestContext.get().startMetricRecord("attributeProcessingTime");
for (String attrName : attributes) {
AtlasAttribute attribute = entityType.getAttribute(attrName);

Expand All @@ -1090,11 +1093,17 @@ private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex,
if (attrValue != null) {
ret.setAttribute(attrName, attrValue);
}

}
RequestContext.get().endMetricRecord(attributeProcessingRecorder);
metricEnded = true;
}
}
}
finally {
if (!metricEnded) {
RequestContext.get().endMetricRecord(attributeProcessingRecorder);
}
RequestContext.get().endMetricRecord(metricRecorder);
}
return ret;
Expand Down

0 comments on commit bcc0af4

Please sign in to comment.