How to do sequence of operations and ensure one operation is complete before next one in Spring Reactor web app?

前端 未结 3 1494
半阙折子戏
半阙折子戏 2021-02-05 06:45

I have Spring Boot 2 web app in which I need to identify site visitor by cookie and gather page view stats. So I need to intercept every web request. The code I had to write is

3条回答
  •  情书的邮戳
    2021-02-05 07:18

    For gathering page view stats I'll suggest to change the strategy and use Actuator and Micrometer instead:

    1. Add the actuator dependency to your project
    2. Expose the relevant endpoints (here, metrics)
    3. Go to /actuator/metrics and select the metric for server HTTP requests (see the reference documentation).

    Micrometer offers way more and helps you to get your metrics right, like: taking into account GC pauses when measuring time, providing histograms/percentiles/..., and more.

提交回复
热议问题