-
Notifications
You must be signed in to change notification settings - Fork 146
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
Implement generic grpc handlers #4295
Conversation
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Codecov ReportBase: 0.00% // Head: 96.45% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #4295 +/- ##
==============================================
+ Coverage 0 96.45% +96.45%
- Complexity 0 15029 +15029
==============================================
Files 0 1010 +1010
Lines 0 42810 +42810
Branches 0 4338 +4338
==============================================
+ Hits 0 41294 +41294
- Misses 0 764 +764
- Partials 0 752 +752
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
I think the exact names of the metrics are important for the Elastic ingest pipelines; but not an urgent concern.
There may be a version conflict with the |
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.
LGTM!
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.
LGTM ! Few Javadocs missing and have a question on TODOs
.
hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/QueryHandler.java
Show resolved
Hide resolved
hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/TransactionHandler.java
Show resolved
Hide resolved
hedera-node/hedera-app/src/main/java/com/hedera/node/app/SessionContext.java
Outdated
Show resolved
Hide resolved
...node/hedera-app/src/main/java/com/hedera/node/app/workflows/prehandle/PreHandleWorkflow.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.
Overall looks great!! Just a couple small comments
hedera-node/hedera-app/src/test/java/com/hedera/node/app/grpc/QueryMethodTest.java
Show resolved
Hide resolved
hedera-node/hedera-app/src/main/java/com/hedera/node/app/workflows/ingest/IngestWorkflow.java
Show resolved
Hide resolved
hedera-node/hedera-app/src/test/java/com/hedera/node/app/grpc/TransactionMethodTest.java
Show resolved
Hide resolved
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Signed-off-by: Richard Bair <[email protected]>
Yay, grpc package has 100% Line, Method, and Class coverage :-). There is one case that is only covered in integration tests, which bothers me, and I don't have any tests for metrics. I will add the tests for metrics with issue #4293 |
Signed-off-by: Richard Bair <[email protected]>
OK, added the test case that bothered me. Sonar is still going to complain because I didn't add tests for |
Signed-off-by: Richard Bair <[email protected]>
SonarCloud Quality Gate failed. |
// Use when you need logging | ||
bundle("logging", listOf("log4j-api", "log4j-core")) | ||
bundle("logging", listOf("log4j-api", "log4j-core", "log4j-slf4j", "slf4j-api")) |
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.
I would not define a logging bundle that contains all this dependencies since some should not be available at compiletime.
From my point of view we should only have a completive dependency to slf4j-api
in all new modules. log4j-slf4j
and log4j-api
/ log4j-core
should be defined as runtime-only dependencies.
I assume we have the same problem with some other bundles. That's why I'm not a fan of bundles: You can not do the compile / runtime split.
@@ -59,6 +64,9 @@ extraJavaModuleInfo { | |||
automaticModule("io.prometheus:simpleclient_httpserver", "io.prometheus.simpleclient.httpserver") | |||
|
|||
automaticModule("j2objc-annotations-1.3.jar", "j2objc.annotations") | |||
automaticModule("io.perfmark:perfmark-api", "perfmark.api") |
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.
io.perfmark:perfmark-api:0.26.0
defines io.perfmark
as automatic module name. We should use the same.
automaticModule("io.perfmark:perfmark-api", "perfmark.api") | |
automaticModule("io.perfmark:perfmark-api", "io.perfmark") |
@@ -59,6 +64,9 @@ extraJavaModuleInfo { | |||
automaticModule("io.prometheus:simpleclient_httpserver", "io.prometheus.simpleclient.httpserver") | |||
|
|||
automaticModule("j2objc-annotations-1.3.jar", "j2objc.annotations") | |||
automaticModule("io.perfmark:perfmark-api", "perfmark.api") | |||
|
|||
automaticModule("org.eclipse.microprofile.health:microprofile-health-api", "microprofile.health.api") |
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.
ARHG! Unbelievable that such project does not have at least an automatic module name. Created an issue: microprofile/microprofile-health#322
@@ -30,6 +30,11 @@ extraJavaModuleInfo { | |||
|
|||
automaticModule("io.grpc:grpc-api", "io.grpc.api") | |||
automaticModule("io.grpc:grpc-netty", "io.grpc.netty") | |||
automaticModule("io.grpc:grpc-stub", "grpc.stub") |
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.
protocolbuffers/protobuf#11005 created
@@ -21,4 +21,9 @@ description = "Hedera Application - SPI" | |||
|
|||
dependencies { | |||
implementation(libs.hapi) | |||
implementation(libs.jsr305.annotation) |
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.
compileOnly should be used
* @return A reference to the builder. | ||
*/ | ||
public @Nonnull GrpcServiceBuilder query(@Nonnull String methodName) { | ||
if (Objects.requireNonNull(methodName).isBlank()) { |
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.
should we use the helper methods of the platform commons module for such checks? Still do not now if we want to expose such functionality in the platform or recreate it in the services.
@Nonnull String serviceName, | ||
@Nonnull IngestWorkflow ingestWorkflow, | ||
@Nonnull QueryWorkflow queryWorkflow) { | ||
this.ingestWorkflow = Objects.requireNonNull(ingestWorkflow); |
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.
I like to do such runtime null checks next to the compiletime annotation checks. Why should define this as best practice since I've seen several places in the code that does not do such checks
* Create a new instance. | ||
* | ||
* @param serviceName a non-null reference to the service name | ||
* @param methodName a non-null reference to the method name |
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.
metrics param is missing
public void invoke( | ||
@Nonnull ByteBuffer requestBuffer, | ||
@Nonnull StreamObserver<ByteBuffer> responseObserver) { | ||
try { |
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.
Nullcheck for responseObserver is missing
requires io.helidon.webserver.http2; | ||
requires io.helidon.grpc.server; | ||
requires io.helidon.grpc.core; | ||
requires jsr305; |
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.
requires jsr305; | |
requires static jsr305; |
The classes defined in this PR are pretty close to production ready and represent a best-effort at how to do this properly. Please review carefully:
hedera-app
module (mono-service is not a proper module today)This implementation is plumbed into IngestWorkflow and QueryWorkflow, but both those workflows are no-ops at the moment (implemented by different issues). As such, this code doesn't actually do anything yet, other than parse incoming bytes and returning empty bytes.