ohanke / game_shop

1 stars 0 forks source link

32. Integrate visualization tool for monitoring #154

Closed sergey-morenets closed 2 years ago

michaltworuszka commented 2 years ago

@sergey-morenets I have some issues with this. Look simple to add it to project. But added all like You on lecture and after starting all microservices. All modules are working but those which supposed to connect to Graphite giving me warning (below) and whatever I find in Web and try don't help. FYI - graphite is working - can go to localhost:80 and see it. Grafana also working and can connet to graphite Please HELP!!

Warning: WARN [users,,] 1 --- [rter-1-thread-1] c.c.metrics.graphite.GraphiteReporter : Unable to report to Graphite

java.net.ConnectException: Connection refused at java.base/sun.nio.ch.Net.connect0(Native Method) ~[na:na] at java.base/sun.nio.ch.Net.connect(Net.java:579) ~[na:na] at java.base/sun.nio.ch.Net.connect(Net.java:568) ~[na:na] at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:585) ~[na:na] at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[na:na] at java.base/java.net.Socket.connect(Socket.java:633) ~[na:na] at java.base/java.net.Socket.connect(Socket.java:583) ~[na:na] at java.base/java.net.Socket.(Socket.java:507) ~[na:na] at java.base/java.net.Socket.(Socket.java:319) ~[na:na] at java.base/javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:277) ~[na:na] at com.codahale.metrics.graphite.PickledGraphite.connect(PickledGraphite.java:185) ~[metrics-graphite-4.2.10.jar!/:4.2.10] at com.codahale.metrics.graphite.GraphiteReporter.report(GraphiteReporter.java:374) ~[metrics-graphite-4.2.10.jar!/:4.2.10] at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:253) ~[metrics-core-4.2.10.jar!/:4.2.10] at com.codahale.metrics.ScheduledReporter.lambda$start$0(ScheduledReporter.java:182) ~[metrics-core-4.2.10.jar!/:4.2.10] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na] at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na] at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]

POM files

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">

game_shop org.springframework.boot 0.0.1-SNAPSHOT
<modelVersion>4.0.0</modelVersion>

<artifactId>game_shop-users</artifactId>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>game_shop-user-client</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>42.4.0</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.modelmapper</groupId>
        <artifactId>modelmapper</artifactId>
        <version>3.1.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.kafka</groupId>
        <artifactId>spring-kafka</artifactId>
        <version>2.8.7</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
        <version>2.1.3</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>io.micrometer</groupId>
        <artifactId>micrometer-registry-graphite</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-config</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-bootstrap</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.retry</groupId>
        <artifactId>spring-retry</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-sleuth</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-sleuth-zipkin</artifactId>
    </dependency>
</dependencies>

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

docker-compose ( https://github.com/ohanke/game_shop/blob/master/docker-compose.yml ):

version: '3.8' services:

graphite: image: graphiteapp/graphite-statsd container_name: graphite ports:

networks: postgres: driver: bridge spring: driver: bridge

volumes: postgres: pgadmin: graphite:

sergey-morenets commented 2 years ago

Hi

Did you run your microservices by Docker Compose ?

michaltworuszka commented 2 years ago

Yes. docker-compose build and then docker-compose up -d

At this point I run them only by Docker Compose

sergey-morenets commented 2 years ago

So then you need to specify Graphite host in the microservice settings because by default it tries to connect to localhost.

michaltworuszka commented 2 years ago

Yes I'm sure of that but I couldn't find any information about how and where - how I can set that host (syntax) and how to connect to it in docker Compose. I only found info that i need to do that but without any example

sergey-morenets commented 2 years ago

Please, review the documentation: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator