Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Bigtable): add attempts headers on retry and exception logging #7428

Merged
merged 2 commits into from
Jun 21, 2024

Conversation

bshaffer
Copy link
Contributor

@bshaffer bshaffer commented Jun 18, 2024

This PR adds two visibility features to the Bigtable client in v0.221.0 (which will apply to google/cloud-bigtable: 1.28.3)

1. The bigtable-attempt header for retry attempts

If a retryable exception is thrown, and the Bigtable client retries the call, all additional attempts will contain the header/metadata bigtable-attempt, which will start with "1" for the first retry and increment from there

2. The logger option for BigtableClient

By setting a PSR3-compatible logging client, the BigtableClient class will log retryable or non-retryable exceptions which occur during the readRows stream

// create any PSR3-compatible logging client
$logger = new Monolog\Logger();

// pass it in when creating the bigtable client
$bigtable = new Google\Cloud\Bigtable\BigtableClient(['logger' => $logger]);

// Or pass it in when calling Table::ReadRows
$table = $bigtable->table($instanceId, $tableId);
$rows = $table->readRows(['logger' => $logger]);

Note: In the case of an exception, the exception message (e.g. $e->getMessage()) will be logged using LoggerInterface::error.

@bshaffer bshaffer requested review from a team as code owners June 18, 2024 18:06
@product-auto-label product-auto-label bot added the api: bigtable Issues related to the Bigtable API. label Jun 18, 2024
@bshaffer bshaffer merged commit 48fd79b into v0.221.0-patch Jun 21, 2024
19 checks passed
@bshaffer bshaffer deleted the v0.221.0-bigtable-visibility branch June 21, 2024 15:05
@bshaffer
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the Bigtable API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant