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

Metric too ambiguous #1228

Closed
marcin-krolik opened this issue Sep 22, 2016 · 0 comments
Closed

Metric too ambiguous #1228

marcin-krolik opened this issue Sep 22, 2016 · 0 comments

Comments

@marcin-krolik
Copy link
Collaborator

marcin-krolik commented Sep 22, 2016

Plugin exposes metrics like below:

$ snapctl metric list
NAMESPACE                                VERSIONS
...
/intel/psutil/cpu/*/guest                7
/intel/psutil/cpu/*/guest_nice           7
/intel/psutil/cpu/*/idle                 7
/intel/psutil/cpu/*/iowait               7
/intel/psutil/cpu/*/irq                  7
/intel/psutil/cpu/*/nice                 7
/intel/psutil/cpu/*/softirq              7
/intel/psutil/cpu/*/steal                7
/intel/psutil/cpu/*/stolen               7
/intel/psutil/cpu/*/system               7
/intel/psutil/cpu/*/user                 7
/intel/psutil/cpu/cpu-total/guest        7
/intel/psutil/cpu/cpu-total/guest_nice   7
/intel/psutil/cpu/cpu-total/idle         7
/intel/psutil/cpu/cpu-total/iowait       7
/intel/psutil/cpu/cpu-total/irq          7
/intel/psutil/cpu/cpu-total/nice         7
/intel/psutil/cpu/cpu-total/softirq      7
/intel/psutil/cpu/cpu-total/steal        7
/intel/psutil/cpu/cpu-total/stolen       7
/intel/psutil/cpu/cpu-total/system       7
/intel/psutil/cpu/cpu-total/user         7
...

where

  • /intel/psutil/cpu/*/<metric_name> are dynamic metrics per cpu ids
  • /intel/psutil/cpu/cpu-total/<metric_name> are static metrics for aggregated value over all cpus

1st Example task manifest:

---
  version: 1
  schedule: 
    type: "simple"
    interval: "1s"
  max-failures: 10
  workflow: 
    collect: 
      metrics: 
        /intel/psutil/cpu/*/user: {}
      config: 
        /intel: 
          name: "root"
          password: "secret"    

2nd Example task manifest:

---
  version: 1
  schedule: 
    type: "simple"
    interval: "1s"
  max-failures: 10
  workflow: 
    collect: 
      metrics: 
        /intel/psutil/cpu/*: {}
      config: 
        /intel: 
          name: "root"
          password: "secret"    

Issue:
For both task manifest, when starting task error is reported:

for example 1:

$ snapctl task create -t example_1.yaml 
Using task manifest to create task
Error creating task:Incoming namespace `/intel/psutil/cpu/*/user` is too ambiguous (version: 7)

for example 2:

$ snapctl task create -t example_2.yaml 
Using task manifest to create task
Incoming namespace `/intel/psutil/cpu/*/softirq` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/idle` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/guest_nice` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/user` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/system` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/steal` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/guest` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/nice` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/iowait` is too ambiguous (version: 7)
Incoming namespace `/intel/psutil/cpu/*/stolen` is too ambiguous (version: 7)

Problems seems to be in mtnode.GetMetric() which is called by subscriptionGroups.ValidateDeps() -> subscriptionGroups.validateMetric() -> metricCatalog.GetMetric().
Function mtnode.GetMetric() returns error when more then one metric is retrieved from metric tree, which was not the case before. I tested above examples with 6dee88 commit and both tasks work without any problem.

I would assume this is a bug, otherwise it's quite limiting plugins ability to expose metrics.

Important: to test above behavior please refer to snap-plugin-collector-psutil from https://github.com/marcin-krolik/snap-plugin-collector-psutil/tree/feat/dynamic-metrics

@intelsdi-x/snap-maintainers

jcooklin added a commit to jcooklin/snap that referenced this issue Sep 23, 2016
* Updates validateMetric on subscriptionGroups to use GetMetrics instead
of GetMetric since some namespace requests can expand to include
multiple metrics.
jcooklin added a commit to jcooklin/snap that referenced this issue Sep 23, 2016
* Updates validateMetric on subscriptionGroups to use GetMetrics instead
of GetMetric since some namespace requests can expand to include
multiple metrics.
jcooklin added a commit to jcooklin/snap that referenced this issue Sep 23, 2016
* Updates validateMetric on subscriptionGroups to use GetMetrics instead
of GetMetric since some namespace requests can expand to include
multiple metrics.
jcooklin added a commit to jcooklin/snap that referenced this issue Oct 5, 2016
* Updates validateMetric on subscriptionGroups to use GetMetrics instead
of GetMetric since some namespace requests can expand to include
multiple metrics.
jcooklin added a commit that referenced this issue Oct 7, 2016
Fixes #1222 and #1228 : Applies config defaults - Metric too ambiguous
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

2 participants