Skip to content

Commit 4b62f33

Browse files
authored
PMM-8489 fix: topology in mongos (#322)
* fix: topology in mongos * Changelog 322
1 parent efaa8b9 commit 4b62f33

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Release 0.20.6 (unreleased)
22

3+
Fixed bug PMM-8489: Failed to get topology labels when the target server is mongos
34
Improvement \#283 : Add storage stats to collection metrics (Thanks Masaru Hoshi @qlik-trial)
45

56

exporter/topology_info.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,11 @@ func (t *topologyInfo) loadLabels(ctx context.Context) error {
115115
}
116116
t.labels[labelClusterID] = cid
117117

118+
// Standalone instances or mongos instances won't have a replicaset state
118119
state, err := util.MyState(ctx, t.client)
119-
if err != nil {
120-
return errors.Wrapf(ErrCannotGetTopologyLabels, "error getting replicaset state: %s", err)
120+
if err == nil {
121+
t.labels[labelReplicasetState] = fmt.Sprintf("%d", state)
121122
}
122-
t.labels[labelReplicasetState] = fmt.Sprintf("%d", state)
123123

124124
return nil
125125
}

0 commit comments

Comments
 (0)