本文介绍了Spring Cloud Data Flow Grafana Prometheus未显示流数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此网站上使用docker-compose启动Spring云数据流.

问题1:流的状态始终为正在部署".不应该部署它吗?

问题2:

当我单击"Grafana"图标时,它会启动Grafana页面,但上面没有数据.为什么会这样呢?我将kafka用作消息传递中间件,如下所示.

 < dependency>< groupId> org.springframework.cloud</groupId>< artifactId> spring-cloud-stream-binder-kafka</artifactId></dependency> 

这是我的pom.xml

 <?xml version ="1.0" encoding ="UTF-8"?>< project xmlns ="http://maven.apache.org/POM/4.0.0" xmlns:xsi ="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation ="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">< modelVersion> 4.0.0</modelVersion>< parent>< groupId> org.springframework.boot</groupId>< artifactId> spring-boot-starter-parent</artifactId>< version> 2.1.7.RELEASE</version>< relativePath/><!-从存储库中查找父级-></parent>< groupId> org.dso.info.io</groupId>< artifactId>使用细节发送者卡夫卡</artifactId>< version> 0.0.1-SNAPSHOT</version><名称>使用细节发送者卡夫卡</名称>< description> Spring Boot的演示项目</description><属性>< java.version> 1.8</java.version>< spring-cloud.version>格林尼治.SR2</spring-cloud.version><普罗米修斯·索克斯弹簧.version> 0.8.0</普罗米修斯·索克斯弹簧.version></properties><依赖关系><依赖关系>< groupId> org.springframework.boot</groupId>< artifactId> spring-boot-starter-actuator</artifactId></dependency><依赖关系>< groupId> org.springframework.cloud</groupId>< artifactId> spring-cloud-stream</artifactId></dependency><依赖关系>< groupId> org.springframework.cloud</groupId>< artifactId> spring-cloud-stream-binder-kafka</artifactId></dependency><依赖关系>< groupId> org.springframework.boot</groupId>< artifactId> spring-boot-starter-test</artifactId>< scope> test</scope></dependency><依赖关系>< groupId> org.springframework.cloud</groupId>< artifactId> spring-cloud-stream-test-support</artifactId>< scope> test</scope></dependency><!-普罗米修斯-火箭监控-><依赖关系>< groupId> org.springframework.cloud.stream.app</groupId>< artifactId> app-starters-micrometer-common</artifactId>< version> 2.1.1.RELEASE</version></dependency><依赖关系>< groupId> io.micrometer</groupId>< artifactId>千分尺普罗米修斯< artifactId></dependency><依赖关系>< groupId> io.micrometer.prometheus</groupId>< artifactId>普罗米修斯·索克·斯普林斯</artifactId>< version> $ {prometheus-rsocket-spring.version}</version></dependency><依赖关系>< groupId> io.micrometer.prometheus</groupId>< artifactId> prometheus-rocket-client</artifactId>< version> $ {prometheus-rsocket-spring.version}</version></dependency><依赖关系>< groupId> org.springframework.cloud</groupId>< artifactId> spring-cloud-cloudfoundry-connector</artifactId></dependency></dependencies>< dependencyManagement><依赖关系><依赖关系>< groupId> org.springframework.cloud</groupId>< artifactId> spring-cloud-dependencies</artifactId>< version> $ {spring-cloud.version}</version>< type> pom</type>< scope> import</scope></dependency></dependencies></dependencyManagement><存储库><存储库>< snapshots>< enabled> true</enabled></snapshots>< id> spring-snapshots</id>< name>春季快照</name>< url> https://repo.spring.io/snapshot</url></存储库></存储库>< build>< plugins>< plugin>< groupId> org.springframework.boot</groupId>< artifactId> spring-boot-maven-plugin</artifactId></plugin></plugins></build></project> 
解决方案

我解决了这个问题,在属性中添加了一些依赖项和一些条目.

