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

Source_ , Tags_ etc added in GetMetricTypes() are not visible in CollectMetric() #650

Closed
sandlbn opened this issue Jan 5, 2016 · 1 comment

Comments

@sandlbn
Copy link
Contributor

sandlbn commented Jan 5, 2016

I added Source and Tags fields to the PluginMetricType in GetMetricTypes() function.

plugin.PluginMetricType{Namespace_: []string{"libvirt", hostname, uuid, "cpu", metric, Source_: hostname, Tags_: some_tags}

to avoid unnecessary calls in CollectMetric(),
but those values are not visible in CollectMetrics function.

func (p *Libvirt) CollectMetrics(mts []plugin.PluginMetricType) ([]plugin.PluginMetricType, error) {
    for _, p := range mts {
        fmt.Println(p.Source_)
        fmt.Println(p.Tags_)
    }
}

Source and Tags are empty. I can create buffer to cache values but I don't think so that this should be necessary. is it a bug or maybe I should populate Source, Tags and Labels in a different way. ?

@sandlbn sandlbn changed the title Source_ , Tags_ etc added in GetMetricTypes are not visible in CollectMetrics Source_ , Tags_ etc added in GetMetricTypes() are not visible in CollectMetric() Jan 5, 2016
@pittma pittma added the type/bug label Jan 5, 2016
@jcooklin
Copy link
Collaborator

jcooklin commented Jan 5, 2016

Is it a bug or maybe I should populate Source, Tags and Labels in a different way?

It's currently working as designed. The thinking being that the tags can change over time thus they are best managed by the plugin author. This being said I'm not opposed to storing the tags and source in control (snapd agent) so they can be sent on future Collect calls.

Relates to #651

@lynxbat lynxbat added the tracked label Jan 5, 2016
IzabellaRaulin pushed a commit to IzabellaRaulin/snap that referenced this issue Mar 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants