Open YRXING opened 2 years ago
I don't think it's a bug. It's not only DefaultBackendManager
that can record the backend but all backend managers inherit AddBackend
from DefaultBackendStorage
. Please reconsider this.
Yes, every backend manager will inherit AddBackend
method.
What I wonder is that the DefaultBackendStorage
record backend
metric through setting their own backends count while the backend
metric is belong to proxy server. And the backend managers will overwrite each other's values.
For example, the proxy server has two backend managers. One has three backends and the other has five backends. Now the backend metric will only be one of these tow values while the actual value may be greater than three and smaller than five.
The related codes as following shows:
// SetBackendCount sets the number of backend connection.
func (a *ServerMetrics) SetBackendCount(count int) {
a.backend.WithLabelValues().Set(float64(count))
}
func (s *DefaultBackendStorage) AddBackend(identifier string, idType pkgagent.IdentifierType, conn agent.AgentService_ConnectServer) Backend {
// ...
addedBackend := newBackend(conn)
// ...
metrics.Metrics.SetBackendCount(len(s.backends))
// ...
return addedBackend
}
Thanks for your explanation, let's go on with your fix. proxy server is designed to support multiple backend managers, though currently only one is used.
/cc @yan-lgtm /cc @cheftako
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle stale
/lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/remove-lifecycle rotten
/close
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
lifecycle/stale
is appliedlifecycle/stale
was applied, lifecycle/rotten
is appliedlifecycle/rotten
was applied, the issue is closedYou can:
/reopen
/remove-lifecycle rotten
Please send feedback to sig-contributor-experience at kubernetes/community.
/close
@k8s-triage-robot: Closing this issue.
/assign
As the konnectivity server may has multiple BackendManagers, the
backend
metric should record the total backends stored in various of BackendManager even if we can record them with a label.However, the
backend
metric is recorded by DefaultBackendStorage, which is the underlying storage implementation. It will result in only some BackendManager record its number of backends.The solution is that
backend
metric should be recorded by konnectivity server instead of DefaultBackendStorage.