-
Notifications
You must be signed in to change notification settings - Fork 63
[BUG] [object Object] is not valid JSON in prometheus metrics #1665
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
Comments
Thanks for the bug report! Tried following the refs to derive what the intended type is and it does look like it's inconsistently being used as a string and object. In a similar position: I tried refactoring to make a safer userConfig parser const parseMetadataUserConfig = (
userConfigs?: string | SavedObjectAttributes
): SavedObjectAttributes => {
if (userConfigs === undefined || userConfigs === '') {
return {};
} else if (typeof userConfigs === 'string') {
return JSON.parse(userConfigs);
} else {
return userConfigs;
}
};
export const displayVisualization = (
metaData: SavedVisualizationType | undefined,
data: ExplorerData | undefined,
type: string
) => {
if (metaData === undefined || isEmpty(metaData)) {
return <></>;
}
metaData.userConfigs = parseMetadataUserConfig(metaData.userConfigs);
// And refactoring all the redundant spreads:
const dataConfig = metaData.userConfigs?.dataConfig || {};
// ...
} And it seems to work to clear out most type errors, but I'm also missing context on what the prometheus flow should look like to begin with. Will see if I can find someone who knows it better. |
More prometheus issues:
Looks like this is a testing blindspot. Assigning this to myself and @RyanL1997 for these issues and improving our testing. |
There is a bug for this created with all the details opensearch-project/sql#2541 |
Signed-off-by: YANGDB <[email protected]>
Signed-off-by: YANGDB <[email protected]>
* Add 2.14 release notes Signed-off-by: Simeon Widdis <[email protected]> * fix issue #1665 (#1757) Signed-off-by: YANGDB <[email protected]> * Revert "Add 2.14 release notes" This reverts commit 42ac9c4. Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]> Signed-off-by: YANGDB <[email protected]> Co-authored-by: YANGDB <[email protected]>
* Add 2.14 release notes Signed-off-by: Simeon Widdis <[email protected]> * fix issue #1665 (#1757) Signed-off-by: YANGDB <[email protected]> * Revert "Add 2.14 release notes" This reverts commit 42ac9c4. Signed-off-by: Simeon Widdis <[email protected]> --------- Signed-off-by: Simeon Widdis <[email protected]> Signed-off-by: YANGDB <[email protected]> Co-authored-by: YANGDB <[email protected]> (cherry picked from commit f9a6e49) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* Add 2.14 release notes * fix issue #1665 (#1757) * Revert "Add 2.14 release notes" This reverts commit 42ac9c4. --------- (cherry picked from commit f9a6e49) Signed-off-by: Simeon Widdis <[email protected]> Signed-off-by: YANGDB <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: YANGDB <[email protected]> Co-authored-by: Simeon Widdis <[email protected]>
Completed by #1757 and ready to go for 2.14 |
What is the bug?
A clear and concise description of the bug.
I added Prometheus as a data source. But when I go to
/app/observability-metrics
I see a quick flash of the metrics in the sidebar and then the content goes blank with a JS error in the console:I put a breakpoint in
displayVisualization (observabilityDashboards.plugin.js:1633:114610)
And I can see that
metaData.userConfigs
is a JavaScript object and not a string.If I remove the
JSON.parse
in my Chrome devtools I can see the metrics in the sidebar. When I click a metric it goes blank again because my Chrome devtools is not making the change persistent. Not sure how to do that.From source:
dashboards-observability/public/components/custom_panels/helpers/utils.tsx
Line 714 in 2d16727
An easy fix would be to check if it's already an object. But not sure why the expected value is string.
How can one reproduce the bug?
Query Data
What is the expected behavior?
It should show the metrics
What is your host/environment?
Do you have any additional context?
I'm getting metrics from:
The text was updated successfully, but these errors were encountered: