Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bf90830
feat(gapic): add OpenTelemetry T3 client method span wrapping
chalmerlowe Sep 3, 2026
b654d82
chore(gapic): remove _is_tracing_supported dummy class variable
chalmerlowe Sep 3, 2026
3017e38
test(gapic): achieve 100% branch and statement coverage for OTel T3 m…
chalmerlowe Sep 4, 2026
46fd364
refactor(gapic): extract _extract_rpc_identity and add method_name to…
chalmerlowe Sep 8, 2026
afef29e
refactor(gapic): support custom tracer_provider and cache tracer in _…
chalmerlowe Sep 8, 2026
017a13b
feat(gapic): gate T3 method spans for HTTP transports and streaming RPCs
chalmerlowe Sep 8, 2026
5437b43
refactor(gapic): use span_context_manager to guarantee single wrapped…
chalmerlowe Sep 8, 2026
39c3dfd
test(gapic): update and expand unit tests for T3 method tracing refac…
chalmerlowe Sep 8, 2026
c9713a5
refactor(gapic): simplify wrap_method with client_options and method_…
chalmerlowe Sep 8, 2026
57a87ac
feat(gapic): add explicit trace parameter to wrap_method
chalmerlowe Sep 8, 2026
4b7ff50
refactor(gapic): replace trace with is_streaming in wrap_method
chalmerlowe Sep 8, 2026
b59e8c1
Removes line from docstring
chalmerlowe Sep 8, 2026
da10b4c
Update docstring re: streaming methods.
chalmerlowe Sep 8, 2026
41d98c5
Update comment re: streaming
chalmerlowe Sep 8, 2026
fb76ea6
refactor(gapic): refine exception handling for tracer resolution and …
chalmerlowe Sep 8, 2026
5d103cc
refactor(gapic): document graceful bypass of otel errors and remove p…
chalmerlowe Sep 8, 2026
8cecf5a
test(gapic): add rigorous assertions to negative and fallback tracing…
chalmerlowe Sep 8, 2026
fa25f3e
test(gapic): refactor and deduplicate otel unit tests using fixture a…
chalmerlowe Sep 8, 2026
f833167
feat(gapic): add gcp.client.* attributes to T3 method span
chalmerlowe Sep 8, 2026
59941bd
test(gapic): use reusable constants for expected span attributes in o…
chalmerlowe Sep 8, 2026
9a68e84
test(gapic): consolidate async otel tests into test_method_async and …
chalmerlowe Sep 8, 2026
60e5416
ci: temporarily exclude sqlalchemy-bigquery from package shards
chalmerlowe Sep 9, 2026
83e6aee
refactor(gapic): remove deferred gcp.client.* attributes
chalmerlowe Sep 10, 2026
f946661
feat(gapic): update rpc attributes to modern semconv
chalmerlowe Sep 10, 2026
6917251
feat(gapic): record rpc.response.status_code on method spans
chalmerlowe Sep 10, 2026
5229c8b
feat(gapic): extract and record gcp.errors attributes on method spans
chalmerlowe Sep 10, 2026
0e4c0b1
fix(gapic): resolve _error_info and exception properties in _extract_…
chalmerlowe Sep 10, 2026
7bd8db3
fix(gapic): resolve mypy union-attr errors in status code and error a…
chalmerlowe Sep 10, 2026
9219e2d
test(gapic): achieve 100% test coverage for status code and error ext…
chalmerlowe Sep 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 40 additions & 17 deletions ci/get_package_shards.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
"google-crc32c",
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

The change to get_package_shards is only a temp work-around to deal with the fact that sqlalchemy-bigquery was causing failing tests in this PR that are unrelated to the PR changes.
This will all be reverted prior to merge once we have a long-term solution in place for sqlalchemy-bigquery.

# Packages temporarily excluded from CI test execution.
# NOTE: 'sqlalchemy-bigquery' is temporarily excluded to allow testing in this PR
# to complete due to an upstream packaging issue in sqlalchemy (duplicate normalized
# extra name 'mssql-pymssql' under strict uv PEP 621 parsing in sqlalchemy==2.1.0rc2,
# pulled via global UV_PRERELEASE=allow). Awaiting team feedback on a long-term
# solution (e.g. package migration out of the monorepo or adjusting workflow settings).
EXCLUDED_PACKAGES = {
"sqlalchemy-bigquery",
}


