@@ -3,8 +3,6 @@ package carbonserver
33import (
44 "bytes"
55 "context"
6- "crypto/md5"
7- "encoding/hex"
86 "fmt"
97 "io"
108 "math"
@@ -25,6 +23,7 @@ import (
2523 "go.uber.org/zap"
2624
2725 "github.com/go-graphite/carbonzipper/zipper/httpHeaders"
26+ "github.com/go-graphite/go-carbon/helper"
2827 "github.com/go-graphite/go-whisper"
2928 grpcv2 "github.com/go-graphite/protocol/carbonapi_v2_grpc"
3029 protov2 "github.com/go-graphite/protocol/carbonapi_v2_pb"
@@ -52,11 +51,6 @@ type timeRange struct {
5251 until int32
5352}
5453
55- func getMD5HashString (text string ) string {
56- hash := md5 .Sum ([]byte (text ))
57- return hex .EncodeToString (hash [:])
58- }
59-
6054func getTargetNames (targets map [timeRange ][]target ) []string {
6155 c := 0
6256 for _ , v := range targets {
@@ -295,8 +289,7 @@ func (listener *CarbonserverListener) getRenderCacheKeyAndSize(targets map[timeR
295289 for tr , ts := range targets {
296290 names := make ([]string , 0 , len (ts ))
297291 for _ , t := range ts {
298- pathExpressionMD5 := getMD5HashString (t .PathExpression )
299- names = append (names , t .Name + "&" + pathExpressionMD5 )
292+ names = append (names , t .Name + "&" + strconv .FormatUint (helper .HashString (t .PathExpression ), 16 ))
300293 }
301294 targetKeys = append (targetKeys , fmt .Sprintf ("%s&%d&%d" , strings .Join (names , "&" ), tr .from , tr .until ))
302295 }
0 commit comments