pom.xml:

 < dependency>< groupId> org.springframework.boot</groupId>< artifactId> spring-boot-starter-web</artifactId></dependency><依赖关系>< groupId> org.springframework.boot</groupId>< artifactId> spring-boot-starter-webflux</artifactId></dependency><依赖关系>< groupId> org.springframework.boot</groupId>< artifactId> spring-boot-starter-actuator</artifactId></dependency><依赖关系>< groupId> org.springframework.cloud.stream.app</groupId>< artifactId> app-starters-micrometer-common</artifactId>< version> 2.1.2.RELEASE</version></dependency><依赖关系>< groupId> io.micrometer</groupId>< artifactId>千分尺普罗米修斯< artifactId></dependency><依赖关系>< groupId> io.micrometer.prometheus</groupId>< artifactId>普罗米修斯·索克·斯普林斯</artifactId>< version> 0.9.0</version></dependency> 

application.properties:

  spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.enabled = truespring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.rsocket.enabled = truespring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.rsocket.host = prometheus-rsocket-proxyspring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.rsocket.port = 7001spring.cloud.dataflow.applicationProperties.stream.management.endpoint.health.show-details = alwaysspring.cloud.dataflow.applicationProperties.stream.management.endpoint.health.show-components = alwaysspring.cloud.dataflow.applicationProperties.stream.management.endpoints.jmx.exposure.include = *spring.cloud.dataflow.applicationProperties.stream.management.endpoints.web.exposure.include = * 

I launch Spring cloud data flow with docker-compose base on this website.

https://dataflow.spring.io/docs/installation/local/docker/

I created 3 apps, Source, Processor & Sink.

I ran

export STREAM_APPS_URI=https://dataflow.spring.io/Einstein-BUILD-SNAPSHOT-stream-applications-kafka-maven

When I run docker-compose -f ./docker-compose.yml -f ./docker-compose-prometheus.yml up, all my containers start up as specified in the docker-compose.yml and docker-compose-prometheus.yml.

I proceed to register the 3 applications and then create a stream with them.I then run it.

Question 1:The status of the stream is always "Deploying". Shouldn't it be Deployed?

Question 2:

When I click on the "Grafana" icon, it launches the Grafana page but there is no data on it. Why is it so? I am using kafka as my messaging middleware as shown below.

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-stream-binder-kafka</artifactId>
</dependency>

This is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.7.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>org.dso.info.io</groupId>
    <artifactId>usage-detail-sender-kafka</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>usage-detail-sender-kafka</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.SR2</spring-cloud.version>
        <prometheus-rsocket-spring.version>0.8.0</prometheus-rsocket-spring.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-binder-kafka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-stream-test-support</artifactId>
            <scope>test</scope>
        </dependency>
        <!-- prometheus-rsocket monitoring -->
        <dependency>
            <groupId>org.springframework.cloud.stream.app</groupId>
            <artifactId>app-starters-micrometer-common</artifactId>
            <version>2.1.1.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
        <dependency>
            <groupId>io.micrometer.prometheus</groupId>
            <artifactId>prometheus-rsocket-spring</artifactId>
            <version>${prometheus-rsocket-spring.version}</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer.prometheus</groupId>
            <artifactId>prometheus-rsocket-client</artifactId>
            <version>${prometheus-rsocket-spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-cloudfoundry-connector</artifactId>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <repositories>
        <repository>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <id>spring-snapshots</id>
            <name>Spring Snapshots</name>
            <url>https://repo.spring.io/snapshot</url>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>
解决方案

I solved this issue adding some dependencies and some entries on properties.

pom.xml:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud.stream.app</groupId>
            <artifactId>app-starters-micrometer-common</artifactId>
            <version>2.1.2.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-prometheus</artifactId>
        </dependency>
        <dependency>
            <groupId>io.micrometer.prometheus</groupId>
            <artifactId>prometheus-rsocket-spring</artifactId>
            <version>0.9.0</version>
        </dependency>

application.properties:

spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.enabled=true
spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.rsocket.enabled=true
spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.rsocket.host=prometheus-rsocket-proxy
spring.cloud.dataflow.applicationProperties.stream.management.metrics.export.prometheus.rsocket.port=7001
spring.cloud.dataflow.applicationProperties.stream.management.endpoint.health.show-details=always
spring.cloud.dataflow.applicationProperties.stream.management.endpoint.health.show-components=always
spring.cloud.dataflow.applicationProperties.stream.management.endpoints.jmx.exposure.include=*
spring.cloud.dataflow.applicationProperties.stream.management.endpoints.web.exposure.include=*

这篇关于Spring Cloud Data Flow Grafana Prometheus未显示流数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 00:23