Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
dmuelle committed Jan 15, 2025
1 parent 4925b12 commit 53a5af2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions modules/ROOT/pages/observability.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,36 @@
:page-type: general
= Observability

When applications are observable, operations teams can identify and understand the root causes of bugs, bottlenecks, and other inefficiencies. Open Liberty provides a robust framework for developing observable applications and integrates with numerous third-party monitoring tools.
When applications are observable, operations teams can identify the root causes of bugs, bottlenecks, and other inefficiencies. Open Liberty provides a framework for developing observable applications and integrates with numerous third-party monitoring tools.

Observability, the ability to understand the internal state of a system by examining its outputs, is a key aspect of maintaining high-performing, resilient microservices. Incorporating observability into your microservices from the outset helps you build more robust and manageable systems, facilitating easier debugging, performance tuning, and overall system health monitoring.

The three pillars of observable microservices are logging, metrics, and tracing.
With MicroProfile Telemetry 2.0 and later, you can manage Open Liberty logs, metrics, and traces in a standardized way by using the OpenTelemetry protocol. For more information, see xref:microprofile-telemetry.adoc[Collect logs, metrics, and traces with OpenTelemetry].

You can also configure health checks for your Open Liberty applications with xref:health-check-microservices.adoc[MicroProfile Health]. A health check is a special REST API implementation that you can use to validate the status of a microservice and its dependencies. With MicroProfile Health, microservices can self-check their health and publish their overall status to a defined endpoint.


== Logging: Understanding application behavior

Logging is the process of recording events within the system, capturing detailed information about what happened, when, and why. It's essential for debugging, auditing, and understanding the application's behavior. Logs provide a wealth of information about your application's behavior, including errors, warnings, and debug messages. Open Liberty has a xref:log-trace-configuration.adoc[unified logging component] that handles messages that are written by applications and the runtime, and provides First Failure Data Capture (FFDC) capability. Logging data that is written by applications by using the `System.out`, `System.err`, or `java.util.logging.Logger` streams is combined into the Open Liberty runtime logs by default.
Logging is the process of recording events within the system, capturing detailed information about what happened, when, and why. It's essential for debugging, auditing, and understanding application behavior. Logs provide a wealth of information, including errors, warnings, and debug messages. Open Liberty has a xref:log-trace-configuration.adoc[unified logging component] that handles messages that are written by applications and the runtime, and provides First Failure Data Capture (FFDC) capability. Logging data that is written by applications by using the `System.out`, `System.err`, or `java.util.logging.Logger` streams is combined into the Open Liberty runtime logs by default.

== Metrics: Measuring performance

Metrics are quantitative measurements that provide insights into the state and performance of your microservice. Operations teams use metrics to track key performance indicators (KPIs) such as response times, error rates, and throughput. By collecting and analyzing metrics, they can identify trends, spikes, and anomalies that might indicate potential issues or areas for optimization. When you enable MicroProfile Telemetry 2.0 or later, Open Liberty automatically collects and exports a default set of metrics. For more information about these metrics, see the xref:mptelemetry-metrics-list.adoc[MicroProfile Telemetry metrics reference list]. You can also use the OpenTelemetry API to xref:custom-mptelemetry-metrics.adoc[define custom metrics] in your application code for OpenTelemetry to collect and export, if needed. Open LIberty also supports collecting metrics with MicroProfile Metrics. However, MicroProfile Telemetry provides a comprehensive solution for traces, metrics, and logging.
Metrics are quantitative measurements that provide insights into the state and performance of your microservice. Operations teams use metrics to track key performance indicators (KPIs) such as response times, error rates, and throughput. By collecting and analyzing metrics, they can identify trends, spikes, and anomalies that might indicate potential issues or areas for optimization. Metrics provide real-time statistics that you can analyze with specialized monitoring tools, such as Prometheus and Grafana.

When you enable MicroProfile Telemetry 2.0 or later, Open Liberty automatically collects and exports a default set of metrics. For more information about these metrics, see the xref:mptelemetry-metrics-list.adoc[MicroProfile Telemetry metrics reference list]. Additionally, you can use the OpenTelemetry API to xref:custom-mptelemetry-metrics.adoc[define custom metrics] in your application code, if needed. Open Liberty also supports collecting metrics with MicroProfile Metrics. However, MicroProfile Telemetry provides a comprehensive solution for traces, metrics, and logging.

== Tracing: Following requests

Tracing is the process of tracking requests as they flow through a distributed system. It helps in understanding the performance and behavior of your microservices in a complex, interconnected environment. Distributed tracing, a crucial aspect of observability in microservices, involves correlating traces from various services to visualize the entire request journey. By implementing tracing in your microservices, operations teams can quickly identify bottlenecks, debug complex issues, and optimize inter-service communication.
In microservice applications, sources of latency or inaccuracy can be difficult to determine because relationships and dependencies among the constituent services are not always obvious. One way to increase observability of an application is by emitting traces. Traces represent requests and consist of multiple spans. A span represents a single operation in a request and contains a name, time-related data, log messages, and metadata to gather data about what occurs during a transaction. When you implement tracing in your microservices, operations teams can quickly identify bottlenecks, debug complex issues, and optimize inter-service communication.

OpenTelemetry, an open source framework, provides a standardized approach to collect, process, and export trace data. When you enable OpenTelemetry for Open Liberty, Jakarta RESTful Web Services and JAX-RS applications are instrumented for trace by default. Spans are automatically generated for incoming HTTP requests, including static files, servlets, and JSPs. These spans are automatically exported according to the configured OpenTelemetry exporter settings.

Automatic instrumentation is available only for JAX-RS and Jakarta RESTful web service applications. To create spans for other operations, such as database calls, you can add manual instrumentation to the source code for those operations by using the OpenTelemetry API. Alternatively, you can attach the OpenTelemetry Java agent to any Java 8+ application. For more information about these options, see xref:telemetry-trace.adoc[Code instrumentation for MicroProfile Telemetry tracing].

Implementing observability in your Java microservices involves a combination of metrics, logging, and tracing. With Open Liberty and OpenTelemetry, you can gain valuable insights into your application's behavior, enabling you to identify and resolve issues quickly. Remember, observability is not a one-time task but an ongoing process that must be integrated into your development lifecycle. By making observability a priority, you can build more reliable, performant, and maintainable microservices.

Implementing observability in your microservices involves a combination of metrics, logging, and tracing. With Open Liberty and OpenTelemetry, you can gain valuable insights into your application behavior so you can identify and resolve issues quickly. Observability is not a one-time task but an ongoing process that must be integrated into your development lifecycle. By making observability a priority, you can build more reliable, performant, and maintainable microservices.

For hands-on tutorials on different observability configurations for Open Liberty, check out our link:/guides/#observability[Observability guides].

// assisted by watsonx latest with latest GenAI contribution: Granite-3-8b-instruct

0 comments on commit 53a5af2

Please sign in to comment.