Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could exceptions identify specific resource accessed? #415

Open
cben opened this issue Jun 24, 2019 · 0 comments
Open

Could exceptions identify specific resource accessed? #415

cben opened this issue Jun 24, 2019 · 0 comments

Comments

@cben
Copy link
Collaborator

cben commented Jun 24, 2019

I'm looking at app logs that perform many get_* calls, one of them failing, but I can't tell which, neither from kubeclient stack portion, nor the calling app:

[----] E, [2019-06-21T10:03:51.073003 #19344:590f4c] ERROR -- : [JSON::ParserError]: 765: unexpected token at 'This request caused apiserver to panic. Look in the logs for details.
'  Method:[block (2 levels) in <class:LogProxy>]
[----] E, [2019-06-21T10:03:51.073119 #19344:590f4c] ERROR -- : /usr/share/gems/gems/json-2.1.0/lib/json/common.rb:156:in `parse'
/usr/share/gems/gems/json-2.1.0/lib/json/common.rb:156:in `parse'
/opt/rh/cfme-gemset/gems/kubeclient-4.1.2/lib/kubeclient/common.rb:501:in `format_response'
/opt/rh/cfme-gemset/gems/kubeclient-4.1.2/lib/kubeclient/common.rb:315:in `get_entities'
/opt/rh/cfme-gemset/gems/kubeclient-4.1.2/lib/kubeclient/common.rb:206:in `block (2 levels) in define_entity_methods'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-kubernetes-339029025f99/app/models/manageiq/providers/kubernetes/container_manager/refresher_mixin.rb:67:in `block in fetch_entities'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-kubernetes-339029025f99/app/models/manageiq/providers/kubernetes/container_manager/refresher_mixin.rb:65:in `each'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-kubernetes-339029025f99/app/models/manageiq/providers/kubernetes/container_manager/refresher_mixin.rb:65:in `each_with_object'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-kubernetes-339029025f99/app/models/manageiq/providers/kubernetes/container_manager/refresher_mixin.rb:65:in `fetch_entities'
/opt/rh/cfme-gemset/bundler/gems/cfme-providers-openshift-eb55293f9470/app/models/manageiq/providers/openshift/container_manager/refresher.rb:30:in `block in collect_full_inventory'

This is an unfortunate interaction between the app (manageiq) doing client.send("get_#{entity[:name]}") in a loop:
https://github.com/ManageIQ/manageiq-providers-kubernetes/blob/bf6594110f8716f128a387e5a0817e89645d248e/app/models/manageiq/providers/kubernetes/container_manager/refresher_mixin.rb#L58-L67
and kubeclient defining method dynamically, so best you see in stack trace is generic get_entity:
https://github.com/abonas/kubeclient/blob/cb998b94a11ca271c1493d5d993804fd1c215a42/lib/kubeclient/common.rb#L207-L212

I know how to log better in the calling app, but I wonder if kubeclient could do something to make stack traces more informative?

I have some (ugly) ideas for dynamic methods like get_pod, but here's a harder challenge:
what about dynamic interfaces like .get(kind: ..., ..., metadata: {name: ..., }) that we want to add in #332 ? This is by definition a single method.

  • One idea I have is not worrying about descriptive stack frames, but annotating the final exception object with details — what operation, what kind, what namespace/name (or just full URL accessed).
@cben cben changed the title Could stack traces identify specific resource accessed? Could exceptions identify specific resource accessed? Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant