@@ -979,26 +979,32 @@ func (p *pluginMetricTypes) Count() int {
979
979
func groupMetricTypesByPlugin (cat catalogsMetrics , metricTypes []core.Metric ) (map [string ]pluginMetricTypes , serror.SnapError ) {
980
980
pmts := make (map [string ]pluginMetricTypes )
981
981
// For each plugin type select a matching available plugin to call
982
- for _ , mt := range metricTypes {
983
- version := mt .Version ()
982
+ for _ , incomingmt := range metricTypes {
983
+ version := incomingmt .Version ()
984
984
if version == 0 {
985
985
// If the version is not provided we will choose the latest
986
986
version = - 1
987
987
}
988
-
989
- lp , err := cat .GetPlugin (mt .Namespace (), version )
988
+ catalogedmt , err := cat .Get (incomingmt .Namespace (), version )
990
989
if err != nil {
991
990
return nil , serror .New (err )
992
991
}
993
- // if loaded plugin is nil, we have failed. return error
992
+ returnedmt := plugin.PluginMetricType {
993
+ Namespace_ : incomingmt .Namespace (),
994
+ LastAdvertisedTime_ : catalogedmt .LastAdvertisedTime (),
995
+ Version_ : incomingmt .Version (),
996
+ Tags_ : catalogedmt .Tags (),
997
+ Labels_ : catalogedmt .Labels (),
998
+ Config_ : incomingmt .Config (),
999
+ }
1000
+ lp := catalogedmt .Plugin
994
1001
if lp == nil {
995
- return nil , serror .New (errorMetricNotFound (mt .Namespace ()))
1002
+ return nil , serror .New (errorMetricNotFound (incomingmt .Namespace ()))
996
1003
}
997
-
998
1004
key := lp .Key ()
999
1005
pmt , _ := pmts [key ]
1000
1006
pmt .plugin = lp
1001
- pmt .metricTypes = append (pmt .metricTypes , mt )
1007
+ pmt .metricTypes = append (pmt .metricTypes , returnedmt )
1002
1008
pmts [key ] = pmt
1003
1009
}
1004
1010
return pmts , nil
0 commit comments