Repository navigation
refactor(gapic-generator): align telemetry compliance matrix and test engine with tidy data - #18852
Merged
Merged
Conversation
… engine with tidy data
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the telemetry requirements matrix and span compliance tests to adhere to Tidy Data guidelines. The requirements matrix has been restructured into atomic rows, and the test engine has been simplified by removing the complex cell grammar parser in favor of direct assertions on target spans. Additionally, retry exhaustion tests now use a deterministic attempt count and an error hook. Feedback is provided regarding a potential ValueError in the resend count assertion if the expected value is 'N/A'.
…ned parametrization
chalmerlowe
commented
Oct 26, 2026
chalmerlowe
commented
Oct 26, 2026
chalmerlowe
commented
Oct 26, 2026
chalmerlowe
commented
Oct 26, 2026
chalmerlowe
commented
Oct 26, 2026
chalmerlowe
commented
Oct 26, 2026
chalmerlowe
marked this pull request as ready for review
October 26, 2026 16:11
daniel-sanche
approved these changes
Oct 26, 2026
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.
Problem
In the OpenTelemetry system compliance suite (
packages/gapic-generator/tests/system/), the requirements matrix (telemetry_requirements_matrix.csv) previously grouped an entire remote procedure call (RPC) scenario into a single row, even when that call produced multiple spans across different layers or retry attempts.Because a single row had to describe up to three spans at once, individual cells packed multiple values together using custom formatting rules:
T3) and inner network attempt spans (Tier 4, orT4) in the same cell (for example,T3: CLIENT | T4: CLIENT).503 | 200orERROR | OK).N + 1).To read these combined cells,
test_span_compliance.pyhad to maintain a custom string parser (resolve_expected_value) and pass tier and attempt indices through every assertion helper. In addition, retry exhaustion tests relied on a short wall-clock timer racing against random retry sleep intervals, which meant the number of spans produced could vary from run to run.Solution
This pull request refactors the requirements matrix and test engine to follow tidy data principles, where each row represents a single test for one specific span and each column holds a single value:
One Row per Span Assertion (
telemetry_requirements_matrix.csv):Attemptcolumn (0or1for active spans,N/Awhen tracing is disabled) to identify which span is being tested.F1.5,F1.10, andF3.1throughF3.4) into separate row variants (for example,F3.1afor theT3root span,F3.1bfor the firstT4network attempt, andF3.1cfor the secondT4network attempt), expanding the matrix from 22 compound rows to 32 single-span rows.N + 1expressions with exact integer counts inSpan Count(0,1, or2).Simplified Compliance Test Engine (
test_span_compliance.py):resolve_expected_valueparser and simplified all attribute assertion helpers to compare each span attribute directly against its cell value._assert_parent_span_idso theparent_span_idcolumn (None (Root)orT3.span_id) is validated directly from the CSV matrix.run_sequence_retry_callto make retry exhaustion scenarios deterministic: the test configures twoUNAVAILABLEresponses on the Showcase server and uses the retry policy'son_errorcallback to exceed the retry deadline on the second failure. This guarantees thatgoogle.api_core.retry.RetryraisesRetryErrorafter exactly two network attempts without timing flakiness.Notes for Reviewers
packages/gapic-generator/tests/system/. No runtime library or code generation templates are modified.T3andT4assertions now live in separate rows, executing aT4row still runs the full client call and captures both theT3root span andT4child spans in memory. This allowsT4rows withparent_span_id = T3.span_idto continue verifying that every child attempt span links to the parentT3span ID.