impl(rust): Add PathTemplate method for URL templates#2231
Merged
westarle merged 2 commits intogoogleapis:mainfrom Sep 19, 2025
Merged
impl(rust): Add PathTemplate method for URL templates#2231westarle merged 2 commits intogoogleapis:mainfrom
westarle merged 2 commits intogoogleapis:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2231 +/- ##
==========================================
+ Coverage 83.66% 83.68% +0.02%
==========================================
Files 93 93
Lines 9445 9457 +12
==========================================
+ Hits 7902 7914 +12
Misses 1195 1195
Partials 348 348 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
coryan
previously approved these changes
Sep 18, 2025
dbolduc
previously approved these changes
Sep 18, 2025
dbolduc
approved these changes
Sep 18, 2025
b6eff21 to
37f44ba
Compare
coryan
approved these changes
Sep 19, 2025
Contributor
Author
catchyzheng
pushed a commit
that referenced
this pull request
Sep 22, 2025
This commit introduces a PathTemplate() method to the
pathBindingAnnotation in the Rust code generator. This method is
necessary to generate low-cardinality URL templates for OpenTelemetry
tracing (e.g. "GET /v1/{name}/databases")
The PathTemplate() method converts the internal path format (e.g.,
/v1/{name=projects/*/locations/*}/databases) into a format suitable for
the url.template attribute in OpenTelemetry spans (e.g.,
/v1/{name}/databases), as per
the semantic conventions. This involves replacing the complex segment
matches with simple variable placeholders.
This change is the first step in providing the necessary request-level
information from the generated code to the google-cloud-rust HTTP client
for enhanced tracing.
See also googleapis/google-cloud-rust#3346
See also googleapis/google-cloud-rust#3239
For #2212
lqiu96
pushed a commit
that referenced
this pull request
Sep 23, 2025
This commit introduces a PathTemplate() method to the
pathBindingAnnotation in the Rust code generator. This method is
necessary to generate low-cardinality URL templates for OpenTelemetry
tracing (e.g. "GET /v1/{name}/databases")
The PathTemplate() method converts the internal path format (e.g.,
/v1/{name=projects/*/locations/*}/databases) into a format suitable for
the url.template attribute in OpenTelemetry spans (e.g.,
/v1/{name}/databases), as per
the semantic conventions. This involves replacing the complex segment
matches with simple variable placeholders.
This change is the first step in providing the necessary request-level
information from the generated code to the google-cloud-rust HTTP client
for enhanced tracing.
See also googleapis/google-cloud-rust#3346
See also googleapis/google-cloud-rust#3239
For #2212
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces a PathTemplate() method to the pathBindingAnnotation in the Rust code generator. This method is necessary to generate low-cardinality URL templates for OpenTelemetry tracing (e.g. "GET /v1/{name}/databases")
The PathTemplate() method converts the internal path format (e.g., /v1/{name=projects//locations/}/databases) into a format suitable for the url.template attribute in OpenTelemetry spans (e.g., /v1/{name}/databases), as per
the semantic conventions. This involves replacing the complex segment matches with simple variable placeholders.
This change is the first step in providing the necessary request-level information from the generated code to the google-cloud-rust HTTP client for enhanced tracing.
See also googleapis/google-cloud-rust#3346
See also googleapis/google-cloud-rust#3239
For #2212