GNMI plugin should not take off the first character of field keys when no 'alias path' exists. (#8659)
* GNMI plugin should not take off the first character of field keys when no 'alias path' exists. * fix test method name * fix test file formatting * fix test file formatting * Remove my unnecessary failing test
This commit is contained in:
parent
6bd5334f8b
commit
fbd54e84a2
|
|
@ -290,11 +290,11 @@ func (c *GNMI) handleSubscribeResponseUpdate(address string, response *gnmi.Subs
|
||||||
// Group metrics
|
// Group metrics
|
||||||
for k, v := range fields {
|
for k, v := range fields {
|
||||||
key := k
|
key := k
|
||||||
if len(aliasPath) < len(key) {
|
if len(aliasPath) < len(key) && len(aliasPath) != 0 {
|
||||||
// This may not be an exact prefix, due to naming style
|
// This may not be an exact prefix, due to naming style
|
||||||
// conversion on the key.
|
// conversion on the key.
|
||||||
key = key[len(aliasPath)+1:]
|
key = key[len(aliasPath)+1:]
|
||||||
} else {
|
} else if len(aliasPath) >= len(key) {
|
||||||
// Otherwise use the last path element as the field key.
|
// Otherwise use the last path element as the field key.
|
||||||
key = path.Base(key)
|
key = path.Base(key)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue