-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
examples: add gcp-observability examples #9967
Conversation
|
||
The GCP Observability example consists of a Hello World client and a Hello World server instrumented for logs, metrics and tracing. | ||
|
||
__Please refer to GCP observability user guide for setting up authorization to acess Google Cloud Platform with Google user credentials.__ |
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.
Can we provide a link to the UG? We have one for preview and it's not going to change for GA, right?
Also it will be good if the link is to the specific section about credentials and authorization
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 checked with Lisa, she is trying to get a new directory set up. In that case, UG link will be different than what we have now.
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.
Okay, we can go with the current link and update it whenever we have the updated link
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.
Updated and added current user guide link.
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.
Link is correct but the link text "GCP observability user guide" doesn't match it or is not even correct. The user guide says it is for "Microservices observability" - so we could at least say that. In reality the UG is for "gRPC GCP Observability" or "gRPC Microservices on GCP Observability" . "GCP Observability" is too broad.
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 removed the link, as the link is going to be changed when we release.
The product name is "Microservices Observability", should i add "gRPC Microservices Observability" instead here to show connection to gRPC (while we do not have a link). Let me know what you think.
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.
If you removed the link, make sure the description is as close to what the actual UG title is (since users will have to search to find it). I think it is "Microservices Observability" so that makes most sense.
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.
Done
...ty/src/main/java/io/grpc/examples/observabilityHelloWorld/ObservabilityHelloWorldClient.java
Outdated
Show resolved
Hide resolved
...ty/src/main/java/io/grpc/examples/observabilityHelloWorld/ObservabilityHelloWorldClient.java
Outdated
Show resolved
Hide resolved
String.format( | ||
"Sleeping %d seconds before shutdown to ensure all records are flushed.", | ||
EXPORT_INTERVAL)); | ||
Thread.sleep(TimeUnit.MILLISECONDS.convert(EXPORT_INTERVAL, TimeUnit.SECONDS)); |
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.
If a sleep is still necessary, we should have that sleep in gcp-observability. The user shouldn't have to deal with stuff like this. Once we fix the issue the user's shutdown would naturally run faster.
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.
Agree, will add sleep to gcp-observability in a follow up PR.
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.
Added in PR #9972
examples/example-gcp-observability/src/main/proto/helloworld/helloworld.proto
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.
Added a bunch of comments. Will take a look again once addressed
…or client and server
Addressed comments. @sanjaypujare PTAL. |
*/ | ||
public static void main(String[] args) throws IOException, InterruptedException { | ||
// Initialize observability | ||
GcpObservability observability = GcpObservability.grpcInit(); |
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.
Shall we do?
try(observability) {
} finally {
WaitUntilShutdown();
}
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.
Do you mean
try (observability) {
final GcpObservabilityServer server = new GcpObservabilityServer();
} finally {
server.blockUntilShutdown();
}
In this case, server being a non-static
variable cannot be accessed in a static method. Server needs to be created after initializing observability within the try block.
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.
In the above code server
is not in scope in the finally clause ...
{ | ||
"cloud_monitoring": {}, | ||
"cloud_trace": { | ||
"sampling_rate": 1.00 |
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.
1.0
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.
Done
...ty/src/main/resources/io/grpc/examples/gcpobservability/gcp_observability_client_config.json
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.
I have some comments and it will be nice to address them but looks good so okay to merge without them too.
* add examples for gcp-observability
* examples: add gcp-observability examples (#9967)
* add examples for gcp-observability
* add examples for gcp-observability
This PR adds
gcp-observability
example based onHelloWorld
.CC @sanjaypujare @ejona86 @fengli79