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 58852e2 commit 594f6c0
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,8 @@ private Map<String, Object> preloadProperties(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 @@ -1098,6 +1100,7 @@ private AtlasEntityHeader mapVertexToAtlasEntityHeader(AtlasVertex entityVertex,

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

Expand All @@ -1120,11 +1123,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 594f6c0

Please sign in to comment.