Skip to content

Commit 7e7024c

Browse files
author
zianazhao
committed
fix-gaap
1 parent b0dfff2 commit 7e7024c

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pkg/collector/handler_qaap.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ func (h *QaapHandler) getQaapListenerStatSeries(m *metric.TcmMetric, ins instanc
283283
ql := map[string]string{
284284
"instanceid": proxySet.ProxyId,
285285
"listenerid": l4Listener.ListenerId,
286-
"protocol":l4Listener.Protocol,
286+
"protocol": l4Listener.Protocol,
287287
}
288288
s, err := metric.NewTcmSeries(m, ql, ins)
289289
if err != nil {
@@ -295,7 +295,7 @@ func (h *QaapHandler) getQaapListenerStatSeries(m *metric.TcmMetric, ins instanc
295295
ql := map[string]string{
296296
"instanceid": proxySet.ProxyId,
297297
"listenerid": l7Listener.ListenerId,
298-
"protocol":l7Listener.ForwardProtocol,
298+
"protocol": l7Listener.ForwardProtocol,
299299
}
300300
s, err := metric.NewTcmSeries(m, ql, ins)
301301
if err != nil {

pkg/instance/cache.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,9 @@ func NewVbcTcInstanceDRegionRepositoryCache(repo VbcTcInstanceDRegionRepository,
530530
// gaap
531531
type TcGaapInstanceeInfosCache struct {
532532
Raw QaapTcInstanceInfoRepository
533-
cache1 map[string]*gaap.DescribeTCPListenersResponse
534-
cache2 map[string]*gaap.DescribeUDPListenersResponse
535-
cache3 map[string]*gaap.DescribeProxyGroupListResponse
533+
tcpCache map[string]*gaap.DescribeTCPListenersResponse
534+
udpCache map[string]*gaap.DescribeUDPListenersResponse
535+
groupCache map[string]*gaap.DescribeProxyGroupListResponse
536536
lastReloadTime map[string]time.Time
537537
reloadInterval time.Duration
538538
mu sync.Mutex
@@ -543,7 +543,7 @@ type TcGaapInstanceeInfosCache struct {
543543
func (c *TcGaapInstanceeInfosCache) GetTCPListenersInfo(instanceId string) (*gaap.DescribeTCPListenersResponse, error) {
544544
lrtime, exists := c.lastReloadTime[instanceId]
545545
if exists && time.Now().Sub(lrtime) < c.reloadInterval {
546-
namespace, ok := c.cache1[instanceId]
546+
namespace, ok := c.tcpCache[instanceId]
547547
if ok {
548548
return namespace, nil
549549
}
@@ -553,15 +553,15 @@ func (c *TcGaapInstanceeInfosCache) GetTCPListenersInfo(instanceId string) (*gaa
553553
if err != nil {
554554
return nil, err
555555
}
556-
c.cache1[instanceId] = tcpListeners
556+
c.tcpCache[instanceId] = tcpListeners
557557
c.lastReloadTime[instanceId] = time.Now()
558558
level.Debug(c.logger).Log("msg", "Get gaap Namespaces info from api", "instanceId", instanceId)
559559
return tcpListeners, nil
560560
}
561561
func (c *TcGaapInstanceeInfosCache) GetUDPListenersInfo(instanceId string) (*gaap.DescribeUDPListenersResponse, error) {
562562
lrtime, exists := c.lastReloadTime[instanceId]
563563
if exists && time.Now().Sub(lrtime) < c.reloadInterval {
564-
namespace, ok := c.cache2[instanceId]
564+
namespace, ok := c.udpCache[instanceId]
565565
if ok {
566566
return namespace, nil
567567
}
@@ -571,15 +571,15 @@ func (c *TcGaapInstanceeInfosCache) GetUDPListenersInfo(instanceId string) (*gaa
571571
if err != nil {
572572
return nil, err
573573
}
574-
c.cache2[instanceId] = udpListeners
574+
c.udpCache[instanceId] = udpListeners
575575
c.lastReloadTime[instanceId] = time.Now()
576576
level.Debug(c.logger).Log("msg", "Get gaap Namespaces info from api", "instanceId", instanceId)
577577
return udpListeners, nil
578578
}
579579
func (c *TcGaapInstanceeInfosCache) GetProxyGroupList(instanceId string) (*gaap.DescribeProxyGroupListResponse, error) {
580580
lrtime, exists := c.lastReloadTime[instanceId]
581581
if exists && time.Now().Sub(lrtime) < c.reloadInterval {
582-
namespace, ok := c.cache3[instanceId]
582+
namespace, ok := c.groupCache[instanceId]
583583
if ok {
584584
return namespace, nil
585585
}
@@ -589,7 +589,7 @@ func (c *TcGaapInstanceeInfosCache) GetProxyGroupList(instanceId string) (*gaap.
589589
if err != nil {
590590
return nil, err
591591
}
592-
c.cache3[instanceId] = proxyGroupList
592+
c.groupCache[instanceId] = proxyGroupList
593593
c.lastReloadTime[instanceId] = time.Now()
594594
level.Debug(c.logger).Log("msg", "Get gaap Namespaces info from api", "instanceId", instanceId)
595595
return proxyGroupList, nil
@@ -598,9 +598,9 @@ func (c *TcGaapInstanceeInfosCache) GetProxyGroupList(instanceId string) (*gaap.
598598
func NewTcGaapInstanceeInfosCache(repo QaapTcInstanceInfoRepository, reloadInterval time.Duration, logger log.Logger) QaapTcInstanceInfoRepository {
599599
cache := &TcGaapInstanceeInfosCache{
600600
Raw: repo,
601-
cache1: map[string]*gaap.DescribeTCPListenersResponse{},
602-
cache2: map[string]*gaap.DescribeUDPListenersResponse{},
603-
cache3: map[string]*gaap.DescribeProxyGroupListResponse{},
601+
tcpCache: map[string]*gaap.DescribeTCPListenersResponse{},
602+
udpCache: map[string]*gaap.DescribeUDPListenersResponse{},
603+
groupCache: map[string]*gaap.DescribeProxyGroupListResponse{},
604604
lastReloadTime: map[string]time.Time{},
605605
reloadInterval: reloadInterval,
606606
logger: logger,

0 commit comments

Comments
 (0)