Skip to content

Commit ac52f51

Browse files
committed
GH-148 - Overhaul of the reference documentation ob actuators and observability.
Renamed top-level section to "Production-ready features" to align with Spring Boot. Moved actuator support before observability one. Introduced introductory section to showcase the Insight starter.
1 parent 802ac39 commit ac52f51

File tree

1 file changed

+45
-18
lines changed

1 file changed

+45
-18
lines changed

src/docs/asciidoc/80-observability.adoc

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,35 @@
1-
[[observability]]
2-
= Observing Application Modules
3-
:imagesdir: images
1+
[[production-ready]]
2+
= Production-ready Features
43

5-
The interaction between application modules can be intercepted to create Micrometer spans to ultimately end up in traces you can visualize in tools like https://zipkin.io/[Zipkin].
6-
To activate the instrumentation add the following runtime dependency to your project:
4+
Spring Modulith provides support to expose architectural information about your system as a Spring Boot actuator endpoint as well as observing the interaction between application modules by capturing metrics and traces.
5+
As a production-ready application is likely to require both, the most convenient way to activate those features is to use the Spring Modulith Insight starter as follows:
76

7+
.Using the Spring Modulith Insight starter
88
[source, xml]
99
----
1010
<dependency>
11-
<groupId>org.springframework.modulith</groupId>
12-
<artifactId>spring-modulith-observability</artifactId>
11+
<groupId>org.springframework.experimental</groupId>
12+
<artifactId>spring-modulith-starter-insight</artifactId>
1313
<version>{projectVersion}</version>
1414
<scope>runtime</scope>
1515
</dependency>
1616
----
1717

18-
This will cause all Spring components that are part of the application module's API being decorated with an aspect that will intercept invocations and create Micrometer spans for them.
19-
A sample invocation trace can be seen below:
18+
This will include the actuator and observability support as well as Spring Boot's actuator startup for general support for actuators.
19+
Note, that you will still have to add further dependencies to connect your application to your monitoring tools such as https://zipkin.io/[Zipkin], https://docs.wavefront.com/[Wavefront] etc. usually via https://opentelemetry.io/[OpenTelemetry] or https://github.com/openzipkin/brave[Brave].
20+
Find more information on that in https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.micrometer-tracing[the corresponding section] of Spring Boot's reference documentation.
2021

21-
.A sample module invocation trace
22-
image::observability.png[]
23-
24-
In this particular case, triggering the payment changes the state of the order which then causes an order completion event being triggered.
25-
This gets picked up asynchronously by the engine that triggers another state change on the order, works for a couple of seconds and triggers the final state change on the order in turn.
26-
27-
[[observability.actuator]]
28-
== Application Module Actuator
22+
[[production-ready.actuator]]
23+
== [[observability.actuator]]Application Module Actuator
2924

3025
The application module structure can be exposed as Spring Boot actuator.
3126
To enable the actuator, add the `spring-modulith-actuator` dependency to the project:
3227

28+
.Using the Spring Modulith actuator support
3329
[source, xml]
3430
----
3531
<dependency>
36-
<groupId>org.springframework.modulith</groupId>
32+
<groupId>org.springframework.experimental</groupId>
3733
<artifactId>spring-modulith-actuator</artifactId>
3834
<version>{projectVersion}</version>
3935
<scope>runtime</scope>
@@ -50,6 +46,7 @@ To enable the actuator, add the `spring-modulith-actuator` dependency to the pro
5046

5147
Running the application will now expose an `applicationmodules` actuator resource:
5248

49+
.Accessing the actuator HTTP resource
5350
[source, json]
5451
----
5552
GET http://localhost:8080/actuator
@@ -79,6 +76,7 @@ GET http://localhost:8080/actuator
7976

8077
The `applicationmodules` resource adheres to the following structure:
8178

79+
.The JSON structure of the application modules actuator
8280
[%autowidth.stretch]
8381
|===
8482
|JSONPath|Description
@@ -93,6 +91,7 @@ The `applicationmodules` resource adheres to the following structure:
9391

9492
An example module arrangement would look like this:
9593

94+
.An example response for the application modules actuator
9695
[source, json]
9796
----
9897
{
@@ -110,6 +109,34 @@ An example module arrangement would look like this:
110109
} ]
111110
}
112111
}
112+
----
113113

114+
[[production-ready.observability]]
115+
== [[observability]]Observing Application Modules
116+
:imagesdir: images
117+
118+
The interaction between application modules can be intercepted to create Micrometer spans to ultimately end up in traces you can visualize in tools like https://zipkin.io/[Zipkin].
119+
To activate the instrumentation add the following runtime dependency to your project:
120+
121+
.Using the Spring Modulith observability support
122+
[source, xml]
123+
----
124+
<dependency>
125+
<groupId>org.springframework.modulith</groupId>
126+
<artifactId>spring-modulith-observability</artifactId>
127+
<version>{projectVersion}</version>
128+
<scope>runtime</scope>
129+
</dependency>
114130
----
115131

132+
NOTE: You will have to configure additional infrastructure dependencies depending on the tooling you want to pipe the observability metadata in.
133+
For details, please check the corresponding https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.micrometer-tracing[Spring Boot documentation] on which dependencies to include for your setup.
134+
135+
This will cause all Spring components that are part of the application module's API being decorated with an aspect that will intercept invocations and create Micrometer spans for them.
136+
A sample invocation trace can be seen below:
137+
138+
.A sample module invocation trace
139+
image::observability.png[]
140+
141+
In this particular case, triggering the payment changes the state of the order which then causes an order completion event being triggered.
142+
This gets picked up asynchronously by the engine that triggers another state change on the order, works for a couple of seconds and triggers the final state change on the order in turn.

0 commit comments

Comments
 (0)