Skip to content

impl(rust): Add PathTemplate method for URL templates#2231

Merged
westarle merged 2 commits intogoogleapis:mainfrom
westarle:feat/rust-path-template-method
Sep 19, 2025
Merged

impl(rust): Add PathTemplate method for URL templates#2231
westarle merged 2 commits intogoogleapis:mainfrom
westarle:feat/rust-path-template-method

Conversation

@westarle
Copy link
Copy Markdown
Contributor

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

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.68%. Comparing base (c3c71af) to head (37f44ba).
⚠️ Report is 1 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@westarle westarle marked this pull request as ready for review September 18, 2025 19:19
@westarle westarle requested a review from a team September 18, 2025 19:19
coryan
coryan previously approved these changes Sep 18, 2025
dbolduc
dbolduc previously approved these changes Sep 18, 2025
@westarle westarle dismissed stale reviews from dbolduc and coryan via b6eff21 September 18, 2025 21:07
@westarle westarle force-pushed the feat/rust-path-template-method branch from b6eff21 to 37f44ba Compare September 19, 2025 11:10
@westarle westarle merged commit 8305885 into googleapis:main Sep 19, 2025
7 of 10 checks passed
@westarle
Copy link
Copy Markdown
Contributor Author

e2e-test failing at head

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants