Red Hat Quarkus native applications monitoring with metrics and logs
Red Hat Quarkus is an open source Java framework optimized for GraalVM to make Java a valuable citizen in the world of microservices. Quarkus belongs to the family of full-stack frameworks tailored for Kubernetes. It includes modern Java libraries and follows the latest Java standards.
GraalVM is designed to achieve high performance in the execution of applications written in Java and other JVM languages. It offers two approaches for compiling Java code to an executable:
- just-in-time (JIT) compilation
- ahead-of-time (AOT) compilation to a native image
AOT-compiled native images include only the Java code required at runtime, excluding everything else from the libraries and frameworks.
Learn how Dynatrace can monitor metrics and logs from a Quarkus application compiled as a native image.
Prerequisites
-
Your GraalVM version is supported by Dynatrace.
-
GraalVM is configured to build native images. For details, see the Building a native executable Quarkus guide.
-
OneAgent or Dynatrace Operator is installed on the machine where the application is about to be executed.
The required installation depends on your application:
If your application is running See the instruction for on a virtual machine or bare-metal OneAgent as workload in Kubernetes or OpenShift Dynatrace Operator
Traces
Dynatrace can automatically trace JIT-compiled Quarkus applications executed on OpenJDK HotSpot JVM and GraalVM.
Tracing for AOT-compiled Quarkus native applications is currently not supported.
Metrics
Red Hat recommends that you obtain metrics from Quarkus via the quarkus-micrometer-registry-prometheus
library.
To learn how to utilize Micrometer metrics in your Quarkus application, see the Micrometer metrics Quarkus guide.
Dynatrace offers two approaches for obtaining Micrometer metrics from Prometheus: via API or via an extension.
Ingest Micrometer metrics via Dynatrace API
Use the Dynatrace API to ingest metrics obtained from the quarkus-micrometer-resistry-prometheus
library.
To learn more about the ingestion procedure, see Send Micrometer metrics to Dynatrace.
For natively built applications, be sure to follow the Directly in Micrometer approach.
Ingest Micrometer metrics via an extension
Use the Dynatrace Extension 2.0 Framework to ingest Micrometer metrics obtained from the Prometheus data source—you need to create a custom extension for that.
As a starting point, you can use the custom extension example below. It's tailored to the quarkus-micrometer-resistry-prometheus
library. Be sure to use the correct metrics endpoint in your configuration. The default endpoint is localhost:8080/q/metrics
.
Logs
Dynatrace offers various options for collecting logs from your applications and environments.
To learn how to set up logging in your Quarkus application, see the Configuring logging Quarkus guide.
For the procedure below, we assume your application writes logs to the /var/log/quarkus-app.log
file.
- Start your Quarkus native application.
- In the Dynatrace menu, go to Hosts and select your host.
- Scroll down to the Process analysis section and, in the list of processes, select the process of your Quarkus native application.
- On the right side of the Process panel, select
> Settings.
- In the process group settings, select Log monitoring > Add new log for monitoring.
- Enter the full path of your log file. Be sure to follow the log path requirements.
- Select Save changes.
- Include the added log files in your log storage.