-
Notifications
You must be signed in to change notification settings - Fork 25
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 builtins tracing for ds calls #66
Conversation
Pull Request Test Coverage Report for Build 4557094471
💛 - Coveralls |
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 suggest we extract the trace logic and use the fnName passed in for each built-in to make it reusable. Now that we have a mechanism we might want to explore if there is anything we want to trace for the argument parsing.
builtins/edge/ds/check.go
Outdated
@@ -82,6 +85,14 @@ func RegisterCheckRelation(logger *zerolog.Logger, fnName string, dr resolvers.D | |||
Trace: false, | |||
}) | |||
if err != nil { | |||
if bctx.TraceEnabled { |
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.
Can we extract this in to helper.go as
func traceError(bctx topdown.BuiltinContext, fnName string, err error) {
if bctx.TraceEnabled {
if len(bctx.QueryTracers) > 0 {
bctx.QueryTracers[0].TraceEvent(topdown.Event{
Op: topdown.FailOp,
Message: fmt.Sprintf("%s error:%s", fnName, err.Error()),
})
}
}
}
This will make it reusable and leverage the function name as used in the code at all times.
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.
Line 175 there is no trace added for the CheckPermission call
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
No description provided.