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

no grafana panel show in Overview tab #862

Closed
GoneLikeAir opened this issue Sep 11, 2023 · 6 comments
Closed

no grafana panel show in Overview tab #862

GoneLikeAir opened this issue Sep 11, 2023 · 6 comments
Labels
kind/bug Something isn't working

Comments

@GoneLikeAir
Copy link
Contributor

GoneLikeAir commented Sep 11, 2023

Describe the bug
集群总览页面无法展示grafana图表,从后端请求来看,是能拿到数据的
image

Environment (please complete the following information):

  • K8S Version: [e.g. 1.20]
    1.20
  • Crane Version: [e.g. 0.10.0]
    0.10.0
  • Browser [e.g. chrome, safari]
    chrome
@GoneLikeAir GoneLikeAir added the kind/bug Something isn't working label Sep 11, 2023
@qmhu
Copy link
Member

qmhu commented Sep 13, 2023

@GoneLikeAir
Copy link
Contributor Author

看起来并不是内嵌的问题,在访问集群总量标签那时,我使用返回的url通过nginx代理访问grafana是正常的
image
image

@GoneLikeAir
Copy link
Contributor Author

is there any update for this issue?

@qmhu
Copy link
Member

qmhu commented Sep 22, 2023

is there any update for this issue?

@zsnmwy any thought about it ?

@zsnmwy
Copy link
Member

zsnmwy commented Sep 25, 2023

麻烦留意一下这个前端的这个接口

/grafana/api/dashboards/uid/cluster-overview
image

这边在遍历渲染iframe嵌入的时候,是根据上面的API接口进行判断的。(如果我没记错的话 =.=)

const baselineHeight = useSelector((state) => state.config.chartBaselineHeight);
const defaultHeight = useSelector((state) => state.config.chartDefaultHeight);
const selectedNamespace = useSelector((state) => state.insight.selectedNamespace);
// if it is using current cluster, use crane url from env
const craneUrl = useCraneUrl();
const isValidPanel = useIsValidPanel({ panel });
const isNeedSelectNamespace = useIsNeedSelectNamespace({ selectedDashboard });
const queryStr = useGrafanaQueryStr({ panelId: panel.id, selectedDashboard });
const span = panel?.gridPos?.w > 0 && panel?.gridPos?.w <= 24 ? Math.floor(panel.gridPos.w / 2) : 6;
const minHeight = panel?.gridPos?.h ? Math.max(panel.gridPos.h * baselineHeight, defaultHeight) : defaultHeight;
return (isNeedSelectNamespace && !selectedNamespace) || !isValidPanel ? null : (
<Col key={panel.id} span={span}>
<Card style={{ marginBottom: '0.5rem', marginTop: '0.5rem', height: minHeight }}>
<iframe
frameBorder='0'
height='100%'
src={`${craneUrl}/grafana/d-solo/${selectedDashboard?.uid}/costs-by-dimension?${queryStr}`}
width='100%'
/>
</Card>
</Col>
);

iframe 实际嵌入地址示例

/grafana/d-solo/cluster-overview/costs-by-dimension?from=1695572439000&orgId=1&panelId=136&theme=light&to=1695658839000&var-Discount=100

在接口正常和Grafana版本正常的情况下,是可以正常渲染出iframe的板块。

image

麻烦留意下接口以及对应的Grafana版本。因为高版本的Grafana是有兼容性问题的。

我刚刚也是更新了文档,锁定了Grafana版本。你可以留意下对应的PR #865

@GoneLikeAir
Copy link
Contributor Author

麻烦留意一下这个前端的这个接口

/grafana/api/dashboards/uid/cluster-overview
image 这边在遍历渲染iframe嵌入的时候,是根据上面的API接口进行判断的。(如果我没记错的话 =.=)

const baselineHeight = useSelector((state) => state.config.chartBaselineHeight);
const defaultHeight = useSelector((state) => state.config.chartDefaultHeight);
const selectedNamespace = useSelector((state) => state.insight.selectedNamespace);
// if it is using current cluster, use crane url from env
const craneUrl = useCraneUrl();
const isValidPanel = useIsValidPanel({ panel });
const isNeedSelectNamespace = useIsNeedSelectNamespace({ selectedDashboard });
const queryStr = useGrafanaQueryStr({ panelId: panel.id, selectedDashboard });
const span = panel?.gridPos?.w > 0 && panel?.gridPos?.w <= 24 ? Math.floor(panel.gridPos.w / 2) : 6;
const minHeight = panel?.gridPos?.h ? Math.max(panel.gridPos.h * baselineHeight, defaultHeight) : defaultHeight;
return (isNeedSelectNamespace && !selectedNamespace) || !isValidPanel ? null : (
<Col key={panel.id} span={span}>
<Card style={{ marginBottom: '0.5rem', marginTop: '0.5rem', height: minHeight }}>
<iframe
frameBorder='0'
height='100%'
src={`${craneUrl}/grafana/d-solo/${selectedDashboard?.uid}/costs-by-dimension?${queryStr}`}
width='100%'
/>
</Card>
</Col>
);

iframe 实际嵌入地址示例

/grafana/d-solo/cluster-overview/costs-by-dimension?from=1695572439000&orgId=1&panelId=136&theme=light&to=1695658839000&var-Discount=100

在接口正常和Grafana版本正常的情况下,是可以正常渲染出iframe的板块。

image 麻烦留意下接口以及对应的Grafana版本。因为高版本的Grafana是有兼容性问题的。

我刚刚也是更新了文档,锁定了Grafana版本。你可以留意下对应的PR #865

多谢,我知道啥原因了,我升级了crane的版本,但是没有把最新的dashboard配置好。。谢谢谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants