Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need option for actuator+dropwizard timers for short timings #8770

Closed
tdalsing-pivotal opened this issue Mar 28, 2017 · 1 comment
Closed

Comments

@tdalsing-pivotal
Copy link

When using dropwizard with spring boot actuator the timers are in milliseconds. For timings that are less than 1 ms the values are always 0 since the output is an integer and the value is truncated. Please change the output to a floating point value.

Test code:

@RestController
public class DWController {

    private MetricRegistry registry;

    @Autowired
    public DWController(MetricRegistry registry) {
        this.registry = registry;
    }

    @RequestMapping("/foo/{count}")
    public String foo(@PathVariable("count") int count) {
        Timer timer = registry.timer("fooTimer");
        Timer.Context ctx = timer.time();

        // do something that will take < 1 millisecond
        for (int i = 0; i < count; ++i) {
            double d = Math.pow(i, 10);
        }

        long t = ctx.stop();
        return "" + t;
    }
}

Exercising the code:

curl http://localhost:8080/foo/10

several times results in:

{
  "mem": 362154,
  "mem.free": 279813,
  "processors": 4,
  "instance.uptime": 30543,
  "uptime": 35343,
  "systemload.average": 3.80029296875,
  "heap.committed": 314368,
  "heap.init": 262144,
  "heap.used": 34554,
  "heap": 3728384,
  "nonheap.committed": 50048,
  "nonheap.init": 2496,
  "nonheap.used": 47743,
  "nonheap": 0,
  "threads.peak": 22,
  "threads.daemon": 20,
  "threads.totalStarted": 26,
  "threads": 22,
  "classes": 5977,
  "classes.loaded": 5977,
  "classes.unloaded": 0,
  "gc.ps_scavenge.count": 6,
  "gc.ps_scavenge.time": 83,
  "gc.ps_marksweep.count": 1,
  "gc.ps_marksweep.time": 46,
  "fooTimer.snapshot.median": 0,
  "gauge.response.foo.count": 3.0,
  "fooTimer.fiveMinuteRate": 0.605644105347075,
  "fooTimer.count": 17,
  "fooTimer.snapshot.75thPercentile": 0,
  "fooTimer.snapshot.999thPercentile": 0,
  "fooTimer.snapshot.max": 0,
  "fooTimer.snapshot.98thPercentile": 0,
  "fooTimer.fifteenMinuteRate": 0.6021061761967533,
  "counter.status.200.foo.count": 17,
  "fooTimer.snapshot.95thPercentile": 0,
  "fooTimer.snapshot.99thPercentile": 0,
  "fooTimer.snapshot.stdDev": 0,
  "fooTimer.meanRate": 0.6349273410338819,
  "fooTimer.oneMinuteRate": 0.6107670725235096,
  "fooTimer.snapshot.min": 0,
  "fooTimer.snapshot.mean": 0,
  "httpsessions.max": -1,
  "httpsessions.active": 0
}
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 28, 2017
@snicoll
Copy link
Member

snicoll commented Aug 25, 2017

This has been superseded by the planned move to Micrometer-based metrics (#9970)

@snicoll snicoll closed this as completed Aug 25, 2017
@snicoll snicoll removed the status: waiting-for-triage An issue we've not yet triaged label Aug 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants