Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6821444
feat(gapic): add OpenTelemetry T3 client method span wrapping
chalmerlowe Sep 3, 2026
32e763b
chore(gapic): remove _is_tracing_supported dummy class variable
chalmerlowe Sep 3, 2026
e6cc276
test(gapic): achieve 100% branch and statement coverage for OTel T3 m…
chalmerlowe Sep 4, 2026
99336ec
refactor(gapic): extract _extract_rpc_identity and add method_name to…
chalmerlowe Sep 8, 2026
b612dad
refactor(gapic): support custom tracer_provider and cache tracer in _…
chalmerlowe Sep 8, 2026
225a02e
feat(gapic): gate T3 method spans for HTTP transports and streaming RPCs
chalmerlowe Sep 8, 2026
4aded8d
refactor(gapic): use span_context_manager to guarantee single wrapped…
chalmerlowe Sep 8, 2026
9df74e6
test(gapic): update and expand unit tests for T3 method tracing refac…
chalmerlowe Sep 8, 2026
35ca839
refactor(gapic): simplify wrap_method with client_options and method_…
chalmerlowe Sep 8, 2026
685338e
feat(gapic): add explicit trace parameter to wrap_method
chalmerlowe Sep 8, 2026
6c3548d
refactor(gapic): replace trace with is_streaming in wrap_method
chalmerlowe Sep 8, 2026
3878df9
Removes line from docstring
chalmerlowe Sep 8, 2026
05f93d3
Update docstring re: streaming methods.
chalmerlowe Sep 8, 2026
d06fdd4
Update comment re: streaming
chalmerlowe Sep 8, 2026
5b787ff
refactor(gapic): refine exception handling for tracer resolution and …
chalmerlowe Sep 8, 2026
8f3a649
refactor(gapic): document graceful bypass of otel errors and remove p…
chalmerlowe Sep 8, 2026
249d62c
test(gapic): add rigorous assertions to negative and fallback tracing…
chalmerlowe Sep 8, 2026
136e4b7
test(gapic): refactor and deduplicate otel unit tests using fixture a…
chalmerlowe Sep 8, 2026
5e8e0ed
feat(gapic): add gcp.client.* attributes to T3 method span
chalmerlowe Sep 8, 2026
6115f83
test(gapic): use reusable constants for expected span attributes in o…
chalmerlowe Sep 8, 2026
b81cc31
test(gapic): consolidate async otel tests into test_method_async and …
chalmerlowe Sep 8, 2026
cfe5dd0
ci: temporarily exclude sqlalchemy-bigquery from package shards
chalmerlowe Sep 9, 2026
a20cac2
refactor(gapic): remove deferred gcp.client.* attributes
chalmerlowe Sep 10, 2026
f7dd27f
feat(gapic): update rpc attributes to modern semconv
chalmerlowe Sep 10, 2026
013cce8
feat(gapic): record rpc.response.status_code on method spans
chalmerlowe Sep 10, 2026
bd4f845
feat(gapic): extract and record gcp.errors attributes on method spans
chalmerlowe Sep 10, 2026
aca7aeb
fix(gapic): resolve _error_info and exception properties in _extract_…
chalmerlowe Sep 10, 2026
fe96bb4
fix(gapic): resolve mypy union-attr errors in status code and error a…
chalmerlowe Sep 10, 2026
c70fd27
test(gapic): achieve 100% test coverage for status code and error ext…
chalmerlowe Sep 10, 2026
e06de69
docs(gapic): document status code extraction locations and harmonize …
chalmerlowe Sep 10, 2026
ba70e1b
test(gapic): test uninstrumented exception propagation when span is None
chalmerlowe Sep 10, 2026
35b6483
docs(gapic): document error attribute extraction locations with struc…
chalmerlowe Sep 10, 2026
da54ee5
feat(gapic): gate Tier 3 method span creation on gRPC transport kind
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