diff --git a/docs/mp/guides/03_config.adoc b/docs/mp/guides/03_config.adoc index e7473a5e68e..e0641c70882 100644 --- a/docs/mp/guides/03_config.adoc +++ b/docs/mp/guides/03_config.adoc @@ -84,6 +84,41 @@ system properties, environment variables, and the contents of `META-INF/micropr For example, if you specify a custom server port in `META-INF/microprofile-config.properties` then your server will listen on that port. +A main class is also required to start up the server and run the +application. If you don't use Helidon's built-in main class you can +define your own: + +[source,java] +.src/main/java/io/helidon/examples/quickstart/mp/Main.java +---- +package io.helidon.examples.quickstart.mp; + +import io.helidon.microprofile.server.Server; +import java.io.IOException; + +public final class Main { + + private Main() { } // <1> + + public static void main(final String[] args) throws IOException { + Server server = startServer(); + System.out.println("http://localhost:" + server.port() + "/greet"); + } + + static Server startServer() { + return Server.create().start(); // <2> + } + +} +---- +In this class, a `main` method is defined which starts the Helidon MP +server and prints out a message with the listen address. + +<1> Notice that +this class has an empty no-args constructor to make sure this class +cannot be instantiated. +<2> The MicroProfile server is started with the default configuration. + In your application code, Helidon uses the default configuration when you create a `Server` object without a custom `Config` object. See the following code from the project you created. diff --git a/docs/mp/guides/05_metrics.adoc b/docs/mp/guides/05_metrics.adoc index 2e369e9c190..c28bf864366 100644 --- a/docs/mp/guides/05_metrics.adoc +++ b/docs/mp/guides/05_metrics.adoc @@ -140,14 +140,6 @@ curl -H "Accept: application/json" http://localhost:8080/metrics "thread.max.count": 44 }, "vendor": { - "grpc.requests.count": 0, - "grpc.requests.meter": { - "count": 0, - "meanRate": 0.0, - "oneMinRate": 0.0, - "fiveMinRate": 0.0, - "fifteenMinRate": 0.0 - }, "requests.count": 6, "requests.meter": { "count": 6, @@ -163,26 +155,26 @@ curl -H "Accept: application/json" http://localhost:8080/metrics You can get a single metric by specifying the name in the URL path. [source,bash] -.Get the Helidon `grpc.requests.meter` metric: +.Get the Helidon `requests.meter` metric: ---- -curl -H "Accept: application/json" http://localhost:8080/metrics/vendor/grpc.requests.meter +curl -H "Accept: application/json" http://localhost:8080/metrics/vendor/requests.meter ---- [source,json] .JSON response: ---- { - "grpc.requests.meter": { - "count": 0, - "meanRate": 0.0, - "oneMinRate": 0.0, - "fiveMinRate": 0.0, - "fifteenMinRate": 0.0 + "requests.meter": { + "count": 6, + "meanRate": 0.008275992296704147, + "oneMinRate": 0.01576418632772332, + "fiveMinRate": 0.006695060022357365, + "fifteenMinRate": 0.0036382699664488415 } } ---- -NOTE: You cannot get the individual fields of a metric. For example, you cannot target http://localhost:8080/metrics/vendor/grpc.requests.meter.count. +NOTE: You cannot get the individual fields of a metric. For example, you cannot target http://localhost:8080/metrics/vendor/requests.meter.count. ==== Controlling `REST.request` metrics Helidon implements the optional family of metrics, all with the name `REST.request`, as described in the @@ -311,17 +303,6 @@ The default behavior is to decrement when exiting the method. Here is an exampl `@Counted(name = "any-card", monotonic = true)`. -[source,java] -.Update the `GreetApplication` class as follows: ----- -@Override -public Set> getClasses() { - return Set.of(GreetResource.class, GreetingCards.class); // <1> -} ----- -<1> Add the `GreetingCards` class to the set of classes managed by Helidon for this application. - - [source,bash] .Build and run the application, then invoke the application endpoints below: ----