Skip to content

Commit

Permalink
pass interface name to context prop handlers
Browse files Browse the repository at this point in the history
Summary: "Service Interface" is already passed in by the TClientEventHandler. This diff passes that information to the ContextPropV2 handlers. This will allow us to use the exact same string identifier for the XID in both the Async PZ handler and the propagation handler.

Reviewed By: zhonglowu2

Differential Revision: D68980420

fbshipit-source-id: eca052b1f1180ac070efe7793feded8492f4e9ac
  • Loading branch information
Nathan Maue authored and facebook-github-bot committed Feb 5, 2025
1 parent fe32127 commit 6a410ca
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
?'fn_name' => string,
?'fn_args' => mixed,
?'fn_sequence_id' => ?int,
?'service_interface' => string,
);

final class TContextPropV2ClientHandler extends TClientEventHandler {
Expand All @@ -29,7 +30,7 @@ public function preSend(
string $fn_name,
mixed $args,
int $sequence_id,
?string $_service_interface = null,
string $service_interface,
): void {
try {
// set params
Expand All @@ -45,6 +46,7 @@ public function preSend(
$full_params['fn_name'] = $fn_name;
$full_params['fn_args'] = $args;
$full_params['fn_sequence_id'] = $sequence_id;
$full_params['service_interface'] = $service_interface;

// call handlers
foreach ($this->handlers as $handler) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ final class ProductIdContextHandlerTest extends WWWTest {

$handler = new ProductIdContextHandler();
$client_handler->addHandler($handler);
$client_handler->preSend('sample_method_name', null, 0);
$client_handler->preSend(
'sample_method_name',
null,
0,
'sample_service_interface',
);

// verify that TagManager::getLatestOriginID() was called
expect($mock)->wasCalledOnce();
Expand Down Expand Up @@ -124,7 +129,12 @@ final class ProductIdContextHandlerTest extends WWWTest {

$handler = new ProductIdContextHandler();
$client_handler->addHandler($handler);
$client_handler->preSend('sample_method_name', null, 0);
$client_handler->preSend(
'sample_method_name',
null,
0,
'sample_service_interface',
);

// verify that TagManager::getLatestOriginID() was called
expect($mock)->wasCalledOnce();
Expand Down Expand Up @@ -169,7 +179,12 @@ final class ProductIdContextHandlerTest extends WWWTest {

$handler = new ProductIdContextHandler();
$client_handler->addHandler($handler);
$client_handler->preSend('sample_method_name', null, 0);
$client_handler->preSend(
'sample_method_name',
null,
0,
'sample_service_interface',
);

// verify that TagManager::getLatestOriginID() was called
expect($mock)->wasCalledOnce();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ classname<IThriftClient> $thrift_service_name,
$client_handler = new TContextPropV2ClientHandler($transport, $params);

$client_handler->addHandler($handler);
$client_handler->preSend($thrift_method_name, null, 0);
$client_handler->preSend(
$thrift_method_name,
null,
0,
'sample_service_interface',
);

$write_headers = $transport->getWriteHeaders();
expect($write_headers)->toContainKey(
Expand Down

0 comments on commit 6a410ca

Please sign in to comment.