Conversation
This PR enhances the OpenTelemetry integration for HTTP JSON transports to explicitly unpack and record the `http.response.body.size` attributes globally inside `google-cloud-java`. * Safeguarded Extractions: Solidified `extractContentLength` in both `SpanTracer` and `TestApiTracer` to parse `List`-type strings safely and silently skip payload sizes when chunked serialization omits `Content-Length` headers entirely! * True-Positive Validation Mappings: In `ITOtelTracing`, cleanly simulates exception routing natively while introducing algorithmic boundary estimations `isAtLeast(expectedMagnitude * 0.85)` using actual `Message` object size fingerprints.
Summary of ChangesHello, 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 significantly improves the OpenTelemetry integration for HTTP JSON transports by introducing the Highlights
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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request implements tracing for HTTP JSON calls, specifically to record the response body size. This involves adding ApiTracer support to HttpJsonCallOptions and HttpJsonCallContext, updating HttpJsonClientCallImpl to report response headers to the tracer, and enhancing ApiTracer and SpanTracer to process Content-Length from response headers. New tests were added to verify this functionality. Feedback includes addressing code duplication in the extractContentLength method, correcting a flawed test case in SpanTracerTest for bad Content-Length formats, and improving the robustness of a test in ITOtelTracing by asserting the presence of the http.response.body.size attribute.
...a/gax-java/gax-httpjson/src/test/java/com/google/api/gax/httpjson/testing/TestApiTracer.java
Show resolved
Hide resolved
sdk-platform-java/gax-java/gax/src/test/java/com/google/api/gax/tracing/SpanTracerTest.java
Show resolved
Hide resolved
...java-showcase/gapic-showcase/src/test/java/com/google/showcase/v1beta1/it/ITOtelTracing.java
Outdated
Show resolved
Hide resolved
…x/tracing/SpanTracerTest.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Description
This PR enhances the OpenTelemetry integration for HTTP JSON transports to explicitly unpack and record the
http.response.body.sizeattributes globally insidegoogle-cloud-java.Key Enhancements:
extractContentLengthin bothSpanTracerandTestApiTracerto parseList-type strings safely and silently skip payload sizes when chunked serialization omitsContent-Lengthheaders entirely!ITOtelTracing, cleanly simulates exception routing natively while introducing algorithmic boundary estimationsisAtLeast(expectedMagnitude * 0.85)using actualMessageobject size fingerprints.Testing Instructions
SpanTracerTest.javaITOtelTracingin showcase to test true-positive generation bounding.