internal/monitoring: find mounttable via namespace
The mounttable servers are now mounted on 'mt'. So, we can treat it like
any other service. In particular, this means that we can monitor a
replicated mounttable.
Change-Id: Ib21868275b2dec192ea9bc779ecf1a916a8b6315
diff --git a/internal/monitoring/monitoring.go b/internal/monitoring/monitoring.go
index 4e53a2a..2fbbb53 100644
--- a/internal/monitoring/monitoring.go
+++ b/internal/monitoring/monitoring.go
@@ -54,7 +54,7 @@
// serviceMountedNames is a map from human-readable service names to their
// relative mounted names in the global mounttable.
var serviceMountedNames = map[string]string{
- SNMounttable: "",
+ SNMounttable: "mt",
SNIdentity: "identity/dev.v.io:u",
SNMacaroon: "identity/dev.v.io:u/macaroon",
SNBinaryDischarger: "identity/dev.v.io:u/discharger",
@@ -121,30 +121,22 @@
// Group resolved names by their routing ids.
groups := map[string]naming.MountEntry{}
- if serviceName == SNMounttable {
- // Mounttable resolves to itself, so we just use a dummy routing id with
- // its original mounted name.
- groups["-"] = naming.MountEntry{
- Servers: []naming.MountedServer{naming.MountedServer{Server: serviceMountedName}},
+ for _, resolvedName := range resolvedNames {
+ serverName, relativeName := naming.SplitAddressName(resolvedName)
+ ep, err := naming.ParseEndpoint(serverName)
+ if err != nil {
+ return nil, err
}
- } else {
- for _, resolvedName := range resolvedNames {
- serverName, relativeName := naming.SplitAddressName(resolvedName)
- ep, err := naming.ParseEndpoint(serverName)
- if err != nil {
- return nil, err
- }
- routingId := ep.RoutingID.String()
- if _, ok := groups[routingId]; !ok {
- groups[routingId] = naming.MountEntry{}
- }
- curMountEntry := groups[routingId]
- curMountEntry.Servers = append(curMountEntry.Servers, naming.MountedServer{Server: serverName})
- // resolvedNames are resolved from the same service so they should have
- // the same relative name.
- curMountEntry.Name = relativeName
- groups[routingId] = curMountEntry
+ routingId := ep.RoutingID.String()
+ if _, ok := groups[routingId]; !ok {
+ groups[routingId] = naming.MountEntry{}
}
+ curMountEntry := groups[routingId]
+ curMountEntry.Servers = append(curMountEntry.Servers, naming.MountedServer{Server: serverName})
+ // resolvedNames are resolved from the same service so they should have
+ // the same relative name.
+ curMountEntry.Name = relativeName
+ groups[routingId] = curMountEntry
}
return groups, nil