-
Notifications
You must be signed in to change notification settings - Fork 184
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
Add a ServiceTalk debugging utilities example #1459
Conversation
Motivation: HttpExecutionStrategies.noOffloadsStrategy() does not disable all offloading. Modifications: Improve the description of HttpExecutionStrategies.noOffloadsStrategy() to better explain where the default offloading executor will still be used. A recipe is provided to completely disable offloading. Result: Behaviour of HttpExecutionStrategies.noOffloadsStrategy() is clarified.
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleClient.java
Outdated
Show resolved
Hide resolved
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleServer.java
Outdated
Show resolved
Hide resolved
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.
Good idea to demonstrate this features! Have a few suggestions to improve the focus:
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleClient.java
Outdated
Show resolved
Hide resolved
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleClient.java
Outdated
Show resolved
Hide resolved
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleClient.java
Outdated
Show resolved
Hide resolved
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleClient.java
Outdated
Show resolved
Hide resolved
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleClient.java
Show resolved
Hide resolved
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleServer.java
Outdated
Show resolved
Hide resolved
servicetalk-examples/http/debugging/src/main/resources/log4j2.xml
Outdated
Show resolved
Hide resolved
|
||
dependencies { | ||
implementation project(":servicetalk-annotations") | ||
implementation project(":servicetalk-encoding-netty") |
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.
This dependency is not used in this example
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.
Is there an IntelliJ detector for this? I used to use one in Netbeans with Maven and would like to turn it on for Gradle if I could.
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.
Not that I'm aware of 🤷♂️
...p/debugging/src/main/java/io/servicetalk/examples/http/debugging/DebuggingExampleClient.java
Outdated
Show resolved
Hide resolved
// Enables visibility for all wire log messages | ||
System.setProperty("servicetalk.logger.wireLogLevel", "TRACE"); | ||
// Disables the context associated with individual request/responses to simplify execution tracing | ||
AsyncContext.disable(); |
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.
Not sure, but something to discuss and consider: because it's easy to forget to remove this statement after the debugging we may demonstrate it can be protected by the system property. Something like:
static {
if (Boolean.getBoolean("debuggingMode")) {
AsyncContext.disable();
}
}
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.
It would be good to standardize how we use system properties and/or environment variables for configuration and control of debugging features. It is definitely a useful tool. In other orgs I have used
(public|private)
static final boolean SOMETHING_DEBUG = Boolean.getBoolean("package.name.Feature.debug");`
and then triggered all use off of the boolean. One advantage is that it lets the JIT remove dead code and also makes it easy to find all the references.
Motivation: ServiceTalk has purpose-built features for improving the debugging experience for both applications and for ServiceTalk itself. An example with explanatory comments would improve exposure of these features. Modifications: A new HTTP debugging example is provided demonstrating wire logging, disabling offloading, disabling async context. Result: ServiceTalk debugging features are more visible.
provide (very verbose) samples of the output
847e548
to
e50b16d
Compare
Thank you for the feedback. I think this will be a really useful example. |
Motivation: Fixing a few typos, adding links to appropriate features in javadoc, clarifying difference between wire-logger and h2-frame-logger. Modifications: - Fix typos in `index.adoc` and `log4j2.xml` name; - Add links in javadoc for all demonstrated features; - Use a different name for h2 frame logger; - Use another comment style to highlight comments for demonstrated features; - Add `CLOSE/INACTIVE/UNREGISTERED` wire logger events; Result: More details in the example.
Motivation: Fixing a few typos, adding links to appropriate features in javadoc, clarifying the difference between wire-logger and h2-frame-logger. Modifications: - Fix typos in `index.adoc` and `log4j2.xml` name; - Add links in javadoc for all demonstrated features; - Use a different name for h2 frame logger; - Use another comment style to highlight comments for demonstrated features and let IDE use shortcut to uncomment the code line; - Add `CLOSE/INACTIVE/UNREGISTERED` wire logger events; Result: More details in the example.
Motivation:
ServiceTalk has purpose-built features for improving the debugging
experience for both applications and for ServiceTalk itself. An example
with explanatory comments would improve exposure of these features.
Modifications:
A new HTTP debugging example is provided demonstrating wire logging,
disabling offloading, disabling async context.
Result:
ServiceTalk debugging features are more visible.