### Dependency updates #### Update successfully to the latest - [x] `androidx.core:core 1.10.0 -> 1.10.1` - [x] `com.google.api.grpc:proto-google-common-protos 2.17.0 -> 2.22.0` - [x] `com.google.cloud:google-cloud-logging 3.14.5 -> 3.15.5` - [x] `com.google.truth:truth 1.0.1 -> 1.1.5` - [x] `com.puppycrawl.tools:checkstyle 8.28 -> 10.12.1` - [x] `org.robolectric:robolectric 4.9.2 -> 4.10.3` - [x] Auto-value - [x] `com.google.auto.value:auto-value 1.10.1 -> 1.10.2` - [x] `com.google.auto.value:auto-value-annotations 1.10.1 -> 1.10.2` - [x] Protobuf - [x] `com.google.protobuf:protobuf-java 3.22.3 -> 3.23.4` - [x] `com.google.protobuf:protobuf-java-util 3.22.3 -> 3.23.4` - [x] `com.google.protobuf:protobuf-javalite 3.22.3 -> 3.23.4` - [x] `com.google.protobuf:protoc 3.22.3 -> 3.23.4` - [x] Errorprone - [x] `com.google.errorprone:error_prone_annotations 2.18.0 -> 2.20.0` - [x] `com.google.errorprone:error_prone_core 2.18.0 -> 2.20.0` - ~`libs.checkstylejava8 = com.puppycrawl.tools:checkstyle 9.3 -> 10.12.1`~ -- pinned to last version supporting java8, update not needed #### Updated to non-latest - [x] `com.squareup.okio:okio 1.17.5 ->` ~`3.4.0`~ `2.10.0` -- updating to 3.x failed due to them [introducing gradle multiplatform artifacts](https://github.com/square/okio/blob/master/CHANGELOG.md#version-320). Error in [the comment below](https://github.com/grpc/grpc-java/pull/10359#issuecomment-1632853307.). - [x] `org.checkerframework:checker-qual 3.33.0 ->` ~`3.36.0`~ -- removed, no longer needed - [x] Mockito - updated to `4.11.0`. Versions 5.x break some tests. Errors in [the comment below](https://github.com/grpc/grpc-java/pull/10359#issuecomment-1632834435). - `org.mockito:mockito-android 3.12.4 ->` ~`5.4.0`~ `4.11.0` - `org.mockito:mockito-core 3.12.4 ->` ~`5.4.0`~ `4.11.0` #### Not updated - Cronet -- upgrade failed, created a blocker ticket https://github.com/grpc/grpc-java/issues/10396 - ~`org.chromium.net:cronet-api 108.5359.79 -> 113.5672.61`~ - ~`org.chromium.net:cronet-embedded 108.5359.79 -> 113.5672.61`~ - Google auth -- upgrade blocked by https://github.com/grpc/grpc-java/pull/9118 - ~`com.google.auth:google-auth-library-credentials 1.4.0 -> 1.19.0`~ - ~`com.google.auth:google-auth-library-oauth2-http 1.4.0 -> 1.19.0`~ - Guava -- not upgraded: 32.1.0 [broke gradle modules](https://github.com/google/guava/releases/tag/v32.1.0) - ~`libs.guava = com.google.guava:guava 32.0.1-android -> 32.1.1-jre`~ - ~`libs.guava.jre = com.google.guava:guava 32.0.1-jre -> 32.1.1-jre`~ - ~`libs.guava.testlib = com.google.guava:guava-testlib 32.0.1-android -> 32.1.1-jre`~ ### checkForUpdates results ``` > Task :checkForUpdates androidx.core:core 1.10.0 -> 1.10.1 com.google.auto.value:auto-value 1.10.1 -> 1.10.2 com.google.auto.value:auto-value-annotations 1.10.1 -> 1.10.2 org.checkerframework:checker-qual 3.33.0 -> 3.36.0 com.puppycrawl.tools:checkstyle 8.28 -> 10.12.1 org.chromium.net:cronet-api 108.5359.79 -> 113.5672.61 org.chromium.net:cronet-embedded 108.5359.79 -> 113.5672.61 com.google.errorprone:error_prone_annotations 2.18.0 -> 2.20.0 com.google.errorprone:error_prone_core 2.18.0 -> 2.20.0 com.google.errorprone:error_prone_core 2.10.0 -> 2.20.0 com.google.api.grpc:proto-google-common-protos 2.17.0 -> 2.22.0 com.google.auth:google-auth-library-credentials 1.4.0 -> 1.19.0 com.google.auth:google-auth-library-oauth2-http 1.4.0 -> 1.19.0 com.google.cloud:google-cloud-logging 3.14.5 -> 3.15.5 com.google.guava:guava 32.0.1-android -> 32.1.1-jre com.google.guava:guava 32.0.1-jre -> 32.1.1-jre com.google.guava:guava-testlib 32.0.1-android -> 32.1.1-jre org.mockito:mockito-android 3.12.4 -> 5.4.0 org.mockito:mockito-core 3.12.4 -> 5.4.0 com.squareup.okio:okio 1.17.5 -> 3.4.0 com.google.protobuf:protobuf-java 3.22.3 -> 3.23.4 com.google.protobuf:protobuf-java-util 3.22.3 -> 3.23.4 com.google.protobuf:protobuf-javalite 3.22.3 -> 3.23.4 com.google.protobuf:protoc 3.22.3 -> 3.23.4 org.robolectric:robolectric 4.9.2 -> 4.10.3 com.google.truth:truth 1.0.1 -> 1.1.5 ``` |
||
|---|---|---|
| .. | ||
| src/main | ||
| README.md | ||
| build.gradle | ||
| pom.xml | ||
| settings.gradle | ||
README.md
gRPC Debug Example
The debug example uses a Hello World style server whose response includes its hostname. It demonstrates usage of the AdminInterface and the grpcdebug commandline tool.
The example requires grpc-java to already be built. You are strongly encouraged to check out a git release tag, since there will already be a build of grpc available. Otherwise, you must follow COMPILING.
Build the example
-
Optional: Build the hello-world-debug example client. See the examples README
-
Build the debuggable server and client. From the
grpc-java/examples/examples-debugdirectory run:
$ ../gradlew installDist
This creates the
scripts build/install/debug/bin/hostname-debuggable-server/bin/hostname-debuggable-server
that
runs the example.
To run the debug example, run:
$ ./build/install/debug/bin/hostname-debuggable-server/bin/hostname-debuggable-server
And in a different terminal window run the client.
Note: You can use the standard hello-world client with no debugging enabled and still see results on the server. However, if you want to get debug information about the client you need to run the hello-world-debuggable client.
Simple client
$ ../build/install/examples/bin/hello-world-client
debug enabled client
$ ./build/install/examples-debug/bin/hello-world-debuggable-client
Maven
If you prefer to use Maven:
-
Build the hello-world example client. See the examples README
-
Run in this directory:
$ mvn verify
$ # Run the server (from the examples-debug directory)
$ mvn exec:java -Dexec.mainClass=io.grpc.examples.debug.HostnameServer
$ # In another terminal run the client (from the examples directory)
$ cd ..
$ mvn exec:java -Dexec.mainClass=io.grpc.examples.helloworld.HelloWorldClient
Using grpcdebug
grpcdebug is a tool that has been created to access the metrics from the channelz and health services.
Installing the grpcdebug tool
The source code is located in a github project grpc-ecosystem/grpcdebug. You can either download [the latest built version] (https://github.com/grpc-ecosystem/grpcdebug/releases/latest) (recommended) or follow the README.md to build it yourself.
Running the grpcdebug tool
Usage
grpcdebug <target address> [flags] channelz <command> [argument]
| Command | Argument | Description |
|---|---|---|
| channel | <channel id or URL> | Display channel states in a human readable way. |
| channels | Lists client channels for the target application. | |
| server | <server ID> | Displays server state in a human readable way. |
| servers | Lists servers in a human readable way. | |
| socket | <socket ID> | Displays socket states in a human readable way. |
| subchannel | <id> | Display subchannel states in human readable way. |
Generally, you will start with either servers or channels and then work down
to the details
Getting overall server info
bin/grpcdebug/grpcdebug localhost:50051 channelz servers
This will show you the server ids with their activity
Server ID Listen Addresses Calls(Started/Succeeded/Failed) Last Call Started
2 [[::]:50051] 38/34/3 now
Getting details for a service
bin/grpcdebug/grpcdebug localhost:50051 channelz server 2
The output will include more communication details and will show socket ids for currently connected clients
Server Id: 2
Listen Addresses: [[::]:50051]
Calls Started: 33
Calls Succeeded: 29
Calls Failed: 3
Last Call Started: now
---
Socket ID Local->Remote Streams(Started/Succeeded/Failed) Messages(Sent/Received)
19 [::1]:50051->[::1]:39834 4/3/0 3/4
Displaying detailed info for a server side connection (socket)
bin/grpcdebug/grpcdebug localhost:50051 channelz socket 19
This will show a lot of gRPC internal information
Socket ID: 19
Address: [::1]:50051->[::1]:50094
Streams Started: 1
Streams Succeeded: 0
Streams Failed: 0
Messages Sent: 0
Messages Received: 1
Keep Alives Sent: 0
Last Local Stream Created:
Last Remote Stream Created: now
Last Message Sent Created:
Last Message Received Created: now
Local Flow Control Window: 65535
Remote Flow Control Window: 1048569
---
Socket Options Name Value
SO_LINGER [type.googleapis.com/grpc.channelz.v1.SocketOptionLinger]:{}
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#TCP_CORK false
WRITE_BUFFER_HIGH_WATER_MARK 65536
WRITE_BUFFER_LOW_WATER_MARK 32768
IP_TOS 0
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#TCP_KEEPCNT 9
SINGLE_EVENTEXECUTOR_PER_GROUP true
SO_SNDBUF 2626560
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#TCP_NOTSENT_LOWAT 0
WRITE_BUFFER_WATER_MARK WriteBufferWaterMark(low: 32768, high: 65536)
TCP_NODELAY true
SO_RCVBUF 131072
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#SO_BUSY_POLL 0
IP_TRANSPARENT false
SO_KEEPALIVE true
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#TCP_QUICKACK false
ALLOCATOR PooledByteBufAllocator(directByDefault: true)
TCP_FASTOPEN_CONNECT false
MESSAGE_SIZE_ESTIMATOR io.grpc.netty.shaded.io.netty.channel.DefaultMessageSizeEstimator@48d475b6
WRITE_SPIN_COUNT 16
SO_REUSEADDR true
CONNECT_TIMEOUT_MILLIS 30000
ALLOW_HALF_CLOSURE false
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#EPOLL_MODE EDGE_TRIGGERED
MAX_MESSAGES_PER_READ 16
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#TCP_KEEPIDLE 7200
AUTO_CLOSE true
io.grpc.netty.shaded.io.netty.channel.epoll.EpollChannelOption#TCP_KEEPINTVL 75
MAX_MESSAGES_PER_WRITE 2147483647
AUTO_READ true
TCP_MD5SIG null
RCVBUF_ALLOCATOR io.grpc.netty.shaded.io.netty.channel.AdaptiveRecvByteBufAllocator@360691a0
Displaying the list of gRPC client channels
Command
bin/grpcdebug/grpcdebug localhost:50051 channelz channels
Output
Channel ID Target State Calls(Started/Succeeded/Failed) Created Time
1 localhost:50051 READY 34/34/0
3 localhost:50051 READY 16/16/0
Note: If you have a simple server that doesn't use gRPC clients to contact other servers, then this table will be empty.
Displaying details of a gRPC client channel
Command
bin/grpcdebug/grpcdebug localhost:50051 channelz channel 3
Output
Channel ID: 3
Target: localhost:50051
State: READY
Calls Started: 16
Calls Succeeded: 16
Calls Failed: 0
Created Time:
---
Subchannel ID Target State Calls(Started/Succeeded/Failed) CreatedTime
10 [[[localhost/127.0.0.1:50051]/{}], [[localhost/0:0 READY 16/16/0
Displaying details of a gRPC client subchannel
Command
bin/grpcdebug/grpcdebug localhost:50051 channelz subchannel 10
Output
Subchannel ID: 10
Target: [[[localhost/127.0.0.1:50051]/{}], [[localhost/0:0:0:0:0:0:0:1:50051]/{}]]
State: READY
Calls Started: 16
Calls Succeeded: 16
Calls Failed: 0
Created Time:
---
Socket ID Local->Remote Streams(Started/Succeeded/Failed) Messages(Sent/Received)
11 127.0.0.1:48536->127.0.0.1:50051 16/16/0 12/12