diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go index d5566725545..ca1c54e6b01 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -33,6 +33,7 @@ import ( "github.com/youtube/vitess/go/acl" "github.com/youtube/vitess/go/cache" "github.com/youtube/vitess/go/sqltypes" + "github.com/youtube/vitess/go/stats" "github.com/youtube/vitess/go/vt/sqlannotation" "github.com/youtube/vitess/go/vt/sqlparser" "github.com/youtube/vitess/go/vt/topo" @@ -91,6 +92,12 @@ func NewExecutor(ctx context.Context, serv topo.SrvTopoServer, cell, statsName s } e.watchSrvVSchema(ctx, cell) executorOnce.Do(func() { + stats.Publish("QueryPlanCacheLength", stats.IntFunc(e.plans.Length)) + stats.Publish("QueryPlanCacheSize", stats.IntFunc(e.plans.Size)) + stats.Publish("QueryPlanCacheCapacity", stats.IntFunc(e.plans.Capacity)) + stats.Publish("QueryPlanCacheOldest", stats.StringFunc(func() string { + return fmt.Sprintf("%v", e.plans.Oldest()) + })) http.Handle("/debug/query_plans", e) http.Handle("/debug/vschema", e) })