Skip to content

Commit 3ff7851

Browse files
committed
feat: 支持缓存 #1010158081128800655
- 添加缓存服务支持 - 添加Redis相关配置和路由 - 实现HTTP中间件缓存功能 - 添加缓存相关测试用例
1 parent 709c000 commit 3ff7851

File tree

12 files changed

+999
-54
lines changed

12 files changed

+999
-54
lines changed

pkg/unify-query/cmd/root.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"os/signal"
1616
"syscall"
1717

18+
"github.com/TencentBlueKing/bkmonitor-datalink/pkg/unify-query/service/cache"
1819
"github.com/google/gops/agent"
1920
"github.com/spf13/cobra"
2021

@@ -62,6 +63,7 @@ var rootCmd = &cobra.Command{
6263
&promql.Service{},
6364
&http.Service{},
6465
&featureFlag.Service{},
66+
&cache.Service{},
6567
}
6668
log.Infof(ctx, "http service started.")
6769

@@ -94,6 +96,7 @@ var rootCmd = &cobra.Command{
9496
service.Wait()
9597
log.Warnf(ctx, "waiting for service:%s done", service.Type())
9698
}
99+
97100
log.Debugf(ctx, "all service exit, server exit now.")
98101
os.Exit(0)
99102
},

pkg/unify-query/go.mod

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
module github.com/TencentBlueKing/bkmonitor-datalink/pkg/unify-query
22

3-
go 1.24.0
4-
5-
toolchain go1.24.4
3+
go 1.23.0
64

75
require (
86
github.com/Knetic/govaluate v3.0.0+incompatible
97
github.com/TencentBlueKing/bkmonitor-datalink/pkg/offline-data-archive v0.0.0-00010101000000-000000000000
8+
github.com/TencentBlueKing/bkmonitor-datalink/pkg/transfer v0.0.0-20251121032658-709c000594ba
109
github.com/TencentBlueKing/bkmonitor-datalink/pkg/utils v0.0.0-00010101000000-000000000000
1110
github.com/VictoriaMetrics/metricsql v0.69.0
1211
github.com/alicebob/miniredis/v2 v2.35.0
@@ -20,11 +19,10 @@ require (
2019
github.com/go-redis/redis/v8 v8.11.5
2120
github.com/golang-jwt/jwt v3.2.2+incompatible
2221
github.com/golang/mock v1.6.0
23-
github.com/google/go-cmp v0.6.0
2422
github.com/google/gops v0.3.26
2523
github.com/google/uuid v1.3.0
2624
github.com/hashicorp/consul/api v1.18.0
27-
github.com/influxdata/influxdb v1.10.0
25+
github.com/influxdata/influxdb v1.11.5
2826
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab
2927
github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385
3028
github.com/jarcoal/httpmock v1.3.1
@@ -37,19 +35,18 @@ require (
3735
github.com/patrickmn/go-cache v2.1.0+incompatible
3836
github.com/pkg/errors v0.9.1
3937
github.com/prashantv/gostub v1.1.0
40-
github.com/prometheus/client_golang v1.16.0
41-
github.com/prometheus/common v0.42.0
38+
github.com/prometheus/client_golang v1.19.0
39+
github.com/prometheus/common v0.48.0
4240
github.com/prometheus/prometheus v0.42.0
4341
github.com/samber/lo v1.51.0
44-
github.com/sirupsen/logrus v1.9.0
4542
github.com/spf13/cast v1.10.0
4643
github.com/spf13/cobra v1.6.1
4744
github.com/spf13/viper v1.15.0
4845
github.com/stretchr/testify v1.8.4
4946
github.com/swaggo/swag v1.16.1
5047
github.com/thomaspoignant/go-feature-flag v1.0.1
5148
github.com/tinylib/msgp v1.1.6
52-
go.etcd.io/bbolt v1.3.3
49+
go.etcd.io/bbolt v1.3.5
5350
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.32.0
5451
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0
5552
go.opentelemetry.io/otel v1.16.0
@@ -107,6 +104,7 @@ require (
107104
github.com/golang/glog v1.1.0 // indirect
108105
github.com/golang/protobuf v1.5.3 // indirect
109106
github.com/golang/snappy v0.0.4 // indirect
107+
github.com/google/go-cmp v0.6.0 // indirect
110108
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect
111109
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
112110
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
@@ -127,7 +125,6 @@ require (
127125
github.com/mailru/easyjson v0.9.0 // indirect
128126
github.com/mattn/go-colorable v0.1.13 // indirect
129127
github.com/mattn/go-isatty v0.0.19 // indirect
130-
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
131128
github.com/mitchellh/mapstructure v1.5.0 // indirect
132129
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
133130
github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -137,9 +134,9 @@ require (
137134
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
138135
github.com/philhofer/fwd v1.1.1 // indirect
139136
github.com/pmezard/go-difflib v1.0.0 // indirect
140-
github.com/prometheus/client_model v0.3.0 // indirect
137+
github.com/prometheus/client_model v0.5.0 // indirect
141138
github.com/prometheus/common/sigv4 v0.1.0 // indirect
142-
github.com/prometheus/procfs v0.10.1 // indirect
139+
github.com/prometheus/procfs v0.12.0 // indirect
143140
github.com/spf13/afero v1.9.3 // indirect
144141
github.com/spf13/jwalterweatherman v1.1.0 // indirect
145142
github.com/spf13/pflag v1.0.5 // indirect
@@ -156,13 +153,13 @@ require (
156153
go.uber.org/goleak v1.2.0 // indirect
157154
go.uber.org/multierr v1.11.0 // indirect
158155
golang.org/x/arch v0.3.0 // indirect
159-
golang.org/x/crypto v0.44.0 // indirect
160-
golang.org/x/net v0.47.0 // indirect
156+
golang.org/x/crypto v0.36.0 // indirect
157+
golang.org/x/net v0.38.0 // indirect
161158
golang.org/x/oauth2 v0.30.0 // indirect
162-
golang.org/x/sync v0.18.0 // indirect
163-
golang.org/x/sys v0.38.0 // indirect
164-
golang.org/x/text v0.31.0 // indirect
165-
golang.org/x/tools v0.38.0 // indirect
159+
golang.org/x/sync v0.12.0 // indirect
160+
golang.org/x/sys v0.31.0 // indirect
161+
golang.org/x/text v0.23.0 // indirect
162+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
166163
gonum.org/v1/gonum v0.9.1 // indirect
167164
google.golang.org/genproto/googleapis/api v0.0.0-20230530153820-e85fd2cbaebc // indirect
168165
google.golang.org/genproto/googleapis/rpc v0.0.0-20230530153820-e85fd2cbaebc // indirect

0 commit comments

Comments
 (0)