|
|
|
|
@ -152,9 +152,7 @@ type query struct { |
|
|
|
|
ng *Engine |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
type queryCtx int |
|
|
|
|
|
|
|
|
|
var queryOrigin queryCtx |
|
|
|
|
type queryOrigin struct{} |
|
|
|
|
|
|
|
|
|
// Statement implements the Query interface.
|
|
|
|
|
func (q *query) Statement() parser.Statement { |
|
|
|
|
@ -441,7 +439,7 @@ func (ng *Engine) exec(ctx context.Context, q *query) (v parser.Value, w storage |
|
|
|
|
f = append(f, "error", err) |
|
|
|
|
} |
|
|
|
|
f = append(f, "stats", stats.NewQueryStats(q.Stats())) |
|
|
|
|
if origin := ctx.Value(queryOrigin); origin != nil { |
|
|
|
|
if origin := ctx.Value(queryOrigin{}); origin != nil { |
|
|
|
|
for k, v := range origin.(map[string]interface{}) { |
|
|
|
|
f = append(f, k, v) |
|
|
|
|
} |
|
|
|
|
@ -2097,7 +2095,7 @@ func shouldDropMetricName(op parser.ItemType) bool { |
|
|
|
|
|
|
|
|
|
// NewOriginContext returns a new context with data about the origin attached.
|
|
|
|
|
func NewOriginContext(ctx context.Context, data map[string]interface{}) context.Context { |
|
|
|
|
return context.WithValue(ctx, queryOrigin, data) |
|
|
|
|
return context.WithValue(ctx, queryOrigin{}, data) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func formatDate(t time.Time) string { |
|
|
|
|
|