Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit ed2e620

Browse files
committed
Merge pull request #809 from danielscottt/tags
forward tags and labels from the catalog to the plugin on collection
2 parents fb04a73 + 6a3560f commit ed2e620

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

control/control.go

+14-8
Original file line numberDiff line numberDiff line change
@@ -979,26 +979,32 @@ func (p *pluginMetricTypes) Count() int {
979979
func groupMetricTypesByPlugin(cat catalogsMetrics, metricTypes []core.Metric) (map[string]pluginMetricTypes, serror.SnapError) {
980980
pmts := make(map[string]pluginMetricTypes)
981981
// 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()
984984
if version == 0 {
985985
// If the version is not provided we will choose the latest
986986
version = -1
987987
}
988-
989-
lp, err := cat.GetPlugin(mt.Namespace(), version)
988+
catalogedmt, err := cat.Get(incomingmt.Namespace(), version)
990989
if err != nil {
991990
return nil, serror.New(err)
992991
}
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
9941001
if lp == nil {
995-
return nil, serror.New(errorMetricNotFound(mt.Namespace()))
1002+
return nil, serror.New(errorMetricNotFound(incomingmt.Namespace()))
9961003
}
997-
9981004
key := lp.Key()
9991005
pmt, _ := pmts[key]
10001006
pmt.plugin = lp
1001-
pmt.metricTypes = append(pmt.metricTypes, mt)
1007+
pmt.metricTypes = append(pmt.metricTypes, returnedmt)
10021008
pmts[key] = pmt
10031009
}
10041010
return pmts, nil

0 commit comments

Comments
 (0)