Conversation
Codecov Report
@@ Coverage Diff @@
## main #87 +/- ##
============================================
- Coverage 77.08% 77.02% -0.07%
- Complexity 1082 1094 +12
============================================
Files 105 106 +1
Lines 4884 4980 +96
Branches 416 424 +8
============================================
+ Hits 3765 3836 +71
- Misses 936 955 +19
- Partials 183 189 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| message LogEventResponse { | ||
| repeated LogEvent logEvents = 1; | ||
| int32 total = 2; |
There was a problem hiding this comment.
My understanding is this needs to be fetched separately, so we've kind of retrofitted an "includeTotal" flag on other APIs. Since this is a new one, it may be worth looking at those and if it makes sense, splitting fetching total into its own API.
There was a problem hiding this comment.
Why does total needs to be fetched separately? and if that is added, should the existing api also return total?
There was a problem hiding this comment.
It was a perf optimization. In many contexts (for example, showing the log events in the sequence diagram), we don't need the total - but under the hood, the gateway service had to make a separate query (which I believe was sequential, although that could be fixed) to fetch it and it slowed down the queries that didn't need it. By keeping it separate, we can fetch it in parallel if needed and leave it be if it's not requested. @skjindal93 may have more context.
There was a problem hiding this comment.
Why does
totalneeds to be fetched separately? and if that is added, should the existing api also returntotal?
I think there are 2 questions here
-
Why does
totalneeds to be fetched separately?
If the request has support forlimitandoffset, which usually gets pushed down to the data store, you cannot count number of log events in the response and call it astotal(since the count of log events would just be bounded by thelimit)
A separate request needs to be made to get thetotalvalue, by just passing the filters sent in the request (And, that's why I personally prefer to have a separate total request API entirely) -
What if you don't need
totalin the response?
That's the perf optimization which @aaron-steinfeld was mentioning about. Since, in order to fetchtotal, you need to make a separate request, but if the consumer does not need it, we should skip fetching thetotalentirely (by either having a boolean flag like this https://github.com/hypertrace/gateway-service/blob/main/gateway-service-api/src/main/proto/org/hypertrace/gateway/service/v1/entities.proto#L50 or a separate total request API)
There was a problem hiding this comment.
Initially, since I didn't add support for limit and order, calculating total was trivial. But, yeah with limit and order it needs another query.
For this change, I will remove total from the api.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| message LogEventsRequest { | ||
| // todo change this to nano | ||
| sfixed64 start_time_nanos = 1; |
There was a problem hiding this comment.
hmmm - to keep this in nanos or millis? My gut is millis so this becomes more of an implementation detail (since the unit on the attribute itself will be handled generically), but I'm on the fence.
There was a problem hiding this comment.
Ok, I can do that. Currently I am just converting timestamp to nanos in gql request builder.
| public static Filter addTimeAndSpaceFiltersAndConvertToQueryFilter( | ||
| long startTimeMillis, | ||
| long endTimeMillis, | ||
| long startTime, |
There was a problem hiding this comment.
I don't believe this util cares about units, but just to be aware, others do (anything using datetimeconvert). We'll probably want to lookup the timestamp unit when we get to that point.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| repeated double double_array = 13; | ||
| repeated bool boolean_array = 14; | ||
| map<string, string> string_map = 15; | ||
| string timestamp_unit = 16; |
There was a problem hiding this comment.
Why do we need this in the value? The requester has access to the metadata anyway so should have this info (which saves us from repeating the unit in every response value - we already do this for all other units)
There was a problem hiding this comment.
Yeah that can also be done. But I will then need a different converter for Timestamp in gql, here hypertrace/hypertrace-core-graphql#56 (comment) since the convert method only has access to the Value object.
- we already do this for all other units)
where do we do this?
There was a problem hiding this comment.
My response from offline:
So GQL will need changes to support timestamps as instants in attributes - right now it only works that way for top level APIs. The value converter needs to be changed to a biconverter I believe to take in the attribute metadata. Or we may need both the Converter and Biconverter flavors if there’s some places we call it where we don’t have that metadata at hand (probably just implement both methods and have an internal implementation, for example). The 400 error is due to the serialization side. Attributes right now use an UnknownScalar type, which needs to add support for instants - right now it treats them as plain objects.
There was a problem hiding this comment.
As to where we do this, I actually confused units and types. The units being joined in happens in the UI today - the types being joined in we do in GQL explorer results.
| } | ||
|
|
||
| message LogEventResponse { | ||
| repeated LogEvent log_events = 1; |
There was a problem hiding this comment.
no total? since, we have offset and limit now, I believe it will have pagination. That will need a total in the response
There was a problem hiding this comment.
So, that would need a parallel query I guess
There was a problem hiding this comment.
Yes. That works too. Definitely, we can defer it as a separate PR
There was a problem hiding this comment.
👍 that's what I was thinking - separate api entirely since we have the luxury of doing it here.
Adds LogEvents api
hypertrace/hypertrace#224