Skip to content

Commit 435b87f

Browse files
authored
fix:修复demo配置不正确问题 (polarismesh#211)
1 parent 4ac5155 commit 435b87f

File tree

31 files changed

+212
-175
lines changed

31 files changed

+212
-175
lines changed

examples/circuitbreaker/instance/consumer/go.sum

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
185185
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
186186
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
187187
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
188+
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
188189
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
189190
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
190191
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=

examples/circuitbreaker/instance/consumer/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func (svr *PolarisConsumer) discoverInstance() (string, model.Resource, error) {
7676
getOneRequest := &polaris.GetOneInstanceRequest{}
7777
getOneRequest.Namespace = namespace
7878
getOneRequest.Service = service
79+
// 允许返回熔断半开的实例
7980
getOneRequest.IncludeCircuitBreakInstances = true
8081
oneInstResp, err := svr.consumer.GetOneInstance(getOneRequest)
8182
if err != nil {

examples/circuitbreaker/instance/provider/go.sum

+1
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
185185
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
186186
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
187187
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
188+
github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
188189
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
189190
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
190191
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=

examples/circuitbreaker/instance/provider/main.go

+24-6
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func initArgs() {
4848

4949
// PolarisProvider is a provider for polaris
5050
type PolarisProvider struct {
51+
webSvr *http.Server
5152
provider polaris.ProviderAPI
5253
namespace string
5354
service string
@@ -87,6 +88,7 @@ func (svr *PolarisProvider) runWebServer() {
8788
} else {
8889
atomic.StoreInt32(&svr.needErr, 0)
8990
}
91+
log.Printf("switch success openError:" + val)
9092
rw.WriteHeader(http.StatusOK)
9193
})
9294

@@ -99,8 +101,9 @@ func (svr *PolarisProvider) runWebServer() {
99101

100102
go func() {
101103
log.Printf("[INFO] start http server, listen port is %v", svr.port)
102-
if err := http.Serve(ln, nil); err != nil {
103-
log.Fatalf("[ERROR]fail to run webServer, err is %v", err)
104+
svr.webSvr = &http.Server{}
105+
if err := svr.webSvr.Serve(ln); err != nil {
106+
log.Printf("[ERROR]fail to run webServer, err is %v", err)
104107
}
105108
}()
106109
}
@@ -113,14 +116,28 @@ func (svr *PolarisProvider) registerService() {
113116
registerRequest.Host = svr.host
114117
registerRequest.Port = svr.port
115118
registerRequest.ServiceToken = token
116-
resp, err := svr.provider.Register(registerRequest)
119+
resp, err := svr.provider.RegisterInstance(registerRequest)
117120
if err != nil {
118121
log.Fatalf("fail to register instance, err is %v", err)
119122
}
120123
log.Printf("register response: instanceId %s", resp.InstanceID)
121124
}
122125

123-
func runMainLoop() {
126+
func (svr *PolarisProvider) deregisterService() {
127+
log.Printf("start to invoke deregister operation")
128+
registerRequest := &polaris.InstanceDeRegisterRequest{}
129+
registerRequest.Service = service
130+
registerRequest.Namespace = namespace
131+
registerRequest.Host = svr.host
132+
registerRequest.Port = svr.port
133+
registerRequest.ServiceToken = token
134+
if err := svr.provider.Deregister(registerRequest); err != nil {
135+
log.Fatalf("fail to deregister instance, err is %v", err)
136+
}
137+
log.Printf("deregister finished")
138+
}
139+
140+
func (svr *PolarisProvider) runMainLoop() {
124141
ch := make(chan os.Signal, 1)
125142
signal.Notify(ch, []os.Signal{
126143
syscall.SIGINT, syscall.SIGTERM,
@@ -129,6 +146,8 @@ func runMainLoop() {
129146

130147
for s := range ch {
131148
log.Printf("catch signal(%+v), stop servers", s)
149+
_ = svr.webSvr.Close()
150+
svr.deregisterService()
132151
return
133152
}
134153
}
@@ -156,8 +175,7 @@ func main() {
156175
}
157176

158177
svr.Run()
159-
160-
runMainLoop()
178+
svr.runMainLoop()
161179
}
162180

163181
func getLocalHost(serverAddr string) (string, error) {

examples/quickstart/consumer/main.go

+20-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import (
2424
"log"
2525
"math/rand"
2626
"net/http"
27+
"os"
28+
"os/signal"
29+
"syscall"
2730
"time"
2831

2932
"github.com/polarismesh/polaris-go"
@@ -47,11 +50,24 @@ type PolarisConsumer struct {
4750
consumer polaris.ConsumerAPI
4851
namespace string
4952
service string
53+
webSvr *http.Server
5054
}
5155

5256
// Run starts the consumer
5357
func (svr *PolarisConsumer) Run() {
54-
svr.runWebServer()
58+
go svr.runWebServer()
59+
ch := make(chan os.Signal, 1)
60+
signal.Notify(ch, []os.Signal{
61+
syscall.SIGINT, syscall.SIGTERM,
62+
syscall.SIGSEGV,
63+
}...)
64+
65+
for s := range ch {
66+
svr.consumer.Destroy()
67+
log.Printf("catch signal(%+v), stop servers", s)
68+
_ = svr.webSvr.Close()
69+
return
70+
}
5571
}
5672

5773
func (svr *PolarisConsumer) runWebServer() {
@@ -133,7 +149,9 @@ func (svr *PolarisConsumer) runWebServer() {
133149

134150
log.Printf("start run web server, port : %d", port)
135151

136-
if err := http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", port), nil); err != nil {
152+
webSvr := &http.Server{Addr: fmt.Sprintf("0.0.0.0:%d", port), Handler: nil}
153+
svr.webSvr = webSvr
154+
if err := webSvr.ListenAndServe(); err != nil {
137155
log.Fatalf("[ERROR]fail to run webServer, err is %v", err)
138156
}
139157
}

examples/quickstart/consumer/polaris.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ global:
88
- prometheus
99
plugin:
1010
prometheus:
11-
type: pull
12-
metricPort: 0
11+
type: push
12+
address: 127.0.0.1:9091
13+
interval: 10s

examples/ratelimit/consumer/go.sum

+1-7
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
171171
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
172172
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
173173
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
174-
github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw=
175174
github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw=
176175
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
177176
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@@ -321,7 +320,6 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99
321320
github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c=
322321
github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=
323322
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
324-
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
325323
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
326324
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
327325
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -340,7 +338,6 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/
340338
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
341339
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
342340
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
343-
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
344341
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
345342
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
346343
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
@@ -375,8 +372,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
375372
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
376373
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
377374
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
378-
github.com/polarismesh/specification v1.3.2-alpha.2 h1:cMghyvCnRVM5ca2kYCGHOgIIxVnokiMvw0720q8a8RA=
379-
github.com/polarismesh/specification v1.3.2-alpha.2/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
375+
github.com/polarismesh/specification v1.4.1 h1:lTZqeyUhhWuKyr6NDKBwmUrNfcUDvKLxWT/uOq71T5A=
380376
github.com/polarismesh/specification v1.4.1/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
381377
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
382378
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
@@ -405,9 +401,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
405401
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
406402
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
407403
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
408-
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
409404
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
410-
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
411405
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
412406
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
413407
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=

examples/ratelimit/consumer/main.go

+23-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ import (
2424
"log"
2525
"math/rand"
2626
"net/http"
27+
"os"
28+
"os/signal"
29+
"syscall"
2730
"time"
2831

2932
"github.com/polarismesh/polaris-go"
@@ -47,11 +50,24 @@ type PolarisConsumer struct {
4750
consumer polaris.ConsumerAPI
4851
namespace string
4952
service string
53+
webSvr *http.Server
5054
}
5155

5256
// Run starts the consumer
5357
func (svr *PolarisConsumer) Run() {
54-
svr.runWebServer()
58+
go svr.runWebServer()
59+
ch := make(chan os.Signal, 1)
60+
signal.Notify(ch, []os.Signal{
61+
syscall.SIGINT, syscall.SIGTERM,
62+
syscall.SIGSEGV,
63+
}...)
64+
65+
for s := range ch {
66+
svr.consumer.Destroy()
67+
log.Printf("catch signal(%+v), stop servers", s)
68+
_ = svr.webSvr.Close()
69+
return
70+
}
5571
}
5672

5773
func (svr *PolarisConsumer) runWebServer() {
@@ -74,7 +90,9 @@ func (svr *PolarisConsumer) runWebServer() {
7490
}
7591

7692
start := time.Now()
77-
resp, err := http.Get(fmt.Sprintf("http://%s:%d/echo", instance.GetHost(), instance.GetPort()))
93+
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("http://%s:%d/echo", instance.GetHost(), instance.GetPort()), nil)
94+
req.Header = r.Header
95+
resp, err := http.DefaultClient.Do(req)
7896
if err != nil {
7997
log.Printf("[errot] send request to %s:%d fail : %s", instance.GetHost(), instance.GetPort(), err)
8098
rw.WriteHeader(http.StatusInternalServerError)
@@ -133,7 +151,9 @@ func (svr *PolarisConsumer) runWebServer() {
133151

134152
log.Printf("start run web server, port : %d", port)
135153

136-
if err := http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", port), nil); err != nil {
154+
webSvr := &http.Server{Addr: fmt.Sprintf("0.0.0.0:%d", port), Handler: nil}
155+
svr.webSvr = webSvr
156+
if err := webSvr.ListenAndServe(); err != nil {
137157
log.Fatalf("[ERROR]fail to run webServer, err is %v", err)
138158
}
139159
}

examples/ratelimit/consumer/polaris.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ global:
88
- prometheus
99
plugin:
1010
prometheus:
11-
type: pull
12-
metricPort: 0
11+
type: push
12+
address: 127.0.0.1:9091
13+
interval: 10s

examples/ratelimit/provider/go.sum

+1-7
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ
171171
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
172172
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
173173
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
174-
github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw=
175174
github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw=
176175
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
177176
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
@@ -321,7 +320,6 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99
321320
github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c=
322321
github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo=
323322
github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4=
324-
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
325323
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
326324
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
327325
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -340,7 +338,6 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/
340338
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
341339
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
342340
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
343-
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
344341
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
345342
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
346343
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
@@ -375,8 +372,7 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
375372
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
376373
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
377374
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
378-
github.com/polarismesh/specification v1.3.2-alpha.2 h1:cMghyvCnRVM5ca2kYCGHOgIIxVnokiMvw0720q8a8RA=
379-
github.com/polarismesh/specification v1.3.2-alpha.2/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
375+
github.com/polarismesh/specification v1.4.1 h1:lTZqeyUhhWuKyr6NDKBwmUrNfcUDvKLxWT/uOq71T5A=
380376
github.com/polarismesh/specification v1.4.1/go.mod h1:rDvMMtl5qebPmqiBLNa5Ps0XtwkP31ZLirbH4kXA0YU=
381377
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
382378
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
@@ -405,9 +401,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
405401
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
406402
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
407403
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
408-
github.com/smartystreets/assertions v1.2.0 h1:42S6lae5dvLc7BrLu/0ugRtcFVjoJNMC/N3yZFZkDFs=
409404
github.com/smartystreets/assertions v1.2.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo=
410-
github.com/smartystreets/goconvey v1.7.2 h1:9RBaZCeXEQ3UselpuwUQHltGVXvdwm6cv1hgR6gDIPg=
411405
github.com/smartystreets/goconvey v1.7.2/go.mod h1:Vw0tHAZW6lzCRk3xgdin6fKYcG+G3Pg9vgXWeJpQFMM=
412406
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
413407
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=

examples/ratelimit/provider/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func (svr *PolarisProvider) runWebServer() {
7676
quotaReq.SetMethod("/echo")
7777
headers := convertHeaders(r.Header)
7878
for k, v := range headers {
79-
quotaReq.AddArgument(model.BuildHeaderArgument(k, v))
79+
quotaReq.AddArgument(model.BuildHeaderArgument(strings.ToLower(k), v))
8080
}
8181
quotaReq.SetNamespace(namespace)
8282
quotaReq.SetService(service)

0 commit comments

Comments
 (0)