feat(google-cloud-serverless)!: Use http.client span op for GCP HTTP requests - #22660
Conversation
size-limit report 📦
|
a754190 to
7715393
Compare
c3bf82c to
a7369f4
Compare
7715393 to
4db7b2b
Compare
a7369f4 to
c40f643
Compare
163c51e to
86a9875
Compare
…P requests The endpoint-derived suffix fragmented grouping and was unbounded for non-`googleapis.com` endpoints. Service identity moves to the `server.address` attribute; `http.request.method` is now set as well. Ref: JS-3105 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
86a9875 to
7a82c49
Compare
| function getServerAddress(apiEndpoint: string): string { | ||
| const url = parseStringToURLObject(apiEndpoint); | ||
| return url && !isURLObjectRelative(url) ? url.host : apiEndpoint; |
There was a problem hiding this comment.
Bug: The code uses url.host to set the SERVER_ADDRESS attribute, which can incorrectly include the port number, violating OpenTelemetry semantic conventions.
Severity: LOW
Suggested Fix
To ensure compliance with OpenTelemetry conventions and maintain consistency within the codebase, change url.host to url.hostname. This will correctly extract only the hostname from the URL, excluding any port number.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: packages/google-cloud-serverless/src/integrations/google-cloud-http.ts#L77-L79
Potential issue: The code uses `url.host` to populate the `SERVER_ADDRESS` OpenTelemetry
attribute. According to OpenTelemetry semantic conventions, `server.address` should only
contain the hostname, with the port stored in a separate `server.port` attribute. Using
`url.host` can include the port if a non-standard port is present in the URL. While this
is unlikely with standard Google Cloud API endpoints, it violates the specification and
is inconsistent with other parts of the codebase that correctly use `url.hostname`. This
could lead to incorrect telemetry data in environments using custom endpoints with
non-standard ports.
Did we get this right? 👍 / 👎 to inform future reviews.
006b1d0 to
a747a97
Compare
a747a97 to
75e0096
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 75e0096. Configure here.

Use
http.clientinstead ofhttp.client.<service>ingoogleCloudHttpIntegration. The service is now identified by the newserver.addressattribute. Also addedhttp.request.method.Part of #22446