This is an automated email from the ASF dual-hosted git repository.
zhongxjian pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git
The following commit(s) were added to refs/heads/master by this push:
new aa1c86ab Chore v20 (#871)
aa1c86ab is described below
commit aa1c86abc107b81c90f4184ffc82dad003543e77
Author: Joe Zhong <[email protected]>
AuthorDate: Wed Mar 4 11:23:58 2026 +0800
Chore v20 (#871)
* remove envoy mod
* feature: Add xds metrics
---
.asf.yaml | 2 +-
dubbod/discovery/pkg/model/push_context.go | 16 +++++++---------
dubbod/discovery/pkg/xds/discovery.go | 26 ++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index 08adcdcb..3e008c37 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -20,7 +20,7 @@ notifications:
jira_options: link label
github:
- homepage: "https://dubbo-kubernetes.github.io/dsm-docs/"
+ homepage: "https://dubbo-kubernetes.github.io/"
description: "Dubbo Service Mesh for Kubernetes."
features:
# Enable wiki for documentation
diff --git a/dubbod/discovery/pkg/model/push_context.go
b/dubbod/discovery/pkg/model/push_context.go
index 5300e4f4..7ecca3c0 100644
--- a/dubbod/discovery/pkg/model/push_context.go
+++ b/dubbod/discovery/pkg/model/push_context.go
@@ -18,6 +18,7 @@ package model
import (
"cmp"
+ "encoding/json"
"sort"
"strings"
"sync"
@@ -1153,14 +1154,11 @@ func firstDestinationRule(csr *consolidatedSubRules,
hostname host.Name) *networ
return nil
}
-func ConfigNamesOfKind(configs sets.Set[ConfigKey], k kind.Kind) sets.String {
- ret := sets.New[string]()
-
- for conf := range configs {
- if conf.Kind == k {
- ret.Insert(conf.Name)
- }
+func (ps *PushContext) StatusJSON() ([]byte, error) {
+ if ps == nil {
+ return []byte{'{', '}'}, nil
}
-
- return ret
+ ps.proxyStatusMutex.RLock()
+ defer ps.proxyStatusMutex.RUnlock()
+ return json.MarshalIndent(ps.ProxyStatus, "", " ")
}
diff --git a/dubbod/discovery/pkg/xds/discovery.go
b/dubbod/discovery/pkg/xds/discovery.go
index 6cca90c9..2bd75db9 100644
--- a/dubbod/discovery/pkg/xds/discovery.go
+++ b/dubbod/discovery/pkg/xds/discovery.go
@@ -36,6 +36,8 @@ import (
"google.golang.org/grpc"
)
+var periodicRefreshMetrics = 10 * time.Second
+
var processStartTime = time.Now()
type DiscoveryServer struct {
@@ -104,6 +106,7 @@ func (s *DiscoveryServer) Register(rpcs *grpc.Server) {
func (s *DiscoveryServer) Start(stopCh <-chan struct{}) {
go s.handleUpdates(stopCh)
go s.sendPushes(stopCh)
+ go s.periodicRefreshMetrics(stopCh)
go s.Cache.Run(stopCh)
}
@@ -306,6 +309,29 @@ func doSendPushes(stopCh <-chan struct{}, semaphore chan
struct{}, queue *PushQu
}
}
+func (s *DiscoveryServer) periodicRefreshMetrics(stopCh <-chan struct{}) {
+ ticker := time.NewTicker(periodicRefreshMetrics)
+ defer ticker.Stop()
+ for {
+ select {
+ case <-ticker.C:
+ push := s.globalPushContext()
+ model.LastPushMutex.Lock()
+ if model.LastPushStatus != push {
+ model.LastPushStatus = push
+ push.UpdateMetrics()
+ out, _ := model.LastPushStatus.StatusJSON()
+ if string(out) != "{}" {
+ log.Infof("Push Status: %s",
string(out))
+ }
+ }
+ model.LastPushMutex.Unlock()
+ case <-stopCh:
+ return
+ }
+ }
+}
+
func (s *DiscoveryServer) dropCacheForRequest(req *model.PushRequest) {
// If we don't know what updated, cannot safely cache. Clear the whole
cache
if req.Forced {