From 2bc0cc02512274cd801b6e83dac4d81093f81f8d Mon Sep 17 00:00:00 2001 From: Josh Radcliff Date: Mon, 19 Oct 2026 15:49:32 -0400 Subject: [PATCH] feat(samples): set max gRPC metadata size to 16MB in ingestion samples Configures IngestionServiceClient with a 16MB maximum metadata size to accommodate responses with large error details, and adds the `create_client` region tag. Change-Id: Ic8302600ef27c5a4d90542b35af2a8c9bec68072 --- samples/audiences/ingest_audience_members.php | 15 +++++++++++++-- samples/events/ingest_events.php | 13 ++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/samples/audiences/ingest_audience_members.php b/samples/audiences/ingest_audience_members.php index 688af87..3184901 100644 --- a/samples/audiences/ingest_audience_members.php +++ b/samples/audiences/ingest_audience_members.php @@ -227,8 +227,19 @@ function main( // Sets validate_only to true to validate but not apply the changes in the request. ->setValidateOnly(true); - // Creates a client for the ingestion service. - $client = new IngestionServiceClient(); + // [START create_client] + // Creates a client for the ingestion service. Increases the maximum metadata size to 16MB to + // prevent RESOURCE_EXHAUSTED errors when responses contain large error details. + $client = new IngestionServiceClient([ + 'transportConfig' => [ + 'grpc' => [ + 'stubOpts' => [ + 'grpc.max_metadata_size' => 16 * 1024 * 1024, + ], + ], + ], + ]); + // [END create_client] try { // Logs the request. echo "Request:\n" . json_encode(json_decode($request->serializeToJsonString()), JSON_PRETTY_PRINT) . "\n"; diff --git a/samples/events/ingest_events.php b/samples/events/ingest_events.php index 2527657..a181dc9 100644 --- a/samples/events/ingest_events.php +++ b/samples/events/ingest_events.php @@ -190,7 +190,18 @@ function main( ->setAccountId($linkedAccountId)); } - $client = new IngestionServiceClient(); + // Creates a client for the ingestion service. Increases the maximum metadata size to 16MB to + // prevent RESOURCE_EXHAUSTED errors when responses contain large error details. + $client = new IngestionServiceClient([ + 'transportConfig' => [ + 'grpc' => [ + 'stubOpts' => [ + 'grpc.max_metadata_size' => 16 * 1024 * 1024, + ], + ], + ], + ]); + try { $requestCount = 0; // Batches requests to send up to the maximum number of events per request.