mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 17:15:56 +00:00
Merge pull request #405 from tgruben/trace-tagging
added some context to tracing
This commit is contained in:
commit
a777eddfcf
2 changed files with 12 additions and 1 deletions
11
api.go
11
api.go
|
|
@ -1009,6 +1009,9 @@ func (api *API) Import(ctx context.Context, req *ImportRequest, opts ...ImportOp
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "getting index and field")
|
||||
}
|
||||
span.LogKV(
|
||||
"index", req.Index,
|
||||
"field", req.Field)
|
||||
|
||||
// Unless explicitly ignoring key validation (meaning keys have been
|
||||
// translated to ids in a previous step at the coordinator node), then
|
||||
|
|
@ -1016,6 +1019,7 @@ func (api *API) Import(ctx context.Context, req *ImportRequest, opts ...ImportOp
|
|||
if !options.IgnoreKeyCheck {
|
||||
// Translate row keys.
|
||||
if field.Keys() {
|
||||
span.LogKV("rowKeys", true)
|
||||
if len(req.RowIDs) != 0 {
|
||||
return errors.New("row ids cannot be used because field uses string keys")
|
||||
}
|
||||
|
|
@ -1026,6 +1030,7 @@ func (api *API) Import(ctx context.Context, req *ImportRequest, opts ...ImportOp
|
|||
|
||||
// Translate column keys.
|
||||
if index.Keys() {
|
||||
span.LogKV("columnKeys", true)
|
||||
if len(req.ColumnIDs) != 0 {
|
||||
return errors.New("column ids cannot be used because index uses string keys")
|
||||
}
|
||||
|
|
@ -1124,13 +1129,16 @@ func (api *API) ImportValue(ctx context.Context, req *ImportValueRequest, opts .
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "getting index and field")
|
||||
}
|
||||
|
||||
span.LogKV(
|
||||
"index", req.Index,
|
||||
"field", req.Field)
|
||||
// Unless explicitly ignoring key validation (meaning keys have been
|
||||
// translate to ids in a previous step at the coordinator node), then
|
||||
// check to see if keys need translation.
|
||||
if !options.IgnoreKeyCheck {
|
||||
// Translate column keys.
|
||||
if index.Keys() {
|
||||
span.LogKV("columnKeys", true)
|
||||
if len(req.ColumnIDs) != 0 {
|
||||
return errors.New("column ids cannot be used because index uses string keys")
|
||||
}
|
||||
|
|
@ -1144,6 +1152,7 @@ func (api *API) ImportValue(ctx context.Context, req *ImportValueRequest, opts .
|
|||
// the field has a ForeignIndex with keys).
|
||||
if field.Keys() {
|
||||
// Perform translation.
|
||||
span.LogKV("rowKeys", true)
|
||||
uints, err := api.cluster.translateIndexKeys(ctx, field.ForeignIndex(), req.StringValues)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@ func (e *executor) registerOps(ops []ext.BitmapOp) error {
|
|||
// Execute executes a PQL query.
|
||||
func (e *executor) Execute(ctx context.Context, index string, q *pql.Query, shards []uint64, opt *execOptions) (QueryResponse, error) {
|
||||
span, ctx := tracing.StartSpanFromContext(ctx, "Executor.Execute")
|
||||
span.LogKV("pql", q.String())
|
||||
defer span.Finish()
|
||||
|
||||
resp := QueryResponse{}
|
||||
|
|
@ -1124,6 +1125,7 @@ func (e *executor) executePrecomputedCall(ctx context.Context, index string, c *
|
|||
// executeBitmapCall executes a call that returns a bitmap.
|
||||
func (e *executor) executeBitmapCall(ctx context.Context, index string, c *pql.Call, shards []uint64, opt *execOptions) (*Row, error) {
|
||||
span, ctx := tracing.StartSpanFromContext(ctx, "Executor.executeBitmapCall")
|
||||
span.LogKV("pqlCallName", c.Name)
|
||||
defer span.Finish()
|
||||
|
||||
indexTag := "index:" + index
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue