-
Notifications
You must be signed in to change notification settings - Fork 294
First implementation of dynamic query support #803
First implementation of dynamic query support #803
Conversation
} | ||
} | ||
|
||
// todo uncomment this after adjusting all plugins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments should be removed as the below lines are not commented out, nor should the lines be commented out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I decided to remove this commented out code. When I finish revising that all plugins do not exposed a wildcard in the end of namespace + refactoring that one which has such like metrics, I will add this part of validation + unit test which covers that again in another pull request.
Already even plugin has metrics which ends with wildcard, it will works properly and can be used by users before refactoring.
cc5c244
to
b0d4fb4
Compare
@@ -125,6 +128,31 @@ type managesSigning interface { | |||
ValidateSignature([]string, string, []byte) error | |||
} | |||
|
|||
type metric struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can reuse metricType (defined here in metrics.Go) instead of creating this definition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, done
9361267
to
a48553b
Compare
Code after suggested changes. Feel free to comment this PR |
mts = append(mts, &metric{ | ||
namespace: ns, | ||
version: m.Version(), | ||
config: wf.configTree.Get(m.Namespace()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loading mock1 and running the following task fails.
---
version: 1
schedule:
type: "simple"
interval: "1s"
workflow:
collect:
metrics:
/intel/*: {}
config:
/intel/mock:
user: "root"
password: "secret"
To fix this line should be config: wf.configTree.Get(ns),
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, now it only works for "/intel/mock/*" and for others variations of queries (e.g like /intel/mock/(foo|bar)), but they have to start with "/intel/mock" to get this config.
I looked on that and I suppose that turning m.Namespace()
into ns
is not the only thing which needs to been done in this case. Look on scheduler/job.go#L221 - I do not refactor this file (generally my approach was changing as little as possible), but might this should be changed too - according that, 2 things have to be refactored:
- in scheduler/job.go func (c *collectorJob) Run()
- in control/control.go func (p *pluginControl) CollectMetrics(..)
@jcooklin - what do you think about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After refactoring, for metric "/intel/*" in task manifest, the config section is retrieved properly
nice work! Do we have a doc that outlines the current behavior and the differences this enhancement may bring? |
@candysmurf - already there is only that: docs/TASKS.md But did you mean a doc for this pull request or generally more detailed section in snap/doc?
|
605f544
to
ed279df
Compare
Code after suggested changes by @jcooklin - after refactoring, for metric "/intel/*" in task manifest, the config section is retrieved properly. This fix required (ndirectly) the separation of
BEFORE there was only ExpandWildcards() which performed the matching process when there were not any matched results for this 'metric to collect' which is taken from task manifest. |
LGTM. 🚢 it. |
ed279df
to
4a20ccc
Compare
I've just added labels to show that this pull request is a good example of using that ones. |
Related to #676
Summary of changes:
Testing done:
@intelsdi-x/snap-maintainers