-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to show metrics #4033
Conversation
Signed-off-by: பாலாஜி ஜின்னா <balaji@dgraph.io>
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.
✅ A review job has been created and sent to the PullRequest network.
Check the status or cancel PullRequest code review here.
Signed-off-by: பாலாஜி ஜின்னா <balaji@dgraph.io>
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.
This is not enough, need two things -
- Take an example dataset and show some results in the PR show that the results are what we are expecting
- What is this metrics that you are computing in this PR?
Reviewable status: 0 of 1 files reviewed, all discussions resolved (waiting on @pawanrawal)
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.
query/outputnode.go
Outdated
// calculateMetrics populates the given map with the number of uids are gathered for each | ||
// attributes. | ||
func calculateMetrics(sg *SubGraph, metrics map[string]int) { | ||
// we'll calcuate only destination because this are the uid gathered by this subgraph. |
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.
- calcuate -> calculate
are-> is
query/outputnode.go
Outdated
sgr.Children = append(sgr.Children, sg) | ||
} | ||
fmt.Println(metricsMap) |
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 for logging purposes or to console to validate?
query/outputnode.go
Outdated
@@ -810,3 +814,29 @@ func (sg *SubGraph) preTraverse(uid uint64, dst outputNode) error { | |||
|
|||
return nil | |||
} | |||
|
|||
// calculateMetrics populates the given map with the number of uids are gathered for each |
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.
calculateMetrics populates the given map with the number of uids are gathered for each attributes
query/outputnode.go
Outdated
for _, filter := range sg.Filters { | ||
calculateMetrics(filter, metrics) | ||
} | ||
// calculate metrics for the childres as well. |
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.
children
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.
Commented on the discuss post, this PR can be simplified. You just need to compute len(uidMatrix)
to get an estimate of the number of disk seeks. Let me know if something isn't clear and we can discuss it.
Reviewable status: 0 of 1 files reviewed, 9 unresolved discussions (waiting on @balajijinnah and @pawanrawal)
query/outputnode.go, line 825 at r1 (raw file):
// some results, because if any filters applied those uids are gone. prev := metrics[sg.Attr] // QUESTION: @manish @pawan: should I add destuid or length of posting list?.
If I understand correctly, the intention of this PR is to get an estimate of the number of disk seeks that we do?
query/outputnode.go, line 830 at r1 (raw file):
// as well. for _, valList := range sg.valueMatrix { prev = prev + len(valList.GetValues())
Why are we adding this? To get a value list, we do one disk seek per uid and predicate combination which would be done at the parent SubGraph of this node.
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.
Due to inactivity, PullRequest has cancelled this review job. You can reactivate the code review job from the PullRequest dashboard
Signed-off-by: balaji jinnah <rbalajis25@gmail.com>
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.
Reviewable status: 0 of 1 files reviewed, 11 unresolved discussions (waiting on @balajijinnah)
query/outputnode.go, line 53 at r2 (raw file):
} // calculate metrics for this query. calculateMetrics(sg, metricsMap)
Move this to Request.Process
query/outputnode.go, line 823 at r2 (raw file):
// we'll calculate srcUid of the each attribute. because, these are number of uids // processed by this attribute. prev := metrics[sg.Attr]
- What happens when Attr is
uid
. - Check for Internal(), that is O(1) computation for us
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.
Please address all the comments and add the version of dgo so that I can run it locally.
Reviewable status: 0 of 1 files reviewed, 11 unresolved discussions (waiting on @balajijinnah)
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.
@balajijinnah please add tests for this change too.
Reviewable status: 0 of 1 files reviewed, 11 unresolved discussions (waiting on @balajijinnah)
Signed-off-by: பாலாஜி <balaji@dgraph.io>
Signed-off-by: பாலாஜி <balaji@dgraph.io>
Signed-off-by: balaji jinnah <rbalajis25@gmail.com>
Signed-off-by: balaji jinnah <rbalajis25@gmail.com>
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.
Reviewable status: 0 of 8 files reviewed, 11 unresolved discussions (waiting on @balajijinnah, @mangalaman93, @manishrjain, @pawanrawal, and @pullrequest[bot])
query/outputnode.go, line 56 at r1 (raw file):
Previously, pullrequest[bot] wrote…
Is this for logging purposes or to console to validate?
Done.
query/outputnode.go, line 818 at r1 (raw file):
Previously, pullrequest[bot] wrote…
calculateMetrics populates the given map with the number of uids
aregathered for each attributes
Done.
query/outputnode.go, line 821 at r1 (raw file):
Previously, pullrequest[bot] wrote…
- calcuate -> calculate
are-> is
Done.
query/outputnode.go, line 825 at r1 (raw file):
Previously, pawanrawal (Pawan Rawal) wrote…
If I understand correctly, the intention of this PR is to get an estimate of the number of disk seeks that we do?
Done.
query/outputnode.go, line 830 at r1 (raw file):
Previously, pawanrawal (Pawan Rawal) wrote…
Why are we adding this? To get a value list, we do one disk seek per uid and predicate combination which would be done at the parent SubGraph of this node.
Done.
query/outputnode.go, line 832 at r1 (raw file):
Previously, pullrequest[bot] wrote…
It feels like the naming could be improved since we are writing to quite a generic field name
Attr
.
Done.
query/outputnode.go, line 834 at r1 (raw file):
Previously, pullrequest[bot] wrote…
It'd be interesting to have more insight into why Filters are included here.
Done.
query/outputnode.go, line 838 at r1 (raw file):
Previously, pullrequest[bot] wrote…
children
Done.
query/outputnode.go, line 53 at r2 (raw file):
Previously, mangalaman93 (Aman Mangal) wrote…
Move this to Request.Process
Done.
query/outputnode.go, line 823 at r2 (raw file):
Previously, mangalaman93 (Aman Mangal) wrote…
- What happens when Attr is
uid
.- Check for Internal(), that is O(1) computation for us
Done.
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.
as a first pass. This would require more work for certain queries. The ones that I can think of are:
- Sorting at root isn't captured.
- Functions at root won't be captured because they don't have source uids.
- Filters would only capture SrcUids but most of the work that they do is by fetching index tokens.
Reviewed 7 of 8 files at r3, 1 of 1 files at r4.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @balajijinnah, @mangalaman93, @manishrjain, @pawanrawal, and @pullrequest[bot])
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 the caveats @pawanrawal mentioned in the PR description, so we can come back to this and improve it. Rest looks alright to me. Defer to @pawanrawal 's review.
Reviewed 7 of 8 files at r3, 1 of 1 files at r4.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @balajijinnah, @mangalaman93, @pawanrawal, and @pullrequest[bot])
Signed-off-by: பாலாஜி <balaji@dgraph.io>
…one more attribute name Signed-off-by: பாலாஜி <balaji@dgraph.io>
Signed-off-by: பாலாஜி ஜின்னா balaji@dgraph.io
This change is
Sample output