55 "strings"
66
77 "github.com/lomik/graphite-clickhouse/helper/clickhouse"
8+ "github.com/lomik/graphite-clickhouse/metrics"
89
910 "github.com/lomik/graphite-clickhouse/config"
1011)
@@ -14,18 +15,11 @@ type Result interface {
1415 Series () [][]byte
1516 Abs ([]byte ) []byte
1617 Bytes () ([]byte , error )
18+ Stats () []metrics.FinderStat
1719}
18-
19- type FinderStat struct {
20- ReadBytes int64
21- ChReadRows int64
22- ChReadBytes int64
23- Table string
24- }
25-
2620type Finder interface {
2721 Result
28- Execute (ctx context.Context , config * config.Config , query string , from int64 , until int64 , stat * FinderStat ) error
22+ Execute (ctx context.Context , config * config.Config , query string , from int64 , until int64 ) error
2923}
3024
3125func newPlainFinder (ctx context.Context , config * config.Config , query string , from int64 , until int64 , useCache bool ) Finder {
@@ -108,15 +102,12 @@ func newPlainFinder(ctx context.Context, config *config.Config, query string, fr
108102 return f
109103}
110104
111- func Find (config * config.Config , ctx context.Context , query string , from int64 , until int64 , stat * FinderStat ) (Result , error ) {
105+ func Find (config * config.Config , ctx context.Context , query string , from int64 , until int64 ) (Result , error ) {
112106 fnd := newPlainFinder (ctx , config , query , from , until , config .Common .FindCache != nil )
113107
114- err := fnd .Execute (ctx , config , query , from , until , stat )
115- if err != nil {
116- return nil , err
117- }
108+ err := fnd .Execute (ctx , config , query , from , until )
118109
119- return fnd .(Result ), nil
110+ return fnd .(Result ), err
120111}
121112
122113// Leaf strips last dot and detect IsLeaf
@@ -128,7 +119,7 @@ func Leaf(value []byte) ([]byte, bool) {
128119 return value , true
129120}
130121
131- func FindTagged (ctx context.Context , config * config.Config , terms []TaggedTerm , from int64 , until int64 , stat * FinderStat ) (Result , error ) {
122+ func FindTagged (ctx context.Context , config * config.Config , terms []TaggedTerm , from int64 , until int64 ) (Result , error ) {
132123 opts := clickhouse.Options {
133124 Timeout : config .ClickHouse .IndexTimeout ,
134125 ConnectTimeout : config .ClickHouse .ConnectTimeout ,
@@ -141,7 +132,7 @@ func FindTagged(ctx context.Context, config *config.Config, terms []TaggedTerm,
141132 if plain != nil {
142133 plain .wrappedPlain = newPlainFinder (ctx , config , plain .Target (), from , until , useCache )
143134
144- err := plain .Execute (ctx , config , plain .Target (), from , until , stat )
135+ err := plain .Execute (ctx , config , plain .Target (), from , until )
145136 if err != nil {
146137 return nil , err
147138 }
@@ -161,7 +152,7 @@ func FindTagged(ctx context.Context, config *config.Config, terms []TaggedTerm,
161152 config .ClickHouse .TaggedCosts ,
162153 )
163154
164- err := fnd .ExecutePrepared (ctx , terms , from , until , stat )
155+ err := fnd .ExecutePrepared (ctx , terms , from , until )
165156 if err != nil {
166157 return nil , err
167158 }
0 commit comments