Recent Tutorials and Articles
    Changing Spring Boot Metrics Publishing Frequency
    Published on: 2019-01-25 05:01:31
    Posted By: Amit Kumar

    This article explains how to change publishing frequency of Spring Boot Actuator Metrics through Micrometer

    Abstract


    Spring Boot 2.x.x Actuator integration with Micrometer allows metrics data to be exported to various stores through the use of micrometer-registry-xxx dependencies where xxx represents the name of system such as elastic, prometheus, influx etc.

    However Spring Boot exports the metrics every 1m by default. In this article, we will talk about property to change metrics publishing frequency.

     

    Changing Spring Boot Actuator Metrics Publish Frequency to Datastores


    You can simply change the metrics publishing frequency using property - management.metrics.export.elastic.step as shown below -

    # Sets the frequency to 30 seconds
    management.metrics.export.elastic.step=30s
    
    # Sets the frequency to 5 minutes
    management.metrics.export.elastic.step=5m
    
    # Sets the frequency to 1 day
    management.metrics.export.elastic.step=1d
    
    # Sets the frequency to 1 week
    management.metrics.export.elastic.step=1w
    
    # Sets the frequency to 1 Month
    management.metrics.export.elastic.step=1M
    
    # Sets the frequency to 1 Year
    management.metrics.export.elastic.step=1y

     

    Once changes are made, you can verify that frequency has been updated by looking at your application startup logs for following line -

    2019-01-25 14:58:58.517  INFO 11092---[           main] i.m.elastic.ElasticMeterRegistry        : publishing metrics to elastic every 30s

     

    Thank you for reading through the tutorial. In case of any feedback/questions/concerns, you can communicate same to us through your comments and we shall get back to you as soon as possible.

    Posted By: Amit Kumar
    Published on: 2019-01-25 05:01:31

    Comment Form is loading comments...