Skip to content

Instantly share code, notes, and snippets.

@m0mus
Last active September 9, 2018 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0mus/6da8654dafe0dc32147bb4e9a7e8c3b5 to your computer and use it in GitHub Desktop.
Save m0mus/6da8654dafe0dc32147bb4e9a7e8c3b5 to your computer and use it in GitHub Desktop.
Helidon Takes Flight #2
// create metric registry
MetricsSupport metricsSupport = MetricsSupport.create();
// get the registry
MetricRegistry registry = RegistryFactory
.getRegistryFactory()
.get()
.getRegistry(MetricRegistry.Type.APPLICATION);
// create a counter
Counter helloCounter = registry.counter("helloCounter");
Routing routing = Routing.builder()
// register metric support with web server
.register(metricsSupport)
.get("/hello", (req, res) -> {
// increase counter
helloCounter.inc();
res.send("Hello World");
})
.build();
WebServer.create(routing)
.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment