Bird
0
0

You want to track the number of active users in your app using Micrometer. Which metric type and approach is best?

hard📝 Conceptual Q8 of 15
Spring Boot - Actuator
You want to track the number of active users in your app using Micrometer. Which metric type and approach is best?
AUse a Gauge with a supplier returning current active user count
BUse a Counter incremented on each user login
CUse a Timer to measure login durations
DUse a DistributionSummary to record user ages
Step-by-Step Solution
Solution:
  1. Step 1: Identify metric type for current value tracking

    Gauge is suitable for tracking current values that can go up or down.
  2. Step 2: Match use case to metric type

    Active users count changes dynamically, so Gauge with a supplier is best.
  3. Final Answer:

    Use a Gauge with a supplier returning current active user count -> Option A
  4. Quick Check:

    Current state tracking = Gauge [OK]
Quick Trick: Gauge tracks current values, Counter only increments [OK]
Common Mistakes:
  • Using Counter which only increments, not decrements
  • Confusing Timer or DistributionSummary for counts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes