Repository navigation
feat: update API sources and regenerate - #20873
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces several updates across multiple Google Cloud client libraries, including the addition of the Search service in Chronicle, a new Reporting service in Data Manager, a ListNodes method in Hypercompute Cluster, and Instance IAM/Update operations in Cloud Run. Feedback is provided for the Cloud Run client, where the extraction of the routing header 'location' from the instance name in UpdateInstance uses an expensive regular expression. It is recommended to replace this regex with a simpler, allocation-free substring extraction using strings.Index to optimize performance on this per-RPC hot path.
| if reg := regexp.MustCompile("projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?"); reg.MatchString(req.GetInstance().GetName()) && len(url.QueryEscape(reg.FindStringSubmatch(req.GetInstance().GetName())[1])) > 0 { | ||
| routingHeadersMap["location"] = url.QueryEscape(reg.FindStringSubmatch(req.GetInstance().GetName())[1]) | ||
| } |
There was a problem hiding this comment.
Performance Optimization
On performance-critical hot paths, such as per-RPC routing header extraction, we should avoid using expensive regular expressions or allocating string manipulation functions. Instead, we can use simpler, allocation-free alternatives like strings.Index to extract the location substring from the instance name.
This avoids both the regex compilation overhead and the runtime allocations of regex matching.
| if reg := regexp.MustCompile("projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?"); reg.MatchString(req.GetInstance().GetName()) && len(url.QueryEscape(reg.FindStringSubmatch(req.GetInstance().GetName())[1])) > 0 { | |
| routingHeadersMap["location"] = url.QueryEscape(reg.FindStringSubmatch(req.GetInstance().GetName())[1]) | |
| } | |
| name := req.GetInstance().GetName() | |
| if locIdx := strings.Index(name, "/locations/"); locIdx != -1 { | |
| start := locIdx + len("/locations/") | |
| end := strings.IndexByte(name[start:], '/') | |
| var location string | |
| if end == -1 { | |
| location = name[start:] | |
| } else { | |
| location = name[start : start+end] | |
| } | |
| if len(location) > 0 { | |
| routingHeadersMap["location"] = url.QueryEscape(location) | |
| } | |
| } |
References
- On performance-critical hot paths, such as per-RPC attempts, avoid using allocating string manipulation functions like strings.Split if simpler, allocation-free alternatives like strings.LastIndex can be used to extract substrings.
| if reg := regexp.MustCompile("projects/[^/]+/locations/(?P<location>[^/]+)(?:/.*)?"); reg.MatchString(req.GetInstance().GetName()) && len(url.QueryEscape(reg.FindStringSubmatch(req.GetInstance().GetName())[1])) > 0 { | ||
| routingHeadersMap["location"] = url.QueryEscape(reg.FindStringSubmatch(req.GetInstance().GetName())[1]) | ||
| } |
There was a problem hiding this comment.
Performance Optimization
On performance-critical hot paths, such as per-RPC routing header extraction, we should avoid using expensive regular expressions or allocating string manipulation functions. Instead, we can use simpler, allocation-free alternatives like strings.Index to extract the location substring from the instance name.
This avoids both the regex compilation overhead and the runtime allocations of regex matching.
name := req.GetInstance().GetName()
if locIdx := strings.Index(name, "/locations/"); locIdx != -1 {
start := locIdx + len("/locations/")
end := strings.IndexByte(name[start:], '/')
var location string
if end == -1 {
location = name[start:]
} else {
location = name[start : start+end]
}
if len(location) > 0 {
routingHeadersMap["location"] = url.QueryEscape(location)
}
}References
- On performance-critical hot paths, such as per-RPC attempts, avoid using allocating string manipulation functions like strings.Split if simpler, allocation-free alternatives like strings.LastIndex can be used to extract substrings.
|
Here is the summary of changes. You are about to add 31 region tags.
This comment is generated by snippet-bot.
|
🤖 I have created a release *beep* *boop* --- <details><summary>auth: 0.24.4</summary> ## [0.24.4](auth/v0.24.3...auth/v0.24.4) (2026-11-09) ### Bug Fixes * **auth/grpctransport:** Use TLS for DirectPath over Interconnect channels ([#20771](#20771)) ([39436d1](39436d1)) * **auth:** Use JWT exp claim for ID token expiry ([#20859](#20859)) ([726bdb3](726bdb3)), refs [#20839](#20839) </details> <details><summary>ces: 1.7.0</summary> ## [1.7.0](ces/v1.6.0...ces/v1.7.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>datamanager: 1.9.0</summary> ## [1.9.0](datamanager/v1.8.1...datamanager/v1.9.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>dataplex: 1.39.0</summary> ## [1.39.0](dataplex/v1.38.1...dataplex/v1.39.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>discoveryengine: 1.38.0</summary> ## [1.38.0](discoveryengine/v1.37.0...discoveryengine/v1.38.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>geminidataanalytics: 1.9.0</summary> ## [1.9.0](geminidataanalytics/v1.8.0...geminidataanalytics/v1.9.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>hypercomputecluster: 1.4.0</summary> ## [1.4.0](hypercomputecluster/v1.3.1...hypercomputecluster/v1.4.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>kms: 1.37.0</summary> ## [1.37.0](kms/v1.36.1...kms/v1.37.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>memorystore: 1.9.0</summary> ## [1.9.0](memorystore/v1.8.0...memorystore/v1.9.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>networkmanagement: 1.34.0</summary> ## [1.34.0](networkmanagement/v1.33.0...networkmanagement/v1.34.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>run: 1.25.0</summary> ## [1.25.0](run/v1.24.1...run/v1.25.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>sql: 0.7.0</summary> ## [0.7.0](sql/v0.6.0...sql/v0.7.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> <details><summary>vectorsearch: 1.7.0</summary> ## [1.7.0](vectorsearch/v1.6.1...vectorsearch/v1.7.0) (2026-11-09) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [2.9.0](pubsub/v2.8.1...pubsub/v2.9.0) (2026-11-10) ### Features * Update API sources and regenerate ([#20873](#20873)) ([3ded070](3ded070)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Update googleapis sources to 5adfa535e19786ded0e87ab1c4cf2bece46741bc and regenerate all libraries.
Debug Info
System Details
Commands Executed
go run github.com/googleapis/librarian/cmd/librarian@v0.52.0 update sources.googleapisgo run github.com/googleapis/librarian/cmd/librarian@v0.52.0 installgo run github.com/googleapis/librarian/cmd/librarian@v0.52.0 generate --allgo run github.com/googleapis/librarian/cmd/librarian@v0.52.0 tidygit add .git commit -m "feat: update API sources and regenerate"Included googleapis CLs
google/ads/datamanager/v1
google/cloud/ces/v1
google/cloud/chronicle/v1
google/cloud/dataplex/v1
google/cloud/discoveryengine/v1
google/cloud/geminidataanalytics/v1
google/cloud/geminidataanalytics/v1beta
google/cloud/hypercomputecluster/v1beta
google/cloud/kms/v1
google/cloud/memorystore/v1
google/cloud/networkmanagement/v1
google/cloud/run/v2
google/cloud/sql/v1
google/cloud/sql/v1beta4
google/cloud/vectorsearch/v1
google/pubsub/v1