-
Notifications
You must be signed in to change notification settings - Fork 4
Service Internal Latency #12
Conversation
|
||
@Override | ||
public void enrichEvent(StructuredTrace trace, Event event) { | ||
var apiBoundaryType = event.getEnrichedAttributes().getAttributeMap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Override | ||
public void enrichEvent(StructuredTrace trace, Event event) { | ||
var apiBoundaryType = event.getEnrichedAttributes().getAttributeMap() | ||
.get(API_BOUNDARY_TYPE_ATTR_NAME).getValue(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think according to ApiBoundaryTypeAttributeEnricher
, API_BOUNDARY_TYPE_ATTR_NAME
key will not always be set.
private static boolean isEligibleForSubtraction(Event childEvent) { | ||
var apiBoundaryType = childEvent.getEnrichedAttributes().getAttributeMap() | ||
.get(API_BOUNDARY_TYPE_ATTR_NAME); | ||
return apiBoundaryType != null && apiBoundaryType.getValue().equals(EXIT_BOUNDARY_TYPE); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the complete condition check?
.filter(InternalServiceLatencyEnricher::isEligibleForSubtraction) | ||
.map(InternalServiceLatencyEnricher::getEventDuration) | ||
.reduce(0L, Long::sum); | ||
event.getAttributes().getAttributeMap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not enrichedAttributes
?
if this is used then maybe we can create a new method with checks like in this in parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but I think there are some edge cases where the flow can break. Though wouldn't cause any issue except causing a high error rate/logs.
EnrichedSpanConstants.getValue(BoundaryTypeValue.BOUNDARY_TYPE_VALUE_ENTRY); | ||
|
||
@Override | ||
public void enrichEvent(StructuredTrace trace, Event event) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add some unit test as well pls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
List<ApiNode<Event>> apiNodeList = apiTraceGraph.getApiNodeList(); | ||
for (ApiNode<Event> apiNode : apiNodeList) { | ||
List<ApiNodeEventEdge> edges = apiTraceGraph.getOutboundEdgesForApiNode(apiNode); | ||
int edgeDurationSum = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Will this sum ever exceed 2,147,483,647ms? That's around 25 days.
var entryApiBoundaryEvent = entryApiBoundaryEventMaybe.get(); | ||
var entryApiBoundaryEventDuration = getEventDuration(entryApiBoundaryEvent); | ||
try { | ||
entryApiBoundaryEvent.getAttributes().getAttributeMap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should it be enrichedAttributes or this is fine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be here as we want to see these attributes on the UI. Enriched attributes are not shown.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Codecov Report
@@ Coverage Diff @@
## rzp_main #12 +/- ##
==============================================
- Coverage 79.60% 79.46% -0.15%
- Complexity 1306 1311 +5
==============================================
Files 117 118 +1
Lines 5223 5273 +50
Branches 474 482 +8
==============================================
+ Hits 4158 4190 +32
- Misses 853 865 +12
- Partials 212 218 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Spec: https://docs.google.com/document/d/1wCSS3BRRrbwmnJBDvPNaL3O8ENQgTkD8iLlUTdnlMYI/edit
Edit: Have taken a better approach: