8000 [BUGFIX] Fix YAML files not working for provisioning by karsov · Pull Request #1589 · perses/perses · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[BUGFIX] Fix YAML files not working for provisioning #1589

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

Merged
merged 2 commits into from
Nov 15, 2023

Conversation

karsov
Copy link
Contributor
@karsov karsov commented Nov 15, 2023

Description

When using YAML files for initial provisioning (located in a folder defined in the config.yaml file's provisioning.folders field),
Perses fails to load the Dashboard and GlobalDatasource definitions throwing the following error:

...
time="2023-11-14T09:43:46Z" level=debug msg="unable to marshal the plugin \"TimeSeriesChart\"" error="json: unsupported type: map[interface {}]interface {}"
time="2023-11-14T09:43:46Z" level=error msg="unable to create the \"Dashboard\" \"Demo_Dashboard\"" error="bad request: json: unsupported type: map[interface {}]interface {}"
time="2023-11-14T09:43:46Z" level=debug msg="unable to marshal the plugin \"PrometheusDatasource\"" error="json: unsupported type: map[interface {}]interface {}"
time="2023-11-14T09:43:46Z" level=error msg="unable to create the \"GlobalDatasource\" \"DemoPrometheus\"" error="bad request: json: unsupported type: map[interface {}]interface {}"
...

I turns out this is caused by the gopkg.in/yaml.v2 library unmarshaling some YAML parts (specifically the Plugin spec) into map[interface {}]interface {}, which is not supported for marashaling by Go standard library's enconding/json.

This PR:

  • updates Perses to use the newer gopkg.in/yaml.v3 package which uses map[string]interface{} (supported by encoding/json), thus fixing the errors;
  • removes the usage of github.com/json-iterator/go, because previously it was only added to address the exact issue described above (apparently that did not fix it completely), and now that it is addressed by the YAML package update there is no further need for it;
  • changes slightly the output of percli version to have bigger indentation, because gopkg.in/yaml.v3 uses 4 spaces for indentation by default (compared to 2 spaces in gopkg.in/yaml.v2).

Checklist

  • Pull request has a descriptive title and context useful to a reviewer.
  • Pull request title follows the [<catalog_entry>] <commit message> naming convention using one of the following catalog_entry values: FEATURE, ENHANCEMENT, BUGFIX, BREAKINGCHANGE, IGNORE.
  • All commits have DCO signoffs.

… provisioning

Signed-off-by: Kalin Arsov <kalin.arsov@gmail.com>
…sary with gopkg.in/yaml.v3

Signed-off-by: Kalin Arsov <kalin.arsov@gmail.com>
Copy link
Member
@Nexucis Nexucis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice thank you for taking time to fix this bug !!

@Nexucis Nexucis merged commit 7141174 into perses:main Nov 15, 2023
@karsov karsov deleted the fix-yaml branch November 16, 2023 06:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0