Browse Source

Make context key type public (#7748)

Signed-off-by: Annanay <annanayagarwal@gmail.com>
pull/7749/head
Annanay Agarwal 4 years ago committed by GitHub
parent
commit
118aeab02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      promql/engine.go

6
promql/engine.go

@ -137,7 +137,7 @@ type query struct {
ng *Engine
}
type queryOrigin struct{}
type QueryOrigin struct{}
// Statement implements the Query interface.
func (q *query) Statement() parser.Statement {
@ -414,7 +414,7 @@ func (ng *Engine) exec(ctx context.Context, q *query) (v parser.Value, ws storag
f = append(f, "spanID", spanCtx.SpanID())
}
}
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)
}
@ -2116,7 +2116,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 {

Loading…
Cancel
Save