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

Fix Unknown value type error for array string value #10690

Closed
wants to merge 4 commits into from

Conversation

slvlirnoff
Copy link

@slvlirnoff slvlirnoff commented Sep 22, 2023

Fix Unknown value type error for array string value:

The jsonparser package has an issue with string values in array, a fix has been submitted 4 years ago but hasn't been integrated. This PR replace the dependency with the fork that includes the fix.

Which issue(s) this PR fixes:
Fixes #9179

Special notes for your reviewer:
The PR in the jsonparser dependency buger/jsonparser#180

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • CHANGELOG.md updated
    • If the change is worth mentioning in the release notes, add add-to-release-notes label
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • For Helm chart changes bump the Helm chart version in production/helm/loki/Chart.yaml and update production/helm/loki/CHANGELOG.md and production/helm/loki/README.md. Example PR

@slvlirnoff slvlirnoff requested a review from a team as a code owner September 22, 2023 21:49
@CLAassistant
Copy link

CLAassistant commented Sep 22, 2023

CLA assistant check
All committers have signed the CLA.

@slvlirnoff slvlirnoff changed the title Fix 9179 Fix Unknown value type error for array string value Sep 22, 2023
@owen-d
Copy link
Member

owen-d commented Oct 10, 2023

Hey, this is a pretty great fix, thanks! There's one bit I'm concerned about though: while the library fork fixes the bug, it also has a large amount of drift from the original library (36 commits at time of this comment). I'd rather update the original dependency (buger's variant) if we can get the fix merged there instead.

@slvlirnoff
Copy link
Author

Hello @owen-d I think the fork is pretty similar to the master branch of the library and includes only a small fix for this. However the library had a few other fixes merged since the latest 1.1.1 release. These fixes might be relevant too but they weren't pulled in so far because the library didn't tag any new releases in the last 3yr.

@slvlirnoff
Copy link
Author

@owen-d @MichelHollands any thoughts on this?

@cstyan
Copy link
Contributor

cstyan commented Nov 6, 2023

I was going to suggest we consider trying the package pyroscope and mimir use for json parsing, but it's worth noting that it also hasn't had a release in ~1y and has lots of open issues/PRs without responses.

@jrgvf
Copy link

jrgvf commented Jan 25, 2024

Hello, any news?

paul1r added a commit that referenced this pull request Feb 13, 2024
…#11921)

**What this PR does / why we need it**:
This PR imports the newly forked grafana/jsonparser over the
buger/jsonparser module. The latter has seemingly been abandoned. PR
10690 introduces a fix to the jsonparser module, which has been
incorporated into the grafana fork of the module.

The PR is designed to fix accessing string array elements from within a
JSON structure. For example, with the following JSON:
`{"log":{"message":{"content":{"misses":["a","b","c","d"]}}}}`

The Loki code, before this PR, when searching for `json misses =
"log.message.content.misses[0]" ` will result in an "Unknown value type
error". After this PR is merged, the result will assign `a` to the
`misses` variable.

**Which issue(s) this PR fixes**:
Fixes #[9179](#9179)
#10690

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [ ] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [x] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [ ] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](d10549e)
- [ ] If the change is deprecating or removing a configuration option,
update the `deprecated-config.yaml` and `deleted-config.yaml` files
respectively in the `tools/deprecated-config-checker` directory.
[Example
PR](0d4416a)
@paul1r
Copy link
Collaborator

paul1r commented Feb 13, 2024

Hello, apologies for the delay! I've integrated a fix today that should fix this issue. If it does not, please reopen this.

@paul1r paul1r closed this Feb 13, 2024
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
…grafana#11921)

**What this PR does / why we need it**:
This PR imports the newly forked grafana/jsonparser over the
buger/jsonparser module. The latter has seemingly been abandoned. PR
10690 introduces a fix to the jsonparser module, which has been
incorporated into the grafana fork of the module.

The PR is designed to fix accessing string array elements from within a
JSON structure. For example, with the following JSON:
`{"log":{"message":{"content":{"misses":["a","b","c","d"]}}}}`

The Loki code, before this PR, when searching for `json misses =
"log.message.content.misses[0]" ` will result in an "Unknown value type
error". After this PR is merged, the result will assign `a` to the
`misses` variable.

**Which issue(s) this PR fixes**:
Fixes #[9179](grafana#9179)
grafana#10690

**Special notes for your reviewer**:

**Checklist**
- [x] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [ ] Documentation added
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [x] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/setup/upgrade/_index.md`
- [ ] For Helm chart changes bump the Helm chart version in
`production/helm/loki/Chart.yaml` and update
`production/helm/loki/CHANGELOG.md` and
`production/helm/loki/README.md`. [Example
PR](grafana@d10549e)
- [ ] If the change is deprecating or removing a configuration option,
update the `deprecated-config.yaml` and `deleted-config.yaml` files
respectively in the `tools/deprecated-config-checker` directory.
[Example
PR](grafana@0d4416a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JSON: Accessing string from array leads to Unknown value type error
7 participants