How to get metrics of outgoing http calls in Spring Boot?










0















My Spring Boot application calls other providers and I'd like to measure the time a response takes, but also would nice to measure other stuff. Is there a clean way of doing this maybe some library or package?



I'd need something which integrates seamlessly with existing apps, and I do not need to wrap the calls with System.getCurrentTimeMillis() etc.










share|improve this question


























    0















    My Spring Boot application calls other providers and I'd like to measure the time a response takes, but also would nice to measure other stuff. Is there a clean way of doing this maybe some library or package?



    I'd need something which integrates seamlessly with existing apps, and I do not need to wrap the calls with System.getCurrentTimeMillis() etc.










    share|improve this question
























      0












      0








      0








      My Spring Boot application calls other providers and I'd like to measure the time a response takes, but also would nice to measure other stuff. Is there a clean way of doing this maybe some library or package?



      I'd need something which integrates seamlessly with existing apps, and I do not need to wrap the calls with System.getCurrentTimeMillis() etc.










      share|improve this question














      My Spring Boot application calls other providers and I'd like to measure the time a response takes, but also would nice to measure other stuff. Is there a clean way of doing this maybe some library or package?



      I'd need something which integrates seamlessly with existing apps, and I do not need to wrap the calls with System.getCurrentTimeMillis() etc.







      java spring metrics






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Oct 2 '18 at 15:03









      godzsagodzsa

      8541231




      8541231






















          2 Answers
          2






          active

          oldest

          votes


















          1














          You can use Spring Actuator,Prometheus Server/Client and Grafana Server to monitoring your application. There are 4 types of metrics available in Prometheus, you can use according to your requirements.



          Prometheus Documentation



          https://prometheus.io/



          Grafana Documentation



          http://docs.grafana.org/



          Install Prometheus and Grafana servers.



          You have to add the dependencies for Prometheus Client. Also Spring Actuator dependency need to add.



          <dependency>
          <groupId>io.prometheus</groupId>
          <artifactId>simpleclient_spring_boot</artifactId>
          <version>0.0.26</version>
          </dependency>
          <dependency>
          <groupId>io.prometheus</groupId>
          <artifactId>simpleclient_hotspot</artifactId>
          <version>0.0.26</version>
          </dependency>
          <dependency>
          <groupId>io.prometheus</groupId>
          <artifactId>simpleclient_servlet</artifactId>
          <version>0.0.26</version>
          </dependency>


          In Configuration file you have to define bean for metrics.



          @Bean
          public ServletRegistrationBean servletRegistrationBean()
          DefaultExports.initialize();
          return new ServletRegistrationBean(new MetricsServlet(), "/prometheus");



          You can follow https://g00glen00b.be/monitoring-spring-prometheus-grafana/ for more detail.






          share|improve this answer























          • But with this I can measure the incoming calls e.g. calls my server get right? But for example I have a client and want to measure on the client the response time of a server (which I do not own)

            – godzsa
            Oct 3 '18 at 9:21












          • You can define histogram for request and response time.

            – Gaurav Srivastav
            Oct 3 '18 at 14:30


















          0














          Prometheus can monitor some metrics in the jvm.



          But you may want to see the javamelody spring-boot-starter which will give metrics on the jvm and on the application and also on @Service Spring components and on RestTemplate when defined as bean to measure calls to some other providers.






          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52611132%2fhow-to-get-metrics-of-outgoing-http-calls-in-spring-boot%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            You can use Spring Actuator,Prometheus Server/Client and Grafana Server to monitoring your application. There are 4 types of metrics available in Prometheus, you can use according to your requirements.



            Prometheus Documentation



            https://prometheus.io/



            Grafana Documentation



            http://docs.grafana.org/



            Install Prometheus and Grafana servers.



            You have to add the dependencies for Prometheus Client. Also Spring Actuator dependency need to add.



            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_spring_boot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_hotspot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_servlet</artifactId>
            <version>0.0.26</version>
            </dependency>


            In Configuration file you have to define bean for metrics.



            @Bean
            public ServletRegistrationBean servletRegistrationBean()
            DefaultExports.initialize();
            return new ServletRegistrationBean(new MetricsServlet(), "/prometheus");



            You can follow https://g00glen00b.be/monitoring-spring-prometheus-grafana/ for more detail.






            share|improve this answer























            • But with this I can measure the incoming calls e.g. calls my server get right? But for example I have a client and want to measure on the client the response time of a server (which I do not own)

              – godzsa
              Oct 3 '18 at 9:21












            • You can define histogram for request and response time.

              – Gaurav Srivastav
              Oct 3 '18 at 14:30















            1














            You can use Spring Actuator,Prometheus Server/Client and Grafana Server to monitoring your application. There are 4 types of metrics available in Prometheus, you can use according to your requirements.



            Prometheus Documentation



            https://prometheus.io/



            Grafana Documentation



            http://docs.grafana.org/



            Install Prometheus and Grafana servers.



            You have to add the dependencies for Prometheus Client. Also Spring Actuator dependency need to add.



            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_spring_boot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_hotspot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_servlet</artifactId>
            <version>0.0.26</version>
            </dependency>


            In Configuration file you have to define bean for metrics.



            @Bean
            public ServletRegistrationBean servletRegistrationBean()
            DefaultExports.initialize();
            return new ServletRegistrationBean(new MetricsServlet(), "/prometheus");



            You can follow https://g00glen00b.be/monitoring-spring-prometheus-grafana/ for more detail.






            share|improve this answer























            • But with this I can measure the incoming calls e.g. calls my server get right? But for example I have a client and want to measure on the client the response time of a server (which I do not own)

              – godzsa
              Oct 3 '18 at 9:21












            • You can define histogram for request and response time.

              – Gaurav Srivastav
              Oct 3 '18 at 14:30













            1












            1








            1







            You can use Spring Actuator,Prometheus Server/Client and Grafana Server to monitoring your application. There are 4 types of metrics available in Prometheus, you can use according to your requirements.



            Prometheus Documentation



            https://prometheus.io/



            Grafana Documentation



            http://docs.grafana.org/



            Install Prometheus and Grafana servers.



            You have to add the dependencies for Prometheus Client. Also Spring Actuator dependency need to add.



            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_spring_boot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_hotspot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_servlet</artifactId>
            <version>0.0.26</version>
            </dependency>


            In Configuration file you have to define bean for metrics.



            @Bean
            public ServletRegistrationBean servletRegistrationBean()
            DefaultExports.initialize();
            return new ServletRegistrationBean(new MetricsServlet(), "/prometheus");



            You can follow https://g00glen00b.be/monitoring-spring-prometheus-grafana/ for more detail.






            share|improve this answer













            You can use Spring Actuator,Prometheus Server/Client and Grafana Server to monitoring your application. There are 4 types of metrics available in Prometheus, you can use according to your requirements.



            Prometheus Documentation



            https://prometheus.io/



            Grafana Documentation



            http://docs.grafana.org/



            Install Prometheus and Grafana servers.



            You have to add the dependencies for Prometheus Client. Also Spring Actuator dependency need to add.



            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_spring_boot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_hotspot</artifactId>
            <version>0.0.26</version>
            </dependency>
            <dependency>
            <groupId>io.prometheus</groupId>
            <artifactId>simpleclient_servlet</artifactId>
            <version>0.0.26</version>
            </dependency>


            In Configuration file you have to define bean for metrics.



            @Bean
            public ServletRegistrationBean servletRegistrationBean()
            DefaultExports.initialize();
            return new ServletRegistrationBean(new MetricsServlet(), "/prometheus");



            You can follow https://g00glen00b.be/monitoring-spring-prometheus-grafana/ for more detail.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Oct 2 '18 at 15:28









            Gaurav SrivastavGaurav Srivastav

            1,2941513




            1,2941513












            • But with this I can measure the incoming calls e.g. calls my server get right? But for example I have a client and want to measure on the client the response time of a server (which I do not own)

              – godzsa
              Oct 3 '18 at 9:21












            • You can define histogram for request and response time.

              – Gaurav Srivastav
              Oct 3 '18 at 14:30

















            • But with this I can measure the incoming calls e.g. calls my server get right? But for example I have a client and want to measure on the client the response time of a server (which I do not own)

              – godzsa
              Oct 3 '18 at 9:21












            • You can define histogram for request and response time.

              – Gaurav Srivastav
              Oct 3 '18 at 14:30
















            But with this I can measure the incoming calls e.g. calls my server get right? But for example I have a client and want to measure on the client the response time of a server (which I do not own)

            – godzsa
            Oct 3 '18 at 9:21






            But with this I can measure the incoming calls e.g. calls my server get right? But for example I have a client and want to measure on the client the response time of a server (which I do not own)

            – godzsa
            Oct 3 '18 at 9:21














            You can define histogram for request and response time.

            – Gaurav Srivastav
            Oct 3 '18 at 14:30





            You can define histogram for request and response time.

            – Gaurav Srivastav
            Oct 3 '18 at 14:30













            0














            Prometheus can monitor some metrics in the jvm.



            But you may want to see the javamelody spring-boot-starter which will give metrics on the jvm and on the application and also on @Service Spring components and on RestTemplate when defined as bean to measure calls to some other providers.






            share|improve this answer



























              0














              Prometheus can monitor some metrics in the jvm.



              But you may want to see the javamelody spring-boot-starter which will give metrics on the jvm and on the application and also on @Service Spring components and on RestTemplate when defined as bean to measure calls to some other providers.






              share|improve this answer

























                0












                0








                0







                Prometheus can monitor some metrics in the jvm.



                But you may want to see the javamelody spring-boot-starter which will give metrics on the jvm and on the application and also on @Service Spring components and on RestTemplate when defined as bean to measure calls to some other providers.






                share|improve this answer













                Prometheus can monitor some metrics in the jvm.



                But you may want to see the javamelody spring-boot-starter which will give metrics on the jvm and on the application and also on @Service Spring components and on RestTemplate when defined as bean to measure calls to some other providers.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 13 '18 at 0:55









                evernatevernat

                1,3141114




                1,3141114



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52611132%2fhow-to-get-metrics-of-outgoing-http-calls-in-spring-boot%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Use pre created SQLite database for Android project in kotlin

                    Darth Vader #20

                    Ondo