mirror of https://github.com/status-im/consul.git
Merge pull request #8685 from pierresouchay/do_not_flood_logs_with_Non-server_in_server-only_area
[BUGFIX] Avoid GetDatacenter* methods to flood Consul servers logs
This commit is contained in:
parent
f88600320d
commit
3ee2aa1325
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
fixed a bug that caused logs to be flooded with `[WARN] agent.router: Non-server in server-only area`
|
||||||
|
```
|
|
@ -536,10 +536,13 @@ func (r *Router) GetDatacentersByDistance() ([]string, error) {
|
||||||
for _, m := range info.cluster.Members() {
|
for _, m := range info.cluster.Members() {
|
||||||
ok, parts := metadata.IsConsulServer(m)
|
ok, parts := metadata.IsConsulServer(m)
|
||||||
if !ok {
|
if !ok {
|
||||||
r.logger.Warn("Non-server in server-only area",
|
if areaID != types.AreaLAN {
|
||||||
"non_server", m.Name,
|
r.logger.Warn("Non-server in server-only area",
|
||||||
"area", areaID,
|
"non_server", m.Name,
|
||||||
)
|
"area", areaID,
|
||||||
|
"func", "GetDatacentersByDistance",
|
||||||
|
)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +550,7 @@ func (r *Router) GetDatacentersByDistance() ([]string, error) {
|
||||||
r.logger.Debug("server in area left, skipping",
|
r.logger.Debug("server in area left, skipping",
|
||||||
"server", m.Name,
|
"server", m.Name,
|
||||||
"area", areaID,
|
"area", areaID,
|
||||||
|
"func", "GetDatacentersByDistance",
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -607,10 +611,13 @@ func (r *Router) GetDatacenterMaps() ([]structs.DatacenterMap, error) {
|
||||||
for _, m := range info.cluster.Members() {
|
for _, m := range info.cluster.Members() {
|
||||||
ok, parts := metadata.IsConsulServer(m)
|
ok, parts := metadata.IsConsulServer(m)
|
||||||
if !ok {
|
if !ok {
|
||||||
r.logger.Warn("Non-server in server-only area",
|
if areaID != types.AreaLAN {
|
||||||
"non_server", m.Name,
|
r.logger.Warn("Non-server in server-only area",
|
||||||
"area", areaID,
|
"non_server", m.Name,
|
||||||
)
|
"area", areaID,
|
||||||
|
"func", "GetDatacenterMaps",
|
||||||
|
)
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,6 +625,7 @@ func (r *Router) GetDatacenterMaps() ([]structs.DatacenterMap, error) {
|
||||||
r.logger.Debug("server in area left, skipping",
|
r.logger.Debug("server in area left, skipping",
|
||||||
"server", m.Name,
|
"server", m.Name,
|
||||||
"area", areaID,
|
"area", areaID,
|
||||||
|
"func", "GetDatacenterMaps",
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue