Skip to content

Commit

Permalink
Use versionless features (#269)
Browse files Browse the repository at this point in the history
* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* Update README.adoc

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

* use versionless feature

Signed-off-by: Gilbert Kwan <[email protected]>

---------

Signed-off-by: Gilbert Kwan <[email protected]>
  • Loading branch information
gkwan-ibm authored Feb 4, 2025
1 parent 5d9e4bd commit 0ca10e7
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 67 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ jobs:
canSkip: ${{ steps.Checker.outputs.canSkip }}
steps:
- name: Get files
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get tools
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: tools/
repository: openliberty/guides-common
Expand Down Expand Up @@ -45,10 +45,11 @@ jobs:
working-directory: finish

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
distribution: 'semeru'
java-version: 11
- run: unset _JAVA_OPTIONS

Expand Down
79 changes: 47 additions & 32 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2018, 2024 IBM Corporation and others.
// Copyright (c) 2018, 2025 IBM Corporation and others.
// Licensed under Creative Commons Attribution-NoDerivatives
// 4.0 International (CC BY-ND 4.0)
// https://creativecommons.org/licenses/by-nd/4.0/
Expand Down Expand Up @@ -96,34 +96,47 @@ See the following sample outputs for the `@Timed`, `@Gauge`, and `@Counted` metr

[role="no_copy"]
----
# TYPE application_inventoryProcessingTime_rate_per_second gauge
application_inventoryProcessingTime_rate_per_second{method="get"} 0.0019189661542898407
# TYPE inventoryProcessingTime_seconds_max gauge
inventoryProcessingTime_seconds_max{method="list",mp_scope="application",} 3.0375E-5
inventoryProcessingTime_seconds_max{method="get",mp_scope="application",} 0.1997325
# HELP inventoryProcessingTime_seconds Time needed to process the inventory
# TYPE inventoryProcessingTime_seconds summary
inventoryProcessingTime_seconds{method="list",mp_scope="application",quantile="0.5",} 0.0
inventoryProcessingTime_seconds{method="list",mp_scope="application",quantile="0.75",} 0.0
...
# TYPE application_inventoryProcessingTime_seconds summary
# HELP application_inventoryProcessingTime_seconds Time needed to process the inventory
application_inventoryProcessingTime_seconds_count{method="get"} 1
application_inventoryProcessingTime_seconds{method="get",quantile="0.5"} 0.127965469
inventoryProcessingTime_seconds_count{method="list",mp_scope="application",} 2.0
inventoryProcessingTime_seconds_sum{method="list",mp_scope="application",} 3.6792E-5
inventoryProcessingTime_seconds{method="get",mp_scope="application",quantile="0.5",} 0.0
inventoryProcessingTime_seconds{method="get",mp_scope="application",quantile="0.75",} 0.0
...
# TYPE application_inventoryProcessingTime_rate_per_second gauge
application_inventoryProcessingTime_rate_per_second{method="list"} 0.0038379320982686884
inventoryProcessingTime_seconds_count{method="get",mp_scope="application",} 1.0
inventoryProcessingTime_seconds_sum{method="get",mp_scope="application",} 0.1997325
...
# TYPE application_inventoryProcessingTime_seconds summary
# HELP application_inventoryProcessingTime_seconds Time needed to process the inventory
application_inventoryProcessingTime_seconds_count{method="list"} 2
application_inventoryProcessingTime_seconds{method="list",quantile="0.5"} 2.2185000000000002E-5
# HELP inventoryAddingTime_seconds_max Time needed to add system properties to the inventory
# TYPE inventoryAddingTime_seconds_max gauge
inventoryAddingTime_seconds_max{mp_scope="application",} 3.1E-5
# HELP inventoryAddingTime_seconds Time needed to add system properties to the inventory
# TYPE inventoryAddingTime_seconds summary
inventoryAddingTime_seconds{mp_scope="application",quantile="0.5",} 0.0
inventoryAddingTime_seconds{mp_scope="application",quantile="0.75",} 0.0
...
inventoryAddingTime_seconds_count{mp_scope="application",} 1.0
inventoryAddingTime_seconds_sum{mp_scope="application",} 3.1E-5
...
----

[role="no_copy"]
----
# TYPE application_inventorySizeGauge gauge
# HELP application_inventorySizeGauge Number of systems in the inventory
application_inventorySizeGauge 1
# HELP inventorySizeGauge Number of systems in the inventory
# TYPE inventorySizeGauge gauge
inventorySizeGauge{mp_scope="application",} 1.0
----

[role="no_copy"]
----
# TYPE application_inventoryAccessCount_total counter
# HELP application_inventoryAccessCount_total Number of times the list of systems method is requested
application_inventoryAccessCount_total 1
# HELP inventoryAccessCount_total Number of times the list of systems method is requested
# TYPE inventoryAccessCount_total counter
inventoryAccessCount_total{mp_scope="application",} 2.0
----

// static guide instructions:
Expand All @@ -143,15 +156,15 @@ See the following sample output:

[role="no_copy"]
----
# TYPE base_jvm_uptime_seconds gauge
# HELP base_jvm_uptime_seconds Displays the start time of the Java virtual machine in milliseconds. This attribute displays the approximate time when the Java virtual machine started.
base_jvm_uptime_seconds 30.342000000000002
# HELP jvm_uptime_seconds Displays the time from the start of the Java virtual machine in seconds.
# TYPE jvm_uptime_seconds gauge
jvm_uptime_seconds{mp_scope="base",} 730.705
----
[role="no_copy"]
----
# TYPE base_classloader_loadedClasses_count gauge
# HELP base_classloader_loadedClasses_count Displays the number of classes that are currently loaded in the Java virtual machine.
base_classloader_loadedClasses_count 11231
# HELP classloader_loadedClasses_count Displays the number of classes that are currently loaded in the Java virtual machine.
# TYPE classloader_loadedClasses_count gauge
classloader_loadedClasses_count{mp_scope="base",} 13033.0
----

// static guide instructions:
Expand All @@ -171,15 +184,17 @@ See the following sample output:

[role="no_copy"]
----
# TYPE vendor_threadpool_size gauge
# HELP vendor_threadpool_size The size of the thread pool.
vendor_threadpool_size{pool="Default_Executor"} 32
# HELP threadpool_size The size of the thread pool.
# TYPE threadpool_size gauge
threadpool_size{mp_scope="vendor",pool="Default_Executor",} 24.0
----
[role="no_copy"]
----
# TYPE vendor_servlet_request_total counter
# HELP vendor_servlet_request_total The number of visits to this servlet from the start of the server.
vendor_servlet_request_total{servlet="microprofile_metrics_io_openliberty_guides_inventory_InventoryApplication"} 1
# HELP servlet_request_total The number of visits to this servlet ... the start of the server.
# TYPE servlet_request_total counter
servlet_request_total{mp_scope="vendor",servlet="guide_microprofile_metrics_io_openliberty_guides_system_SystemApplication",} 1.0
servlet_request_total{mp_scope="vendor",servlet="guide_microprofile_metrics_io_openliberty_guides_inventory_InventoryApplication",} 3.0
servlet_request_total{mp_scope="vendor",servlet="io_openliberty_microprofile_metrics_5_0_private_internal_PrivateMetricsRESTProxyServlet",} 3.0
----

include::{common-includes}/twyb-end.adoc[]
Expand Down Expand Up @@ -277,7 +292,7 @@ Apply the [hotspot=gaugeForGetTotal]`@Gauge` annotation to the [hotspot=getTotal
|===

Additional information about these annotations, relevant metadata fields, and more are available at
the https://openliberty.io/docs/latest/reference/javadoc/microprofile-6.1-javadoc.html?class=org/eclipse/microprofile/metrics/annotation/package-summary.html&package=allclasses-frame.html[MicroProfile Metrics Annotation Javadoc^].
the https://openliberty.io/docs/latest/reference/javadoc/microprofile-6.1-javadoc.html?class=org/eclipse/microprofile/metrics/annotation/package-summary.html&package=allclasses-frame.html&path=microprofile-6.1-javadoc/org/eclipse/microprofile/metrics/annotation/package-summary.html[MicroProfile Metrics Annotation Javadoc^].


== Enabling vendor metrics for the microservices
Expand Down
2 changes: 1 addition & 1 deletion finish/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!-- tag::microprofile[] -->
<artifactId>microprofile</artifactId>
<!-- end::microprofile[] -->
<version>6.1</version>
<version>7.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
Expand Down
16 changes: 9 additions & 7 deletions finish/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<server description="Sample Liberty server">

<featureManager>
<feature>restfulWS-3.1</feature>
<feature>jsonp-2.1</feature>
<feature>jsonb-3.0</feature>
<feature>cdi-4.0</feature>
<feature>mpConfig-3.1</feature>
<feature>mpMetrics-5.1</feature>
<feature>mpRestClient-3.0</feature>
<platform>jakartaee-10.0</platform>
<platform>microprofile-7.0</platform>
<feature>restfulWS</feature>
<feature>jsonp</feature>
<feature>jsonb</feature>
<feature>cdi</feature>
<feature>mpConfig</feature>
<feature>mpMetrics</feature>
<feature>mpRestClient</feature>
</featureManager>

<variable name="http.port" defaultValue="9080"/>
Expand Down
16 changes: 8 additions & 8 deletions finish/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ <h2>Eclipse MicroProfile</h2>
<p>
For more information about the features used in this application, see the Open Liberty documentation:
<ul>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.1.html">MicroProfile 6.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS-3.1.html">Jakarta RESTful Web Services 3.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp-2.1.html">Jakarta JSON Processing 2.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html">Jakarta JSON Binding 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#cdi-4.0.html">Jakarta Contexts and Dependency Injection 4.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpMetrics-5.1.html">MicroProfile Metrics 5.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpRestClient-3.0.html">MicroProfile Rest Client 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Binding 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile.html">MicroProfile</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS.html">Jakarta RESTful Web Services</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp.html">Jakarta JSON Processing</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb.html">Jakarta JSON Binding</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#cdi.html">Jakarta Contexts and Dependency Injection</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpMetrics.html">MicroProfile Metrics</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpRestClient.html">MicroProfile Rest Client</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Binding</a></li>
</ul>
</p>
</div>
Expand Down
2 changes: 1 addition & 1 deletion start/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<!-- tag::microprofile[] -->
<artifactId>microprofile</artifactId>
<!-- end::microprofile[] -->
<version>6.1</version>
<version>7.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
Expand Down
14 changes: 8 additions & 6 deletions start/src/main/liberty/config/server.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<server description="Sample Liberty server">

<featureManager>
<feature>restfulWS-3.1</feature>
<feature>jsonp-2.1</feature>
<feature>jsonb-3.0</feature>
<feature>cdi-4.0</feature>
<feature>mpConfig-3.1</feature>
<feature>mpRestClient-3.0</feature>
<platform>jakartaee-10.0</platform>
<platform>microprofile-7.0</platform>
<feature>restfulWS</feature>
<feature>jsonp</feature>
<feature>jsonb</feature>
<feature>cdi</feature>
<feature>mpConfig</feature>
<feature>mpRestClient</feature>
</featureManager>

<variable name="http.port" defaultValue="9080"/>
Expand Down
16 changes: 8 additions & 8 deletions start/src/main/webapp/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ <h2>Eclipse MicroProfile</h2>
<p>
For more information about the features used in this application, see the Open Liberty documentation:
<ul>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile-6.1.html">MicroProfile 6.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS-3.1.html">Jakarta RESTful Web Services 3.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp-2.1.html">Jakarta JSON Processing 2.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html">Jakarta JSON Binding 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#cdi-4.0.html">Jakarta Contexts and Dependency Injection 4.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpMetrics-5.1.html">MicroProfile Metrics 5.1</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpRestClient-3.0.html">MicroProfile Rest Client 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb-3.0.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Binding 3.0</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#microProfile.html">MicroProfile</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#restfulWS.html">Jakarta RESTful Web Services</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonp.html">Jakarta JSON Processing</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb.html">Jakarta JSON Binding</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#cdi.html">Jakarta Contexts and Dependency Injection</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpMetrics.html">MicroProfile Metrics</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#mpRestClient.html">MicroProfile Rest Client</a></li>
<li><a href="https://openliberty.io/docs/ref/feature/#jsonb.html" target="_blank" rel="noopener noreferrer">Jakarta JSON Binding</a></li>
</ul>
</p>
</div>
Expand Down

0 comments on commit 0ca10e7

Please sign in to comment.