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

Error reported when plugin catalog is empty #1229

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

Error reported when plugin catalog is empty #1229

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

Comments

@marcin-krolik
Copy link
Collaborator

marcin-krolik commented Sep 22, 2016

Reproduction steps:

  1. Start snapd eg. snapd -t 0 -l 1&
  2. Check metric catalog (no collectors loaded) snapctl metric list

Results:
Snapctl reports error

$ snapctl metric list
Error getting metrics: metric catalog is empty, no plugin loaded

Snapd reports error

ERRO[2016-09-22T12:56:08+02:00] error fetching metrics                        _block=fetch _file=metrics.go, _module=control error=metric catalog is empty, no plugin loaded

This should not be reported as error, maybe just info, or warning?

During large tests pytest module checks snap output for any error, and fails the test if any error was found. While this could be easily changed to omit/discard errors returned by snapd, I think it's not beneficial to large tests in general

@IRCody
Copy link
Contributor

IRCody commented Sep 22, 2016

If the reporting is changed to not be an error, what do you think the snapctl behavior should be? I think right now it would end up printing out the column header info then nothing which is not ideal.

@lynxbat
Copy link
Contributor

lynxbat commented Sep 22, 2016

Yeah, this is not an error. Asking for a list of metrics should be able to return an empty list.
I wouldn't mention plugins at all in the response as it is not really relevant.

@geauxvirtual
Copy link
Contributor

This is definitely a change in behavior with the merge of PR #1220. Prior to this PR, an empty list would be returned to snapctl, and snapctl would just print out the column headers.

@lynxbat
Copy link
Contributor

lynxbat commented Sep 22, 2016

Functionally a REST API call to a list can return an empty list without error.

Snapctl can be a bigger discussion. I would prefer maybe a "helper" message after the empty list that can say "Try loading a plugin first to get some metrics"

IRCody added a commit to IRCody/snap that referenced this issue Sep 22, 2016
Empty metric catalog no longer logs or returns an error when queried
via the rest API (or any other method). Will instead return an empty
list of metrics, leaving choice of how to display that to the caller.

Removes the empty metric catalog error and modifies client_func_test to
reflect the changes in behavior.
@IRCody
Copy link
Contributor

IRCody commented Sep 23, 2016

I submitted a PR for this and opened #1233 to track improvements to snapctl dealing with empty lists for metrics/plugins.

IRCody added a commit that referenced this issue Sep 28, 2016
Fixes #1229: Empty metric catalog no longer errors
mareahall pushed a commit to mareahall/snap that referenced this issue Sep 29, 2016
Empty metric catalog no longer logs or returns an error when queried
via the rest API (or any other method). Will instead return an empty
list of metrics, leaving choice of how to display that to the caller.

Removes the empty metric catalog error and modifies client_func_test to
reflect the changes in behavior.
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

5 participants