Skip to content

Commit

Permalink
edits
Browse files Browse the repository at this point in the history
  • Loading branch information
dmuelle committed Nov 26, 2024
1 parent d9f1735 commit 1abd67f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 28 deletions.
2 changes: 1 addition & 1 deletion modules/ROOT/pages/custom-mptelemetry-metrics.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ For more information about collecting and emitting metrics with MicroProfile Tel

For more information about OpenTelemetry metrics, see the link:https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api/1.39.0/io/opentelemetry/api/metrics/package-summary.html[OpenTelemetry metrics API documentation].

Before you can use OpenTelemetry to define custom metrics metrics, you must make 3rd party APIs visible in your runtime environment by editing your runtime configuration. You must also add the OpenTelemetry API and annotations as a dependency on your build path. For more information, see link:/docs/latest/reference/feature/mpTelemetry-2.0.html#dev[Customize your application telemetry with the OpenTelemetry API].
Before you can use OpenTelemetry to define custom metrics metrics, you must make 3rd party APIs visible in your runtime environment by editing your runtime configuration. For more information, see link:/docs/latest/reference/feature/mpTelemetry-2.0.html#dev[Customize your application telemetry with the OpenTelemetry API].

The following example defines a custom counter metric:

Expand Down
7 changes: 6 additions & 1 deletion modules/ROOT/pages/fault-tolerance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ You can build resilient microservices by including fault tolerance policies in y

Microservice-based applications are resilient when they can continue operating if there is a failure or error in some part of the system. Fault tolerance helps applications fail fast and recover smoothly by guiding how and when certain requests occur and by providing fallback strategies to handle common errors. For example, in an airline ticket application, different microservices might support scheduling, purchasing, and customer preferences. If one service fails, fault tolerance policies help contain the error and keep it from taking down the whole application.


== MicroProfile Fault Tolerance

The feature:mpFaultTolerance[display=MicroProfile Fault Tolerance] feature defines a standard API to implement a set of fault tolerance policies. The policies that you implement in your code guide how long requests run, when they retry after an error, and what they do to recover when certain requests fail. MicroProfile Fault Tolerance makes it easy to build resilient microservices that provide reliable function, even when errors occur.

When you enable both feature:mpFaultTolerance-4.1[display=MicroProfile Fault Tolerance 4.1] and feature:mpTelemetry-2.0[display=MicroProfile Telemetry 2.0], fault tolerance metrics are automatically collected and exported to the configured OpenTelemetry metrics exporter. For more information, see xref:microprofile-telemetry.adoc[Collect logs, metrics, and traces with OpenTelemetry] and xref:mptelemetry-metrics-list.adoc[MicroProfile Telemetry metrics reference list].

MicroProfile Fault Tolerance supports the following policies:

- <<#timeout,Timeouts>>
Expand Down Expand Up @@ -210,5 +213,7 @@ Ready to start building more resilient microservices with MicroProfile Fault Tol
* To learn how to use the Circuit Breaker and Fallback policies to prevent repeated failed calls to a service, see link:/guides/circuit-breaker.html[Preventing repeated failed calls to microservices].

== See also

- xref:reference:diff/mp-61-70-diff.adoc#ft[Differences between MicroProfile Fault Tolerance 4.1 and 4.0]
- - xref:reference:diff/mp-33-40-diff.adoc#ft[Differences between MicroProfile Fault Tolerance 3.0 and 2.1]
- xref:reference:diff/mp-22-30-diff.adoc#ft[Differences between MicroProfile Fault Tolerance 2.0 and 1.1]
- xref:reference:diff/mp-33-40-diff.adoc#ft[Differences between MicroProfile Fault Tolerance 3.0 and 2.1]
2 changes: 1 addition & 1 deletion modules/ROOT/pages/telemetry-trace.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ In Open Liberty version 23.0.0.11 and later, spans are automatically generated f

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 https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api/1.39.0/io/opentelemetry/api/trace/package-summary.html[OpenTelemetry API].

However, before you manually instrument your code, you must make 3rd party APIs visible in your runtime environment by editing your runtime configuration. You must also add the OpenTelemetry API and annotations as a dependency on your build path. For more information, see link:/docs/latest/reference/feature/mpTelemetry-2.0.html#dev[Customize your application telemetry with the OpenTelemetry API].
However, before you manually instrument your code, you must make 3rd party APIs visible in your runtime environment by editing your runtime configuration. For more information, see link:/docs/latest/reference/feature/mpTelemetry-2.0.html#dev[Customize your application telemetry with the OpenTelemetry API].

After you complete those prerequisites, you're ready to instrument your code. The following examples show configuration options with the OpenTelemetry API.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MicroProfile Telemetry 2.0 is compatible with multiple versions of the feature:microprofile[display=MicroProfile umbrella feature]. It is automatically enabled when you enable `microprofile-6.1` or `microprofile-7.0`. However, it also works with `microprofile-5.0`, `microprofile-4.1`, or `microprofile-1.4` if you separately enable it alongside any of those features.
28 changes: 3 additions & 25 deletions modules/reference/pages/feature/mpTelemetry-2.0/examples.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ When you enable the MicroProfile Telemetry feature and set this property, your s
[#logs]
=== Collect logs from a specified source

To enable the MicroProfile Telemetry feature to collect logs from different sources in the Open Liberty runtime environment, configure the `source` attribute for the `mpTelemetry` element with a comma-separated list of comma-separated log sources.
To enable the MicroProfile Telemetry feature to collect logs from different sources in the Open Liberty runtime environment, configure the `source` attribute for the `mpTelemetry` element with a comma-separated list of log sources.

[source,xml]
----
Expand All @@ -31,35 +31,13 @@ To enable the MicroProfile Telemetry feature to collect logs from different sour
[#dev]
=== Customize your application telemetry with the OpenTelemetry API

Although OpenTelemetry automatically collects a default set of logs, metrics, and traces, if you need to xref:ROOT:telemetry-trace.adoc[manually instrument your code to collect traces] or xref:ROOT:custom-mptelemetry-metrics.adoc[define custom metrics], you must make the OpenTelemetry API and annotations available in your development environment.
Although OpenTelemetry automatically collects a default set of logs, metrics, and traces, if you need to xref:ROOT:telemetry-trace.adoc[manually instrument your code to collect traces] or xref:ROOT:custom-mptelemetry-metrics.adoc[define custom metrics], you must make the OpenTelemetry API visible in your development environment.

Complete the following prerequisites before you configure custom OpenTelemetry traces or metrics in your application code:

* xref:ROOT:class-loader-library-config.adoc#3rd-party[Enable third-party APIs] for your application by adding the following code in your `server.xml` file:
xref:ROOT:class-loader-library-config.adoc#3rd-party[Enable third-party APIs] for your application by adding the following code in your `server.xml` file:
+
[source,xml]
----
<webApplication id="app-name" location="app-name.war">
<classloader apiTypeVisibility="+third-party"/>
</webApplication>
----

* Add the `opentelemetry` API and OpenTelemetry instrumentation annotations as a provided dependency to your build path. For example, with Maven, add the following code to your `pom.xml` file.
+
[source,xml]
----
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-api</artifactId>
<version>1.39.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.opentelemetry.instrumentation</groupId>
<artifactId>opentelemetry-instrumentation-annotations</artifactId>
<version>1.39.0-alpha</version>
<scope>provided</scope>
</dependency>
----

Once you complete these prerequisites, you can use the OpenTelemetry API and annotations in your development environment to configure custom application telemetry.

0 comments on commit 1abd67f

Please sign in to comment.