-
Notifications
You must be signed in to change notification settings - Fork 72
chore: PoC for App Centric metrics #4110
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @blakeli0, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request implements a proof-of-concept for application-centric metrics within GAX-Java, leveraging OpenTelemetry. The primary goal is to provide more detailed and standardized observability into client request durations and outcomes. This involves introducing a new metrics recorder and updating existing tracing components to use consistent attribute naming conventions, ensuring that critical operational data is captured and made available for monitoring and analysis. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces an AppCentricMetricsRecorder as a proof-of-concept for app-centric metrics. It also updates some metric attribute names to align with OpenTelemetry conventions and adds a new integration test suite.
My review has identified a couple of issues:
- There's a unit mismatch in
AppCentricMetricsRecorderwhere latency in milliseconds is recorded for a metric with units of seconds. - The new integration test
ITAppCentricMetricsseems to contain incorrect logic, as it appears to be testing for metrics produced by a different recorder (OpenTelemetryMetricsRecorder) and makes wrong assumptions about howAppCentricMetricsRecorderworks.
Please see the detailed comments for suggestions on how to address these points.
| * via {@link #verifyStatusAttribute(List, List)}. Finally, check that the status for each attempt | ||
| * is correct. | ||
| */ | ||
| class ITAppCentricMetrics { |
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.
The test logic in this class appears to be based on OpenTelemetryMetricsRecorder rather than AppCentricMetricsRecorder, leading to incorrect assertions. AppCentricMetricsRecorder only records a single metric gcp.client.request.duration once per operation.
Specifically:
verifyPointDataSumchecks for metrics that are not produced (ShowcaseTest/operation_latency,ShowcaseTest/attempt_latency). It should be verifyinggcp.client.request.duration.verifyStatusAttributeincorrectly assumes that a metric point is recorded for each attempt. It should verify only the single final status of the whole operation. For example, intestGrpc_multipleFailedAttempts_successfulOperation, only a single point with statusOKwill be recorded.- Several constants like
ATTEMPT_LATENCY,OPERATION_LATENCY,GAX_METRICS, andNUM_GAX_OTEL_METRICSare unused or related to the old logic and should be removed.
The test class needs to be revised to correctly test the behavior of AppCentricMetricsRecorder. This involves updating the verification methods to check for the gcp.client.request.duration metric and its properties (e.g., single data point per operation, correct final status).
| */ | ||
| @Override | ||
| public void recordOperationLatency(double operationLatency, Map<String, String> attributes) { | ||
| requestDurationRecorder.record(operationLatency, toOtelAttributes(attributes)); |
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.
There is a unit mismatch here. The Javadoc for operationLatency on line 74 specifies the unit as milliseconds (ms), but the requestDurationRecorder histogram is configured with seconds (s) as its unit on line 66. The value is being recorded without conversion.
This will lead to incorrect metric values (e.g., a latency of 100ms will be recorded as 100s).
Please convert the latency to seconds before recording.
| requestDurationRecorder.record(operationLatency, toOtelAttributes(attributes)); | |
| requestDurationRecorder.record(operationLatency / 1000.0, toOtelAttributes(attributes)); |
No description provided.