【问题标题】:Grafana integration with springboot and postgresGrafana 与 springboot 和 postgres 的集成
【发布时间】:2021-08-31 05:17:41
【问题描述】:

我正在尝试使用 Grafana 进行可视化。我有一个与 PostgreSQL 集成的 Spring-boot 应用程序。我想从 Postgres 中获取数据并在 Grafana 中显示。

到目前为止,我已经找到了 maven 对 grafana 的依赖,如下所示:

    <!-- https://mvnrepository.com/artifact/com.appnexus.grafana-client/grafana-api-java-client -->
<dependency>
    <groupId>com.appnexus.grafana-client</groupId>
    <artifactId>grafana-api-java-client</artifactId>
    <version>1.0.5</version>
</dependency>
     

任何人都可以帮助提供教程示例吗?

【问题讨论】:

    标签: postgresql spring-boot grafana


    【解决方案1】:

    如果您只想在 grafana 上可视化 PostgreSQL 数据库指标,那么您可以使用 plugin

    但是,如果您想查看 Spring Boot 相关的指标(http 响应状态、性能、jvm 统计信息、连接池统计信息等),那么更流行的方法是将 Prometheus 设置为时间序列数据存储和指标抓取工具,其中 graphana可以生成可视化。有关每个组件设置的详细信息,您可以参考thisthis 文章。 甚至还有现成的用于 Spring Boot 的 grafana 仪表板,例如 this。当然,这也使用了 Prometheus。

    【讨论】:

    • 非常感谢您的回复。我想通过所有教程,有没有一种方法可以从我的 Spring Boot 代码中调用 grafana,并且应该显示图表。
    • Graphana 拉取信息,但不会推送到 Graphana。您在 pom.xml 中包含的库可帮助您以编程方式调用 Graphana(而不是 Web ui)来执行管理工作,例如创建 graphana 用户、数据源、仪表板等,但无助于实际发送任何指标。让 graphana 显示您的 Spring Boot 统计信息的正确方法已在共享文章中进行了说明。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-31
    • 1970-01-01
    • 2019-07-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多