def get_package_directories():
"""Parses package directory roots from the PACKAGE_DIRS environment variable.
Expand All @@ -56,7 +66,7 @@ def get_package_directories():
"""
env_dirs = os.environ.get("PACKAGE_DIRS", "")
if env_dirs:
dirs = [d.strip() for d in env_dirs.replace('\n', ' ').split(' ') if d.strip()]
dirs = [d.strip() for d in env_dirs.replace("\n", " ").split(" ") if d.strip()]
if dirs:
return dirs
return ["packages", "preview-packages"]
Expand Down Expand Up @@ -103,7 +113,9 @@ def get_packages(handwritten_only=False):
if not os.path.exists(subdir):
continue
for d in os.listdir(subdir):
full_path = os.path.join(subdir, d) + '/'
if d in EXCLUDED_PACKAGES:
continue
full_path = os.path.join(subdir, d) + "/"
if not os.path.isdir(full_path):
continue
if handwritten_only:
Expand All @@ -112,7 +124,10 @@ def get_packages(handwritten_only=False):
try:
with open(meta_file) as f:
data = json.load(f)
if isinstance(data, dict) and data.get("library_type") == "GAPIC_AUTO":
if (
isinstance(data, dict)
and data.get("library_type") == "GAPIC_AUTO"
):
continue
except Exception:
pass
Expand All @@ -130,24 +145,26 @@ def get_packages_to_test():
Returns:
dict: A dictionary mapping package_name -> list of relative directory paths to be tested.
"""
build_type = os.environ.get('BUILD_TYPE', 'presubmit')
target_branch = os.environ.get('TARGET_BRANCH', 'main')
test_all_packages = os.environ.get('TEST_ALL_PACKAGES', 'false').lower() == 'true'
build_type = os.environ.get("BUILD_TYPE", "presubmit")
target_branch = os.environ.get("TARGET_BRANCH", "main")
test_all_packages = os.environ.get("TEST_ALL_PACKAGES", "false").lower() == "true"

all_packages = get_packages()

if test_all_packages:
return all_packages

if build_type == 'presubmit':
if build_type == "presubmit":
git_diff_arg = f"origin/{target_branch}..."
elif build_type == 'continuous':
elif build_type == "continuous":
git_diff_arg = "HEAD~1.."
else:
return all_packages

try:
res = subprocess.check_output(['git', 'diff', '--name-only', git_diff_arg]).decode('utf-8')
res = subprocess.check_output(
["git", "diff", "--name-only", git_diff_arg]
).decode("utf-8")
changed_files = res.splitlines()
except subprocess.CalledProcessError:
# If change detection fails, fall back to all packages
Expand Down Expand Up @@ -220,7 +237,11 @@ def group_packages(packages_map):
for name, paths, weight in pkg_items:
# If adding this package would exceed target weight AND we haven't reached the
# shard limit, start a new shard. Otherwise, keep "stuffing" the current one.
if current_shard_items and (current_shard_weight + weight > target_weight) and len(shards_list) < max_shards - 1:
if (
current_shard_items
and (current_shard_weight + weight > target_weight)
and len(shards_list) < max_shards - 1
):
shards_list.append(current_shard_items)
current_shard_items = [(name, paths, weight)]
current_shard_weight = weight
Expand Down Expand Up @@ -250,13 +271,15 @@ def group_packages(packages_map):
for _, paths, _ in shard_items:
all_paths.extend(paths)

shards.append({
"name": name,
"index": index,
"description": desc,
"packages": " ".join(all_paths),
"is_sharded": True
})
shards.append(
{
"name": name,
"index": index,
"description": desc,
"packages": " ".join(all_paths),
"is_sharded": True,
}
)

# Set is_sharded dynamically based on the total number of shards
total_shards = len(shards)
Expand Down
Loading
Loading