-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added native section in the docs #3
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,8 @@ class MyHandler implements ObservationHandler<Observation.Context> { | |
|
||
You might wonder what you should do to have the observability turned on for the controllers? You can register one bean and be ready to go. In the future we, will provide a more automated solution. | ||
|
||
// TODO: Remove this section once https://github.com/spring-projects/spring-boot/issues/32538 is merged | ||
|
||
.MyConfiguration.java | ||
[source,java] | ||
---- | ||
|
@@ -359,6 +361,12 @@ class MyConfiguration { | |
} | ||
---- | ||
|
||
=== Limitations | ||
|
||
The Spring Boot AutoConfiguration for WebMvc Observability is not yet there - that's why we needed to set things up manually. For more information check this https://github.com/spring-projects/spring-boot/issues/32538[issue]. | ||
|
||
For the Spring Boot Exemplars AutoConfiguration to work properly we need to wait for https://github.com/spring-projects/spring-boot/pull/32399[this PR] and https://github.com/spring-projects/spring-boot/pull/32415[this PR] to be merged. Until then we need to create https://github.com/marcingrzejszczak/observability-boot-blog-post/blob/main/server/src/main/java/com/example/server/ExemplarsConfiguration.java[such configuration] manually. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add commas after "work properly" and "Until then" |
||
|
||
== Running It All Together | ||
|
||
We have prepared a Docker setup of the whole Observability infrastructure under https://github.com/marcingrzejszczak/observability-boot-blog-post[this link]. Follow these steps to run the infrastructure and both applications: | ||
|
@@ -427,12 +435,105 @@ If you want to see the metrics from your Observation that you have manually crea | |
|
||
image::https://raw.githubusercontent.com/marcingrzejszczak/observability-boot-blog-post/main/docs/src/main/asciidoc/img/my-observation.png[] | ||
|
||
== Running It All Together using Spring Native | ||
|
||
To better understand how Spring Boot supports Native please read https://spring.io/blog/2022/09/26/native-support-in-spring-boot-3-0-0-m5[this excellent blog post]. We will reuse that knowledge to run the previously created applications using Spring Native. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comma after "supports Native" and remove "will" |
||
|
||
=== Building | ||
|
||
To build the applications, you need GraalVM on your path. If you use `SDKMan`, invoke the following: | ||
|
||
[indent=0] | ||
---- | ||
sdk install java 22.2.r17-nik | ||
---- | ||
|
||
See also https://www.graalvm.org/java/quickstart/[GraalVM Quickstart] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a period at the end. |
||
|
||
To build the application with Maven, you need to enable the `native` profile: | ||
|
||
[indent=0] | ||
---- | ||
$ ./mvnw -Pnative clean package | ||
---- | ||
|
||
=== Running | ||
|
||
Run the server side application first | ||
|
||
[indent=0] | ||
---- | ||
$ ./server/target/server | ||
---- | ||
|
||
Next, run the client side application. | ||
|
||
[indent=0] | ||
---- | ||
$ ./client/target/client | ||
---- | ||
|
||
You should get a similar output to this one | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to: You should get output similar to this: |
||
|
||
.Client side logs | ||
[indent=0] | ||
---- | ||
2022-10-10T12:57:17.712+02:00 INFO [client,,] 82009 --- [ main] com.example.client.ClientApplication : Starting ClientApplication using Java 17.0.4 on marcin-precision5560 with PID 82009 (/home/marcin/repo/observability/blogs/bootRc1/client/target/client started by marcin in /home/marcin/repo/observability/blogs/bootRc1) | ||
2022-10-10T12:57:17.712+02:00 INFO [client,,] 82009 --- [ main] com.example.client.ClientApplication : No active profile set, falling back to 1 default profile: "default" | ||
2022-10-10T12:57:17.723+02:00 INFO [client,,] 82009 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 6543 (http) | ||
2022-10-10T12:57:17.723+02:00 INFO [client,,] 82009 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] | ||
2022-10-10T12:57:17.723+02:00 INFO [client,,] 82009 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.0.23] | ||
2022-10-10T12:57:17.727+02:00 INFO [client,,] 82009 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext | ||
2022-10-10T12:57:17.727+02:00 INFO [client,,] 82009 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 15 ms | ||
2022-10-10T12:57:17.731+02:00 WARN [client,,] 82009 --- [ main] i.m.c.i.binder.jvm.JvmGcMetrics : GC notifications will not be available because MemoryPoolMXBeans are not provided by the JVM | ||
2022-10-10T12:57:17.781+02:00 INFO [client,,] 82009 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 15 endpoint(s) beneath base path '/actuator' | ||
2022-10-10T12:57:17.783+02:00 INFO [client,,] 82009 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 6543 (http) with context path '' | ||
2022-10-10T12:57:17.783+02:00 INFO [client,,] 82009 --- [ main] com.example.client.ClientApplication : Started ClientApplication in 0.077 seconds (process running for 0.079) | ||
2022-10-10T12:57:17.784+02:00 INFO [client,27c1113e4276c4173daec3675f536bf4,e0f2db8b983607d8] 82009 --- [ main] com.example.client.ClientApplication : Will send a request to the server | ||
2022-10-10T12:57:17.820+02:00 INFO [client,27c1113e4276c4173daec3675f536bf4,e0f2db8b983607d8] 82009 --- [ main] com.example.client.ClientApplication : Got response [foo] | ||
2022-10-10T12:57:18.966+02:00 INFO [client,,] 82009 --- [nio-6543-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' | ||
2022-10-10T12:57:18.966+02:00 INFO [client,,] 82009 --- [nio-6543-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' | ||
2022-10-10T12:57:18.966+02:00 INFO [client,,] 82009 --- [nio-6543-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 0 ms | ||
---- | ||
|
||
.Server side logs | ||
[indent=0] | ||
---- | ||
2022-10-10T12:57:07.200+02:00 INFO [server,,] 81760 --- [ main] com.example.server.ServerApplication : Starting ServerApplication using Java 17.0.4 on marcin-precision5560 with PID 81760 (/home/marcin/repo/observability/blogs/bootRc1/server/target/server started by marcin in /home/marcin/repo/observability/blogs/bootRc1) | ||
2022-10-10T12:57:07.201+02:00 INFO [server,,] 81760 --- [ main] com.example.server.ServerApplication : No active profile set, falling back to 1 default profile: "default" | ||
2022-10-10T12:57:07.213+02:00 INFO [server,,] 81760 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 7654 (http) | ||
2022-10-10T12:57:07.213+02:00 INFO [server,,] 81760 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] | ||
2022-10-10T12:57:07.213+02:00 INFO [server,,] 81760 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.0.23] | ||
2022-10-10T12:57:07.217+02:00 INFO [server,,] 81760 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext | ||
2022-10-10T12:57:07.217+02:00 INFO [server,,] 81760 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 16 ms | ||
2022-10-10T12:57:07.222+02:00 WARN [server,,] 81760 --- [ main] i.m.c.i.binder.jvm.JvmGcMetrics : GC notifications will not be available because MemoryPoolMXBeans are not provided by the JVM | ||
2022-10-10T12:57:07.278+02:00 INFO [server,,] 81760 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 15 endpoint(s) beneath base path '/actuator' | ||
2022-10-10T12:57:07.280+02:00 INFO [server,,] 81760 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 7654 (http) with context path '' | ||
2022-10-10T12:57:07.281+02:00 INFO [server,,] 81760 --- [ main] com.example.server.ServerApplication : Started ServerApplication in 0.086 seconds (process running for 0.088) | ||
2022-10-10T12:57:07.639+02:00 INFO [server,,] 81760 --- [nio-7654-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' | ||
2022-10-10T12:57:07.639+02:00 INFO [server,,] 81760 --- [nio-7654-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' | ||
2022-10-10T12:57:07.640+02:00 INFO [server,,] 81760 --- [nio-7654-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 1 ms | ||
2022-10-10T12:57:17.785+02:00 INFO [server,,] 81760 --- [nio-7654-exec-8] com.example.server.MyHandler : Before running the observation for context [http.server.requests] | ||
2022-10-10T12:57:17.785+02:00 INFO [server,27c1113e4276c4173daec3675f536bf4,9affba5698490e2d] 81760 --- [nio-7654-exec-8] com.example.server.MyController : Got a request | ||
2022-10-10T12:57:17.820+02:00 INFO [server,,] 81760 --- [nio-7654-exec-8] com.example.server.MyHandler : After running the observation for context [http.server.requests] | ||
---- | ||
|
||
You can check Grafana for metrics and traces. Read the limitations section below on why you won't find any pushed logs to Loki. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Turn "limitations section" into a link and remove "below" (which you won't need, thanks to the link). |
||
|
||
=== Native Support Limitations | ||
|
||
You will not see logs being pushed to Loki just yet. For more information look into https://github.com/spring-projects/spring-boot/issues/25847[this issue]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comma after "For more information" |
||
|
||
On the client side we needed to provide the `reflect-config.js` configuration manually. For more information look into https://github.com/open-telemetry/opentelemetry-java/pull/4832[this PR]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to: On the client side, we need to provide the |
||
|
||
= Summary | ||
|
||
In this blog post, we have managed to give you an introduction of the main concepts behind the Micrometer Observability API. We have also shown you how you can create observations by using the Observation API and annotations. You were also able to visualize the latency, see the correlated logs, and check the metrics that come from you Spring Boot applications. | ||
|
||
You were also able to observe your applications using native images via Spring Native. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to: You could also able observe your applications by using native images with Spring Native. |
||
|
||
= Next Steps | ||
|
||
Based on community feedback, we will continue to improve our Observability story. We intend to go GA in November this year. | ||
|
||
This is an exciting time for us. We would again like to thank everyone who has already contributed and reported feedback, and we look forward to further feedback! | ||
This is an exciting time for us. We would again like to thank everyone who has already contributed and reported feedback, and we look forward to further feedback (don't hesitate to check out Spring Boot's latest snapshots)! | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change to: This is an exciting time for us. We would again like to thank everyone who has already contributed and reported feedback, and we look forward to further feedback! Check out Spring Boot's latest snapshots! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
[ | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.BaseLinkedQueueConsumerNodeRef" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.BaseLinkedQueueConsumerNodeRef", | ||
"fields": [ | ||
{ | ||
"name": "consumerNode" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.BaseLinkedQueueProducerNodeRef" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.BaseLinkedQueueProducerNodeRef", | ||
"fields": [ | ||
{ | ||
"name": "producerNode" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields", | ||
"fields": [ | ||
{ | ||
"name": "producerLimit" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields", | ||
"fields": [ | ||
{ | ||
"name": "consumerIndex" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.BaseMpscLinkedArrayQueueProducerFields" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.BaseMpscLinkedArrayQueueProducerFields", | ||
"fields": [ | ||
{ | ||
"name": "producerIndex" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.LinkedQueueNode" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.LinkedQueueNode", | ||
"fields": [ | ||
{ | ||
"name": "next" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueConsumerIndexField" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueConsumerIndexField", | ||
"fields": [ | ||
{ | ||
"name": "consumerIndex" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerIndexField", | ||
"fields": [ | ||
{ | ||
"name": "producerIndex" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerLimitField" | ||
}, | ||
"name": "io.opentelemetry.internal.shaded.jctools.queues.MpscArrayQueueProducerLimitField", | ||
"fields": [ | ||
{ | ||
"name": "producerLimit" | ||
} | ||
] | ||
}, | ||
{ | ||
"condition": { | ||
"typeReachable": "io.opentelemetry.internal.shaded.jctools.queues.UnsafeAccess" | ||
}, | ||
"name": "sun.misc.Unsafe", | ||
"fields": [ | ||
{ | ||
"name": "theUnsafe" | ||
} | ||
], | ||
"queriedMethods": [ | ||
{ | ||
"name": "getAndAddLong", | ||
"parameterTypes": [ | ||
"java.lang.Object", | ||
"long", | ||
"long" | ||
] | ||
}, | ||
{ | ||
"name": "getAndSetObject", | ||
"parameterTypes": [ | ||
"java.lang.Object", | ||
"long", | ||
"java.lang.Object" | ||
] | ||
} | ||
] | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to:
The Spring Boot AutoConfiguration for WebMvc Observability is not yet ready. As a result, we need to set things up manually. For more information, see this https://github.com/spring-projects/spring-boot/issues/32538[issue].