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

KeyError gnetId #7

Closed
harrison-kim opened this issue Aug 31, 2020 · 5 comments · Fixed by #8
Closed

KeyError gnetId #7

harrison-kim opened this issue Aug 31, 2020 · 5 comments · Fixed by #8
Assignees
Labels
bug Something isn't working

Comments

@harrison-kim
Copy link

Hello 👋

When running frigga gl, I ran into the following error message:

Traceback (most recent call last):
  File "/usr/local/bin/frigga", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/scripts/frigga.py", line 64, in grafana_list
    metrics = get_metrics_list(grafana_url, grafana_api_key)
  File "/usr/local/lib/python3.8/site-packages/scripts/grafana.py", line 108, in get_metrics_list
    dashboard_gnetid = dashboard_body['dashboard']['gnetId']
KeyError: 'gnetId'

I made the following error on my local as a quick workaround to grafana.py

        try:
            dashboard_gnetid = dashboard_body['dashboard']['gnetId']
            data['dashboards'][dashboard_name]['gnet_id'] = dashboard_gnetid
        except:
            print('no gnet id')

Is this something that should be added to the script or is it a potential issue on my end that's causing gnetId to not be found? If it's the latter, is there some documentation I may be able to reference to help resolve this?

@unfor19
Copy link
Owner

unfor19 commented Aug 31, 2020

@harrison-kim thank you for the input! I would definitely add a fix for that.
I haven't tested Frigga with dashboards that don't have a gnet_id - just in case you don't know what it is - it's the dashboards public ID (the one you use import by ID)

Long story short - I'll merge a fix and keep you posted.
Thanks for the input!

@unfor19 unfor19 added the bug Something isn't working label Aug 31, 2020
@unfor19 unfor19 self-assigned this Aug 31, 2020
@harrison-kim
Copy link
Author

@harrison-kim thank you for the input! I would definitely add a fix for that.
I haven't tested Frigga with dashboards that don't have a gnet_id - just in case you don't know what it is - it's the dashboards public ID (the one you use import by ID)

Long story short - I'll merge a fix and keep you posted.
Thanks for the input!

Oo that makes a lot of sense why it failed on our private dashboards. Thanks a lot for the clarification!

Please feel free to reach out if there's anything I can help with on my end 📣

@unfor19
Copy link
Owner

unfor19 commented Aug 31, 2020

@harrison-kim the fix was implemented in the latest version - v1.0.7
I tested it by removing gnet_id from the prometheus-overview dashboard, and the tests are still passing.

Your input is valuable, so if you can report back that it works now, that would be awesome!

To update frigga, use pip with the -U flag

pip install -U frigga

@unfor19 unfor19 reopened this Aug 31, 2020
@harrison-kim
Copy link
Author

@harrison-kim the fix was implemented in the latest version - v1.0.7
I tested it by removing gnet_id from the prometheus-overview dashboard, and the tests are still passing.

Your input is valuable, so if you can report back that it works now, that would be awesome!

To update frigga, use pip with the -U flag

pip install -U frigga

It works! To test this, I reverted the manual changes I made in grafana.py earlier and ran the script to ensure I saw KeyError: 'gnetId' again. Afterwards, I pip installed to upgrade and ran the job without any errors!

Thank you for the prompt fix!

@unfor19
Copy link
Owner

unfor19 commented Aug 31, 2020

Excellent, thank you!

@unfor19 unfor19 closed this as completed Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants