From 3d725cd2f203e6f76e92c2b3d9c9c2ec8c1b7fcc Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Mon, 15 Jun 2026 15:33:44 +0530 Subject: [PATCH 1/4] Otel Integration --- README.md | 84 ++++++++++ src/ChargebeeClient.php | 6 +- src/Environment.php | 14 ++ src/Telemetry/TelemetryExecutor.php | 134 +++++++++++++++ src/ValueObjects/APIRequester.php | 11 +- src/ValueObjects/ResponseObject.php | 8 + .../Transporters/ChargebeePayload.php | 42 ++++- .../Transporters/ChargebeePayloadBuilder.php | 16 ++ tests/Telemetry/TelemetryExecutorTest.php | 154 ++++++++++++++++++ 9 files changed, 463 insertions(+), 6 deletions(-) create mode 100644 src/Telemetry/TelemetryExecutor.php create mode 100644 tests/Telemetry/TelemetryExecutorTest.php diff --git a/README.md b/README.md index 90945b2e..c11723c5 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,90 @@ $chargebee = new ChargebeeClient(options: [ ``` +### Telemetry (OpenTelemetry) + +Optional. Pass a `telemetryAdapter` when you want Chargebee API calls traced in your observability stack (Datadog, Splunk, Honeycomb, Jaeger, etc.). OpenTelemetry is not bundled with `chargebee/chargebee-php` — install and configure it in your app, implement `TelemetryAdapter`, and wire it on the client. + +The SDK builds standardized span attributes (`startAttributes`, `endAttributes`) following the stable [OpenTelemetry HTTP semantic conventions](https://opentelemetry.io/docs/specs/semconv/http/http-spans/) (`url.full`, `http.request.method`, `http.response.status_code`, `server.address`, `error.type`) plus Chargebee-specific `chargebee.*` attributes — use them as-is so spans render correctly in your APM and stay consistent across SDKs. + +> **Note:** `url.full` intentionally omits the query string (it carries only scheme, host, and path) to avoid leaking potentially sensitive query parameters into traces. This is a deliberate, cross-SDK PII-safety choice. + +Spans are named `chargebee.{resource}.{operation}` (e.g. `chargebee.subscription.create`). + +When no adapter is configured, the SDK skips all telemetry work — zero overhead for existing integrations. + +#### Trace shape + +The SDK emits **one `CLIENT` span per API call**, covering the full lifecycle. Retries reuse the same span — `onRequestStart` runs once before the retry loop and `onRequestEnd` runs once after the final outcome. + +``` +inbound request span +└── chargebee.subscription.create ← parented to caller, propagates to Chargebee + └── (Chargebee-side spans) +``` + +> If you separately enable HTTP auto-instrumentation (e.g. an OpenTelemetry PHP agent on Guzzle), it will create an **additional transport-level HTTP span as a sibling** of the Chargebee span. For the cleanest trace where `chargebee.{resource}.{operation}` is the single propagating span, leave HTTP auto-instrumentation off for Chargebee calls. + +#### OpenTelemetry example + +```sh +composer require chargebee/chargebee-php open-telemetry/opentelemetry open-telemetry/exporter-otlp +``` + +Configure OpenTelemetry at app startup, then pass your adapter: + +```php +use Chargebee\ChargebeeClient; +use Chargebee\Telemetry\RequestTelemetryContext; +use Chargebee\Telemetry\RequestTelemetryResult; +use Chargebee\Telemetry\TelemetryAdapter; +use OpenTelemetry\API\Trace\SpanKind; +use OpenTelemetry\API\Trace\StatusCode; + +class OtelTelemetryAdapter implements TelemetryAdapter +{ + public function __construct(private $tracer) {} + + public function onRequestStart(RequestTelemetryContext $context, array &$requestHeaders): mixed + { + $span = $this->tracer + ->spanBuilder($context->spanName) + ->setSpanKind(SpanKind::KIND_CLIENT) + ->setAttributes($context->startAttributes) + ->startSpan(); + + // Inject W3C trace context into request headers + // (use your OTel propagator here) + + return $span; + } + + public function onRequestEnd(mixed $handle, RequestTelemetryResult $result): void + { + if ($handle === null) { + return; + } + + $span = $handle; + $span->setAttributes($result->endAttributes); + if ($result->error !== null) { + $span->setStatus(StatusCode::STATUS_ERROR, $result->error->message); + } + $span->end(); + } +} + +$chargebee = new ChargebeeClient([ + 'site' => '{your_site}', + 'apiKey' => '{your_apiKey}', + 'telemetryAdapter' => new OtelTelemetryAdapter($tracer), +]); +``` + +To add custom span attributes (tenant ID, correlation ID, etc.), set them in your adapter's `onRequestStart` / `onRequestEnd` — use your own namespace (e.g. `app.tenant_id`), not `chargebee.*`. + +Spans are exported by your own OpenTelemetry setup, so they flow to whatever backend you've configured. The Chargebee config above stays the same regardless of backend. + ## License See the LICENSE file. diff --git a/src/ChargebeeClient.php b/src/ChargebeeClient.php index 925fd464..43b8c940 100644 --- a/src/ChargebeeClient.php +++ b/src/ChargebeeClient.php @@ -163,7 +163,8 @@ class ChargebeeClient { * requestTimeoutInMillis?: float, * userAgentSuffix?: string, * retryConfig?: RetryConfig, - * enableDebugLogs?: bool + * enableDebugLogs?: bool, + * telemetryAdapter?: \Chargebee\Telemetry\TelemetryAdapter * } $options * @param HttpClientFactory|ClientInterface|null $httpClient Pass an HttpClientFactory for full control, * or a PSR-18 ClientInterface for a simpler injection path. When omitted, GuzzleFactory is used. @@ -206,6 +207,9 @@ public function __construct( if (isset($options['enableDebugLogs']) && is_bool($options['enableDebugLogs'])) { $env->setEnableDebugLogs($options['enableDebugLogs']); } + if (isset($options['telemetryAdapter']) && $options['telemetryAdapter'] instanceof \Chargebee\Telemetry\TelemetryAdapter) { + $env->setTelemetryAdapter($options['telemetryAdapter']); + } $this->env = $env; if ($httpClient instanceof ClientInterface) { $this->httpClientFactory = new PsrClientAdapter($httpClient, $requestFactory, $streamFactory); diff --git a/src/Environment.php b/src/Environment.php index 0eecaba9..9ea86f61 100644 --- a/src/Environment.php +++ b/src/Environment.php @@ -2,6 +2,8 @@ namespace Chargebee; +use Chargebee\Telemetry\TelemetryAdapter; + class Environment { private string $apiKey; @@ -24,6 +26,8 @@ class Environment private bool $enableDebugLogs = false; + private ?TelemetryAdapter $telemetryAdapter = null; + public function __construct(string $site, string $apiKey) { $this->site = $site; @@ -106,4 +110,14 @@ public function setEnableDebugLogs(bool $enableDebugLogs): void { $this->enableDebugLogs = $enableDebugLogs; } + + public function setTelemetryAdapter(?TelemetryAdapter $telemetryAdapter): void + { + $this->telemetryAdapter = $telemetryAdapter; + } + + public function getTelemetryAdapter(): ?TelemetryAdapter + { + return $this->telemetryAdapter; + } } \ No newline at end of file diff --git a/src/Telemetry/TelemetryExecutor.php b/src/Telemetry/TelemetryExecutor.php new file mode 100644 index 00000000..763ec509 --- /dev/null +++ b/src/Telemetry/TelemetryExecutor.php @@ -0,0 +1,134 @@ +hasTelemetryMetadata()) { + return $action($payload); + } + + $startMs = (int) (microtime(true) * 1000); + $headers = $payload->getHeaders(); + $handle = self::startTelemetry($env, $adapter, $payload, $headers); + $requestPayload = $payload->withHeaders($headers); + + try { + $response = $action($requestPayload); + self::endTelemetrySuccess($adapter, $handle, $startMs, $response->getStatusCode()); + return $response; + } catch (\Throwable $err) { + self::endTelemetryFailure($adapter, $handle, $startMs, $err); + throw $err; + } + } + + public static function resolveAdapter(Environment $env): ?TelemetryAdapter + { + return $env->getTelemetryAdapter(); + } + + /** + * @param array $headers + */ + private static function startTelemetry( + Environment $env, + TelemetryAdapter $adapter, + ChargebeePayload $payload, + array &$headers, + ): mixed { + try { + $context = self::buildContext($env, $payload); + return $adapter->onRequestStart($context, $headers); + } catch (\Throwable $err) { + if ($env->getEnableDebugLogs()) { + echo '[ERROR] Telemetry adapter onRequestStart failed: ' . $err->getMessage() . "\n"; + } + return null; + } + } + + private static function endTelemetrySuccess( + TelemetryAdapter $adapter, + mixed $handle, + int $startMs, + int $httpStatusCode, + ): void { + try { + $adapter->onRequestEnd( + $handle, + TelemetrySupport::buildRequestTelemetryResult( + $httpStatusCode, + (int) (microtime(true) * 1000) - $startMs, + null, + ), + ); + } catch (\Throwable $err) { + error_log('Telemetry adapter onRequestEnd failed: ' . $err->getMessage()); + } + } + + private static function endTelemetryFailure( + TelemetryAdapter $adapter, + mixed $handle, + int $startMs, + \Throwable $err, + ): void { + $status = TelemetrySupport::extractHttpStatusCode($err); + $httpStatusCode = $status ?? 500; + try { + $adapter->onRequestEnd( + $handle, + TelemetrySupport::buildRequestTelemetryResult( + $httpStatusCode, + (int) (microtime(true) * 1000) - $startMs, + TelemetrySupport::extractRequestTelemetryError($err), + ), + ); + } catch (\Throwable $telemetryErr) { + error_log('Telemetry adapter onRequestEnd failed: ' . $telemetryErr->getMessage()); + } + } + + private static function buildContext( + Environment $env, + ChargebeePayload $payload, + ): RequestTelemetryContext { + $parsed = parse_url($payload->getUrl()); + $scheme = $parsed['scheme'] ?? 'https'; + $host = $parsed['host'] ?? ''; + $path = $parsed['path'] ?? ''; + $httpUrl = $scheme . '://' . $host . $path; + $apiPath = '/api/' . $env->apiVersion; + + return TelemetrySupport::buildRequestTelemetryContext( + $payload->getTelemetryResource() ?? '', + $payload->getTelemetryOperation() ?? '', + strtoupper($payload->getHttpMethod()), + $httpUrl, + $host, + $env->getSite(), + TelemetrySupport::resolveChargebeeApiVersion($apiPath), + Version::VERSION, + ); + } +} diff --git a/src/ValueObjects/APIRequester.php b/src/ValueObjects/APIRequester.php index 06ebcc91..bfe8e464 100644 --- a/src/ValueObjects/APIRequester.php +++ b/src/ValueObjects/APIRequester.php @@ -8,6 +8,7 @@ use Chargebee\Exceptions\OperationFailedException; use Chargebee\Exceptions\PaymentException; use Chargebee\RetryConfig; +use Chargebee\Telemetry\TelemetryExecutor; use Chargebee\ValueObjects\Transporters\ChargebeePayload; use Chargebee\HttpClient\HttpClientFactory; use Exception; @@ -40,10 +41,12 @@ public function __construct(HttpClientFactory $httpClientFactory, Environment $e */ public function makeRequest(ChargebeePayload $payload): ResponseObject { - $retryConfig = $this->env->getRetryConfig() ?? new RetryConfig(); - return $this->withRetry(function ($retryCount) use ($payload) { - return $this->sendRequest($payload, $retryCount); - }, $retryConfig); + return TelemetryExecutor::execute($this->env, $payload, function (ChargebeePayload $requestPayload) { + $retryConfig = $this->env->getRetryConfig() ?? new RetryConfig(); + return $this->withRetry(function ($retryCount) use ($requestPayload) { + return $this->sendRequest($requestPayload, $retryCount); + }, $retryConfig); + }); } /** diff --git a/src/ValueObjects/ResponseObject.php b/src/ValueObjects/ResponseObject.php index dbefeafe..64cf0f8e 100644 --- a/src/ValueObjects/ResponseObject.php +++ b/src/ValueObjects/ResponseObject.php @@ -15,6 +15,8 @@ class ResponseObject public array $headers; + public int $httpStatusCode; + /** * @param $response * @param $httpCode @@ -41,6 +43,12 @@ public function __construct($response, $httpCode, $responseHeaders) } $this->data = $respJson; $this->headers = $responseHeaders; + $this->httpStatusCode = $httpCode; + } + + public function getStatusCode(): int + { + return $this->httpStatusCode; } /** diff --git a/src/ValueObjects/Transporters/ChargebeePayload.php b/src/ValueObjects/Transporters/ChargebeePayload.php index 5165ccaf..20cb7d65 100644 --- a/src/ValueObjects/Transporters/ChargebeePayload.php +++ b/src/ValueObjects/Transporters/ChargebeePayload.php @@ -12,19 +12,25 @@ class ChargebeePayload private ?string $serializedParameters; private array $requestHeaders; private Environment $env; + private ?string $telemetryResource; + private ?string $telemetryOperation; public function __construct( string $url, string $httpMethod, ?string $serializedParameters, array $requestHeaders, - Environment $env + Environment $env, + ?string $telemetryResource = null, + ?string $telemetryOperation = null, ) { $this->url = $url; $this->httpMethod = $httpMethod; $this->serializedParameters = $serializedParameters; $this->requestHeaders = $requestHeaders; $this->env = $env; + $this->telemetryResource = $telemetryResource; + $this->telemetryOperation = $telemetryOperation; } public function getUrl(): string @@ -52,6 +58,40 @@ public function getEnvironment(): Environment return $this->env; } + public function getTelemetryResource(): ?string + { + return $this->telemetryResource; + } + + public function getTelemetryOperation(): ?string + { + return $this->telemetryOperation; + } + + public function hasTelemetryMetadata(): bool + { + return $this->telemetryResource !== null + && $this->telemetryResource !== '' + && $this->telemetryOperation !== null + && $this->telemetryOperation !== ''; + } + + /** + * @param array $headers + */ + public function withHeaders(array $headers): self + { + return new self( + $this->url, + $this->httpMethod, + $this->serializedParameters, + array_merge($this->requestHeaders, $headers), + $this->env, + $this->telemetryResource, + $this->telemetryOperation, + ); + } + public static function builder(): ChargebeePayloadBuilder { return new ChargebeePayloadBuilder(); diff --git a/src/ValueObjects/Transporters/ChargebeePayloadBuilder.php b/src/ValueObjects/Transporters/ChargebeePayloadBuilder.php index 1189caa0..b3194172 100644 --- a/src/ValueObjects/Transporters/ChargebeePayloadBuilder.php +++ b/src/ValueObjects/Transporters/ChargebeePayloadBuilder.php @@ -21,6 +21,8 @@ class ChargebeePayloadBuilder private ?bool $isIdempotent = false; private array $jsonKeys = []; private ?ParamEncoderInterface $paramEncoder = null; + private ?string $telemetryResource = null; + private ?string $telemetryOperation = null; public function withUriPaths(array $uriPaths): self { @@ -88,6 +90,18 @@ public function withIdempotent(bool $isIdempotent): self return $this; } + public function withTelemetryResource(string $telemetryResource): self + { + $this->telemetryResource = $telemetryResource; + return $this; + } + + public function withTelemetryOperation(string $telemetryOperation): self + { + $this->telemetryOperation = $telemetryOperation; + return $this; + } + private function constructHeaders(): array { if (!$this->env) { @@ -136,6 +150,8 @@ public function build(): ChargebeePayload $serializedParameters, $headers, $this->env, + $this->telemetryResource, + $this->telemetryOperation, ); } } \ No newline at end of file diff --git a/tests/Telemetry/TelemetryExecutorTest.php b/tests/Telemetry/TelemetryExecutorTest.php new file mode 100644 index 00000000..5d5ae2f8 --- /dev/null +++ b/tests/Telemetry/TelemetryExecutorTest.php @@ -0,0 +1,154 @@ + */ + public array $events = []; + + public ?RequestTelemetryContext $startContext = null; + + public ?RequestTelemetryResult $endResult = null; + + public function onRequestStart(RequestTelemetryContext $context, array &$requestHeaders): mixed + { + $this->events[] = 'start'; + $this->startContext = $context; + $requestHeaders['traceparent'] = '00-test-trace'; + return 'span-1'; + } + + public function onRequestEnd(mixed $handle, RequestTelemetryResult $result): void + { + $this->events[] = 'end'; + $this->endResult = $result; + } +} + +#[TestDox('TelemetryExecutor')] +final class TelemetryExecutorTest extends TestCase +{ + private function makeEnvironment(?TelemetryAdapter $adapter = null): Environment + { + $env = new Environment('acme', 'test_key'); + if ($adapter !== null) { + $env->setTelemetryAdapter($adapter); + } + + return $env; + } + + private function makePayload(Environment $env, ?string $resource, ?string $operation): ChargebeePayload + { + $builder = ChargebeePayload::builder() + ->withEnvironment($env) + ->withHttpMethod('get') + ->withUriPaths(['/customers']) + ->withParamEncoder(new URLFormEncoder()); + + if ($resource !== null) { + $builder->withTelemetryResource($resource); + } + if ($operation !== null) { + $builder->withTelemetryOperation($operation); + } + + return $builder->build(); + } + + #[TestDox('skips telemetry when no adapter is configured')] + public function testSkipsWhenNoAdapter(): void + { + $env = $this->makeEnvironment(); + $payload = $this->makePayload($env, 'customer', 'list'); + + $result = TelemetryExecutor::execute( + $env, + $payload, + fn (ChargebeePayload $p) => new ResponseObject('{}', 200, []), + ); + + self::assertSame(200, $result->getStatusCode()); + } + + #[TestDox('skips telemetry when resource or operation metadata is missing')] + public function testSkipsWhenNoMetadata(): void + { + $adapter = new RecordingAdapter(); + $env = $this->makeEnvironment($adapter); + $payload = $this->makePayload($env, null, null); + + TelemetryExecutor::execute( + $env, + $payload, + fn (ChargebeePayload $p) => new ResponseObject('{}', 200, []), + ); + + self::assertSame([], $adapter->events); + } + + #[TestDox('calls adapter once per API call and injects trace headers')] + public function testCallsAdapterOncePerApiCall(): void + { + $adapter = new RecordingAdapter(); + $env = $this->makeEnvironment($adapter); + $payload = $this->makePayload($env, 'customer', 'list'); + $attempts = 0; + + $result = TelemetryExecutor::execute($env, $payload, function (ChargebeePayload $p) use (&$attempts) { + $attempts++; + self::assertSame('00-test-trace', $p->getHeaders()['traceparent'] ?? null); + + return new ResponseObject('{}', 200, []); + }); + + self::assertSame(1, $attempts); + self::assertSame(['start', 'end'], $adapter->events); + self::assertSame('chargebee.customer.list', $adapter->startContext?->spanName); + self::assertSame(200, $adapter->endResult?->httpStatusCode); + self::assertSame(200, $result->getStatusCode()); + } + + #[TestDox('records failure details from APIError')] + public function testRecordsFailureFromApiError(): void + { + $adapter = new RecordingAdapter(); + $env = $this->makeEnvironment($adapter); + $payload = $this->makePayload($env, 'customer', 'retrieve'); + + try { + TelemetryExecutor::execute($env, $payload, function (ChargebeePayload $p) { + throw new APIError( + 404, + [ + 'message' => 'Not found', + 'type' => 'invalid_request', + 'api_error_code' => 'resource_not_found', + 'param' => 'customer_id', + ], + [], + ); + }); + self::fail('Expected APIError'); + } catch (APIError) { + // expected + } + + self::assertSame(['start', 'end'], $adapter->events); + self::assertSame(404, $adapter->endResult?->httpStatusCode); + self::assertSame('resource_not_found', $adapter->endResult?->error?->chargebeeErrorCode); + } +} From ae25b039f21a8ad304ccf13aa1a45ee0146caed5 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Tue, 30 Jun 2026 22:02:36 +0530 Subject: [PATCH 2/4] Telemetry adapter and version bumpup --- CHANGELOG.md | 9 + VERSION | 2 +- src/Actions/AddonActions.php | 14 ++ src/Actions/AddressActions.php | 4 + src/Actions/AlertActions.php | 12 ++ src/Actions/AlertStatusActions.php | 4 + src/Actions/AttachedItemActions.php | 10 + src/Actions/BusinessEntityActions.php | 4 + src/Actions/CardActions.php | 10 + src/Actions/CommentActions.php | 8 + src/Actions/ConfigurationActions.php | 2 + src/Actions/CouponActions.php | 18 ++ src/Actions/CouponCodeActions.php | 8 + src/Actions/CouponSetActions.php | 14 ++ src/Actions/CreditNoteActions.php | 28 +++ src/Actions/CurrencyActions.php | 12 ++ src/Actions/CustomerActions.php | 52 +++++ src/Actions/CustomerEntitlementActions.php | 2 + src/Actions/DifferentialPriceActions.php | 10 + src/Actions/EntitlementActions.php | 4 + src/Actions/EntitlementOverrideActions.php | 4 + src/Actions/EstimateActions.php | 40 ++++ src/Actions/EventActions.php | 4 + src/Actions/ExportActions.php | 36 ++++ src/Actions/FeatureActions.php | 16 ++ src/Actions/GiftActions.php | 14 ++ src/Actions/GrantBlockActions.php | 2 + src/Actions/HostedPageActions.php | 44 ++++ src/Actions/InAppSubscriptionActions.php | 8 + src/Actions/InvoiceActions.php | 80 ++++++++ src/Actions/ItemActions.php | 10 + src/Actions/ItemEntitlementActions.php | 8 + src/Actions/ItemFamilyActions.php | 10 + src/Actions/ItemPriceActions.php | 14 ++ src/Actions/LedgerAccountBalanceActions.php | 2 + src/Actions/LedgerOperationActions.php | 12 ++ src/Actions/NonSubscriptionActions.php | 2 + src/Actions/OfferEventActions.php | 2 + src/Actions/OfferFulfillmentActions.php | 6 + .../OmnichannelOneTimeOrderActions.php | 4 + .../OmnichannelSubscriptionActions.php | 8 + .../OmnichannelSubscriptionItemActions.php | 2 + src/Actions/OrderActions.php | 24 +++ src/Actions/PaymentIntentActions.php | 6 + src/Actions/PaymentScheduleSchemeActions.php | 6 + src/Actions/PaymentSourceActions.php | 32 +++ src/Actions/PaymentVoucherActions.php | 8 + src/Actions/PersonalizedOfferActions.php | 2 + src/Actions/PlanActions.php | 14 ++ src/Actions/PortalSessionActions.php | 8 + src/Actions/PriceVariantActions.php | 10 + src/Actions/PricingPageSessionActions.php | 4 + src/Actions/PromotionalCreditActions.php | 10 + src/Actions/PromotionalGrantActions.php | 2 + src/Actions/PurchaseActions.php | 4 + src/Actions/QuoteActions.php | 52 +++++ src/Actions/RampActions.php | 10 + src/Actions/RecordedPurchaseActions.php | 4 + src/Actions/ResourceMigrationActions.php | 2 + src/Actions/RuleActions.php | 2 + src/Actions/SiteMigrationDetailActions.php | 2 + src/Actions/SubscriptionActions.php | 74 +++++++ .../SubscriptionEntitlementActions.php | 4 + src/Actions/TimeMachineActions.php | 6 + src/Actions/TransactionActions.php | 24 +++ src/Actions/UnbilledChargeActions.php | 12 ++ src/Actions/UsageActions.php | 10 + src/Actions/UsageChargeActions.php | 2 + src/Actions/UsageEventActions.php | 4 + src/Actions/UsageFileActions.php | 4 + src/Actions/UsageSummaryActions.php | 2 + src/Actions/VirtualBankAccountActions.php | 14 ++ src/Actions/WebhookEndpointActions.php | 10 + src/Telemetry/RequestTelemetryContext.php | 31 +++ src/Telemetry/RequestTelemetryError.php | 21 ++ src/Telemetry/RequestTelemetryResult.php | 24 +++ src/Telemetry/TelemetryAdapter.php | 34 ++++ src/Telemetry/TelemetryAttributeKeys.php | 41 ++++ src/Telemetry/TelemetryExecutor.php | 7 +- src/Telemetry/TelemetrySupport.php | 192 ++++++++++++++++++ src/Version.php | 2 +- tests/Telemetry/TelemetryExecutorTest.php | 31 +++ 82 files changed, 1303 insertions(+), 3 deletions(-) create mode 100644 src/Telemetry/RequestTelemetryContext.php create mode 100644 src/Telemetry/RequestTelemetryError.php create mode 100644 src/Telemetry/RequestTelemetryResult.php create mode 100644 src/Telemetry/TelemetryAdapter.php create mode 100644 src/Telemetry/TelemetryAttributeKeys.php create mode 100644 src/Telemetry/TelemetrySupport.php diff --git a/CHANGELOG.md b/CHANGELOG.md index ac40da07..93af2272 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### v4.23.0 (2026-06-30) +* * * + +### New Features +* Added an optional telemetry adapter hook for tracing Chargebee API calls via OpenTelemetry (or any APM). Configure it via the `telemetryAdapter` client option (or `Environment::setTelemetryAdapter`). When unconfigured, the SDK skips all telemetry work — no behavior change for existing integrations. +* Each API call emits one CLIENT span (`chargebee.{resource}.{operation}`) with OpenTelemetry HTTP semantic-convention attributes plus `chargebee.*` attributes. Adapters may inject W3C trace context (`traceparent`) into outbound request headers for distributed tracing. +* Exposed the `TelemetryAdapter`, `RequestTelemetryContext`, `RequestTelemetryResult`, `RequestTelemetryError` types, the `TelemetrySupport` helpers, and the `TelemetryAttributeKeys` constants under the `Chargebee\Telemetry` namespace. + + ### v4.22.0 (2026-06-12) * * * ### New Resources: diff --git a/VERSION b/VERSION index d7638f37..58fe3522 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.22.0 +4.23.0 diff --git a/src/Actions/AddonActions.php b/src/Actions/AddonActions.php index c66981b2..855afbfd 100644 --- a/src/Actions/AddonActions.php +++ b/src/Actions/AddonActions.php @@ -61,6 +61,8 @@ public function copy(array $params, array $headers = []): CopyAddonResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("addon") + ->withTelemetryOperation("copy") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -92,6 +94,8 @@ public function unarchive(string $id, array $headers = []): UnarchiveAddonRespon ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("addon") + ->withTelemetryOperation("unarchive") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -122,6 +126,8 @@ public function retrieve(string $id, array $headers = []): RetrieveAddonResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("addon") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -205,6 +211,8 @@ public function update(string $id, array $params, array $headers = []): UpdateAd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("addon") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -321,6 +329,8 @@ public function all(array $params = [], array $headers = []): ListAddonResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("addon") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -406,6 +416,8 @@ public function create(array $params, array $headers = []): CreateAddonResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("addon") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -437,6 +449,8 @@ public function delete(string $id, array $headers = []): DeleteAddonResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("addon") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/AddressActions.php b/src/Actions/AddressActions.php index 4d92ef23..30db060c 100644 --- a/src/Actions/AddressActions.php +++ b/src/Actions/AddressActions.php @@ -52,6 +52,8 @@ public function retrieve(array $params, array $headers = []): RetrieveAddressRes ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("address") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -101,6 +103,8 @@ public function update(array $params, array $headers = []): UpdateAddressRespons ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("address") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/AlertActions.php b/src/Actions/AlertActions.php index 2d9dc0b0..f04c437d 100644 --- a/src/Actions/AlertActions.php +++ b/src/Actions/AlertActions.php @@ -63,6 +63,8 @@ public function applicationAlertsForSubscription(string $id, array $params = [], ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("alert") + ->withTelemetryOperation("applicationAlertsForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -93,6 +95,8 @@ public function retrieve(string $id, array $headers = []): RetrieveAlertResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("alert") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -131,6 +135,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("alert") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -162,6 +168,8 @@ public function delete(string $id, array $headers = []): DeleteAlertResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("alert") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -208,6 +216,8 @@ public function all(array $params = [], array $headers = []): ListAlertResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("alert") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -256,6 +266,8 @@ public function create(array $params, array $headers = []): CreateAlertResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("alert") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/AlertStatusActions.php b/src/Actions/AlertStatusActions.php index a7554274..8b3ccec3 100644 --- a/src/Actions/AlertStatusActions.php +++ b/src/Actions/AlertStatusActions.php @@ -59,6 +59,8 @@ public function alertStatusesForSubscription(string $id, array $params = [], arr ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("alertStatus") + ->withTelemetryOperation("alertStatusesForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -96,6 +98,8 @@ public function alertStatusesForAlert(string $id, array $params = [], array $hea ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("alertStatus") + ->withTelemetryOperation("alertStatusesForAlert") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/AttachedItemActions.php b/src/Actions/AttachedItemActions.php index 04198221..c03ff76c 100644 --- a/src/Actions/AttachedItemActions.php +++ b/src/Actions/AttachedItemActions.php @@ -55,6 +55,8 @@ public function retrieve(string $id, array $params, array $headers = []): Retrie ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("attachedItem") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -95,6 +97,8 @@ public function update(string $id, array $params, array $headers = []): UpdateAt ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("attachedItem") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -167,6 +171,8 @@ public function all(string $id, array $params = [], array $headers = []): ListAt ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("attachedItem") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -208,6 +214,8 @@ public function create(string $id, array $params, array $headers = []): CreateAt ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("attachedItem") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -242,6 +250,8 @@ public function delete(string $id, array $params, array $headers = []): DeleteAt ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("attachedItem") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/BusinessEntityActions.php b/src/Actions/BusinessEntityActions.php index c69e9df8..59cc9b1e 100644 --- a/src/Actions/BusinessEntityActions.php +++ b/src/Actions/BusinessEntityActions.php @@ -72,6 +72,8 @@ public function getTransfers(array $params = [], array $headers = []): GetTransf ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("businessEntity") + ->withTelemetryOperation("getTransfers") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -110,6 +112,8 @@ public function createTransfers(array $params, array $headers = []): CreateTrans ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("businessEntity") + ->withTelemetryOperation("createTransfers") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CardActions.php b/src/Actions/CardActions.php index 970c00c4..16a097ce 100644 --- a/src/Actions/CardActions.php +++ b/src/Actions/CardActions.php @@ -55,6 +55,8 @@ public function copyCardForCustomer(string $id, array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("card") + ->withTelemetryOperation("copyCardForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -85,6 +87,8 @@ public function retrieve(string $id, array $headers = []): RetrieveCardResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("card") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -120,6 +124,8 @@ public function switchGatewayForCustomer(string $id, array $params, array $heade ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("card") + ->withTelemetryOperation("switchGatewayForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -151,6 +157,8 @@ public function deleteCardForCustomer(string $id, array $headers = []): DeleteCa ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("card") + ->withTelemetryOperation("deleteCardForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -205,6 +213,8 @@ public function updateCardForCustomer(string $id, array $params, array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("card") + ->withTelemetryOperation("updateCardForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CommentActions.php b/src/Actions/CommentActions.php index 385abc2b..82117ced 100644 --- a/src/Actions/CommentActions.php +++ b/src/Actions/CommentActions.php @@ -52,6 +52,8 @@ public function delete(string $id, array $headers = []): DeleteCommentResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("comment") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -82,6 +84,8 @@ public function retrieve(string $id, array $headers = []): RetrieveCommentRespon ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("comment") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -128,6 +132,8 @@ public function all(array $params = [], array $headers = []): ListCommentRespons ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("comment") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -165,6 +171,8 @@ public function create(array $params, array $headers = []): CreateCommentRespons ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("comment") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/ConfigurationActions.php b/src/Actions/ConfigurationActions.php index 387bfcda..5f58e4ba 100644 --- a/src/Actions/ConfigurationActions.php +++ b/src/Actions/ConfigurationActions.php @@ -47,6 +47,8 @@ public function all(array $headers = []): ListConfigurationResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("configuration") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CouponActions.php b/src/Actions/CouponActions.php index bcfab703..75e7d556 100644 --- a/src/Actions/CouponActions.php +++ b/src/Actions/CouponActions.php @@ -125,6 +125,8 @@ public function all(array $params = [], array $headers = []): ListCouponResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -182,6 +184,8 @@ public function create(array $params, array $headers = []): CreateCouponResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -254,6 +258,8 @@ public function updateForItems(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("updateForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -285,6 +291,8 @@ public function unarchive(string $id, array $headers = []): UnarchiveCouponRespo ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("unarchive") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -316,6 +324,8 @@ public function delete(string $id, array $headers = []): DeleteCouponResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -353,6 +363,8 @@ public function copy(array $params, array $headers = []): CopyCouponResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("copy") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -383,6 +395,8 @@ public function retrieve(string $id, array $headers = []): RetrieveCouponRespons ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -438,6 +452,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -512,6 +528,8 @@ public function createForItems(array $params, array $headers = []): CreateForIte ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("coupon") + ->withTelemetryOperation("createForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CouponCodeActions.php b/src/Actions/CouponCodeActions.php index 442ba23b..c31405b1 100644 --- a/src/Actions/CouponCodeActions.php +++ b/src/Actions/CouponCodeActions.php @@ -80,6 +80,8 @@ public function all(array $params = [], array $headers = []): ListCouponCodeResp ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("couponCode") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -117,6 +119,8 @@ public function create(array $params, array $headers = []): CreateCouponCodeResp ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("couponCode") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -147,6 +151,8 @@ public function retrieve(string $id, array $headers = []): RetrieveCouponCodeRes ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("couponCode") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -178,6 +184,8 @@ public function archive(string $id, array $headers = []): ArchiveCouponCodeRespo ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("couponCode") + ->withTelemetryOperation("archive") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CouponSetActions.php b/src/Actions/CouponSetActions.php index e4a993d3..f373e5fb 100644 --- a/src/Actions/CouponSetActions.php +++ b/src/Actions/CouponSetActions.php @@ -106,6 +106,8 @@ public function all(array $params = [], array $headers = []): ListCouponSetRespo ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("couponSet") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -144,6 +146,8 @@ public function create(array $params, array $headers = []): CreateCouponSetRespo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("couponSet") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -180,6 +184,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("couponSet") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -210,6 +216,8 @@ public function retrieve(string $id, array $headers = []): RetrieveCouponSetResp ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("couponSet") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -244,6 +252,8 @@ public function addCouponCodes(string $id, array $params = [], array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("couponSet") + ->withTelemetryOperation("addCouponCodes") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -275,6 +285,8 @@ public function deleteUnusedCouponCodes(string $id, array $headers = []): Delete ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("couponSet") + ->withTelemetryOperation("deleteUnusedCouponCodes") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -306,6 +318,8 @@ public function delete(string $id, array $headers = []): DeleteCouponSetResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("couponSet") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CreditNoteActions.php b/src/Actions/CreditNoteActions.php index 803debae..319c9635 100644 --- a/src/Actions/CreditNoteActions.php +++ b/src/Actions/CreditNoteActions.php @@ -74,6 +74,8 @@ public function recordRefund(string $id, array $params, array $headers = []): Re ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("recordRefund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -202,6 +204,8 @@ public function importCreditNote(array $params, array $headers = []): ImportCred ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("importCreditNote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -236,6 +240,8 @@ public function delete(string $id, array $params = [], array $headers = []): Del ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -271,6 +277,8 @@ public function creditNotesForCustomer(string $id, array $params = [], array $he ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("creditNotesForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -305,6 +313,8 @@ public function pdf(string $id, array $params = [], array $headers = []): PdfCre ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("pdf") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -336,6 +346,8 @@ public function sendEinvoice(string $id, array $headers = []): SendEinvoiceCredi ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("sendEinvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -370,6 +382,8 @@ public function voidCreditNote(string $id, array $params = [], array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("voidCreditNote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -406,6 +420,8 @@ public function refund(string $id, array $params = [], array $headers = []): Ref ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("refund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -574,6 +590,8 @@ public function all(array $params = [], array $headers = []): ListCreditNoteResp ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -630,6 +648,8 @@ public function create(array $params, array $headers = []): CreateCreditNoteResp ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -660,6 +680,8 @@ public function downloadEinvoice(string $id, array $headers = []): DownloadEinvo ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("downloadEinvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -691,6 +713,8 @@ public function resendEinvoice(string $id, array $headers = []): ResendEinvoiceC ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("resendEinvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -727,6 +751,8 @@ public function removeTaxWithheldRefund(string $id, array $params, array $header ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("removeTaxWithheldRefund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -769,6 +795,8 @@ public function retrieve(string $id, array $params = [], array $headers = []): R ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("creditNote") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CurrencyActions.php b/src/Actions/CurrencyActions.php index 9bf2cc19..baba9a67 100644 --- a/src/Actions/CurrencyActions.php +++ b/src/Actions/CurrencyActions.php @@ -58,6 +58,8 @@ public function addSchedule(string $id, array $params, array $headers = []): Add ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("currency") + ->withTelemetryOperation("addSchedule") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -94,6 +96,8 @@ public function create(array $params, array $headers = []): CreateCurrencyRespon ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("currency") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -124,6 +128,8 @@ public function retrieve(string $id, array $headers = []): RetrieveCurrencyRespo ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("currency") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -159,6 +165,8 @@ public function update(string $id, array $params, array $headers = []): UpdateCu ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("currency") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -190,6 +198,8 @@ public function removeSchedule(string $id, array $headers = []): RemoveScheduleC ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("currency") + ->withTelemetryOperation("removeSchedule") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -224,6 +234,8 @@ public function all(array $params = [], array $headers = []): ListCurrencyRespon ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("currency") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CustomerActions.php b/src/Actions/CustomerActions.php index 6610821e..48763f83 100644 --- a/src/Actions/CustomerActions.php +++ b/src/Actions/CustomerActions.php @@ -77,6 +77,8 @@ public function delete(string $id, array $params = [], array $headers = []): Del ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -116,6 +118,8 @@ public function addPromotionalCredits(string $id, array $params, array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("addPromotionalCredits") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -167,6 +171,8 @@ public function relationships(string $id, array $params = [], array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("relationships") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -198,6 +204,8 @@ public function deleteRelationship(string $id, array $headers = []): DeleteRelat ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("deleteRelationship") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -234,6 +242,8 @@ public function deleteContact(string $id, array $params, array $headers = []): D ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("deleteContact") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -269,6 +279,8 @@ public function assignPaymentRole(string $id, array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("assignPaymentRole") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -304,6 +316,8 @@ public function move(array $params, array $headers = []): MoveCustomerResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("move") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -337,6 +351,8 @@ public function hierarchy(string $id, array $params, array $headers = []): Hiera ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("customer") + ->withTelemetryOperation("hierarchy") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -380,6 +396,8 @@ public function updatePaymentMethod(string $id, array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("updatePaymentMethod") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -410,6 +428,8 @@ public function retrieve(string $id, array $headers = []): RetrieveCustomerRespo ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("customer") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -473,6 +493,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -508,6 +530,8 @@ public function listHierarchyDetail(string $id, array $params, array $headers = ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("customer") + ->withTelemetryOperation("listHierarchyDetail") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -546,6 +570,8 @@ public function changeBillingDate(string $id, array $params = [], array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("changeBillingDate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -681,6 +707,8 @@ public function all(array $params = [], array $headers = []): ListCustomerRespon ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("customer") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -837,6 +865,8 @@ public function create(array $params = [], array $headers = []): CreateCustomerR ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -881,6 +911,8 @@ public function addContact(string $id, array $params, array $headers = []): AddC ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("addContact") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -915,6 +947,8 @@ public function contactsForCustomer(string $id, array $params = [], array $heade ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("customer") + ->withTelemetryOperation("contactsForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -954,6 +988,8 @@ public function deductPromotionalCredits(string $id, array $params, array $heade ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("deductPromotionalCredits") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -985,6 +1021,8 @@ public function clearPersonalData(string $id, array $headers = []): ClearPersona ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("clearPersonalData") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1020,6 +1058,8 @@ public function merge(array $params, array $headers = []): MergeCustomerResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("merge") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1098,6 +1138,8 @@ public function collectPayment(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("collectPayment") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1141,6 +1183,8 @@ public function recordExcessPayment(string $id, array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("recordExcessPayment") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1180,6 +1224,8 @@ public function setPromotionalCredits(string $id, array $params, array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("setPromotionalCredits") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1224,6 +1270,8 @@ public function updateContact(string $id, array $params, array $headers = []): U ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("updateContact") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1272,6 +1320,8 @@ public function updateHierarchySettings(string $id, array $params = [], array $h ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("updateHierarchySettings") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1341,6 +1391,8 @@ public function updateBillingInfo(string $id, array $params = [], array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("customer") + ->withTelemetryOperation("updateBillingInfo") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/CustomerEntitlementActions.php b/src/Actions/CustomerEntitlementActions.php index 5b66dc08..5b095dcc 100644 --- a/src/Actions/CustomerEntitlementActions.php +++ b/src/Actions/CustomerEntitlementActions.php @@ -53,6 +53,8 @@ public function entitlementsForCustomer(string $id, array $params = [], array $h ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("customerEntitlement") + ->withTelemetryOperation("entitlementsForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/DifferentialPriceActions.php b/src/Actions/DifferentialPriceActions.php index 78c8c6d7..aa529c0f 100644 --- a/src/Actions/DifferentialPriceActions.php +++ b/src/Actions/DifferentialPriceActions.php @@ -56,6 +56,8 @@ public function delete(string $id, array $params, array $headers = []): DeleteDi ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("differentialPrice") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -108,6 +110,8 @@ public function create(string $id, array $params, array $headers = []): CreateDi ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("differentialPrice") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -170,6 +174,8 @@ public function all(array $params = [], array $headers = []): ListDifferentialPr ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("differentialPrice") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -203,6 +209,8 @@ public function retrieve(string $id, array $params, array $headers = []): Retrie ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("differentialPrice") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -254,6 +262,8 @@ public function update(string $id, array $params, array $headers = []): UpdateDi ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("differentialPrice") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/EntitlementActions.php b/src/Actions/EntitlementActions.php index ebee27f0..ac18aadc 100644 --- a/src/Actions/EntitlementActions.php +++ b/src/Actions/EntitlementActions.php @@ -67,6 +67,8 @@ public function all(array $params = [], array $headers = []): ListEntitlementRes ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("entitlement") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -109,6 +111,8 @@ public function create(array $params, array $headers = []): CreateEntitlementRes ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("entitlement") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/EntitlementOverrideActions.php b/src/Actions/EntitlementOverrideActions.php index 9bd899c0..aac805b1 100644 --- a/src/Actions/EntitlementOverrideActions.php +++ b/src/Actions/EntitlementOverrideActions.php @@ -56,6 +56,8 @@ public function listEntitlementOverrideForSubscription(string $id, array $params ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("entitlementOverride") + ->withTelemetryOperation("listEntitlementOverrideForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -99,6 +101,8 @@ public function addEntitlementOverrideForSubscription(string $id, array $params, ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("entitlementOverride") + ->withTelemetryOperation("addEntitlementOverrideForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/EstimateActions.php b/src/Actions/EstimateActions.php index 155a831d..a7484877 100644 --- a/src/Actions/EstimateActions.php +++ b/src/Actions/EstimateActions.php @@ -73,6 +73,8 @@ public function renewalEstimate(string $id, array $params = [], array $headers = ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("renewalEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -203,6 +205,8 @@ public function createSubItemEstimate(array $params, array $headers = []): Creat ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("createSubItemEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -240,6 +244,8 @@ public function paymentSchedules(array $params, array $headers = []): PaymentSch ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("paymentSchedules") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -291,6 +297,8 @@ public function cancelSubscriptionForItems(string $id, array $params = [], array ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("cancelSubscriptionForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -329,6 +337,8 @@ public function resumeSubscription(string $id, array $params = [], array $header ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("resumeSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -453,6 +463,8 @@ public function createInvoiceForItems(array $params, array $headers = []): Creat ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("createInvoiceForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -547,6 +559,8 @@ public function giftSubscriptionForItems(array $params, array $headers = []): Gi ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("giftSubscriptionForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -680,6 +694,8 @@ public function updateSubscriptionForItems(array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("updateSubscriptionForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -713,6 +729,8 @@ public function upcomingInvoicesEstimate(string $id, array $params = [], array $ ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("upcomingInvoicesEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -750,6 +768,8 @@ public function regenerateInvoiceEstimate(string $id, array $params = [], array ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("regenerateInvoiceEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -867,6 +887,8 @@ public function createSubItemForCustomerEstimate(string $id, array $params, arra ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("createSubItemForCustomerEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -903,6 +925,8 @@ public function changeTermEnd(string $id, array $params, array $headers = []): C ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("changeTermEnd") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -943,6 +967,8 @@ public function pauseSubscription(string $id, array $params = [], array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("pauseSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -989,6 +1015,8 @@ public function advanceInvoiceEstimate(string $id, array $params = [], array $he ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("advanceInvoiceEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1104,6 +1132,8 @@ public function updateSubscription(array $params, array $headers = []): UpdateSu ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("updateSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1192,6 +1222,8 @@ public function giftSubscription(array $params, array $headers = []): GiftSubscr ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("giftSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1282,6 +1314,8 @@ public function createSubForCustomerEstimate(string $id, array $params, array $h ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("createSubForCustomerEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1400,6 +1434,8 @@ public function createSubscription(array $params, array $headers = []): CreateSu ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("createSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1496,6 +1532,8 @@ public function createInvoice(array $params = [], array $headers = []): CreateIn ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("createInvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1545,6 +1583,8 @@ public function cancelSubscription(string $id, array $params = [], array $header ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("estimate") + ->withTelemetryOperation("cancelSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/EventActions.php b/src/Actions/EventActions.php index d5024ef5..9c429102 100644 --- a/src/Actions/EventActions.php +++ b/src/Actions/EventActions.php @@ -90,6 +90,8 @@ public function all(array $params = [], array $headers = []): ListEventResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("event") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -120,6 +122,8 @@ public function retrieve(string $id, array $headers = []): RetrieveEventResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("event") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/ExportActions.php b/src/Actions/ExportActions.php index b9035866..bfd76c3e 100644 --- a/src/Actions/ExportActions.php +++ b/src/Actions/ExportActions.php @@ -168,6 +168,8 @@ public function customers(array $params = [], array $headers = []): CustomersExp ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("customers") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -248,6 +250,8 @@ public function attachedItems(array $params = [], array $headers = []): Attached ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("attachedItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -386,6 +390,8 @@ public function transactions(array $params = [], array $headers = []): Transacti ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("transactions") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -449,6 +455,8 @@ public function differentialPrices(array $params = [], array $headers = []): Dif ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("differentialPrices") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -509,6 +517,8 @@ public function itemFamilies(array $params = [], array $headers = []): ItemFamil ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("itemFamilies") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -664,6 +674,8 @@ public function invoices(array $params = [], array $headers = []): InvoicesExpor ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("invoices") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -694,6 +706,8 @@ public function retrieve(string $id, array $headers = []): RetrieveExportRespons ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("export") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -768,6 +782,8 @@ public function priceVariants(array $params = [], array $headers = []): PriceVar ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("priceVariants") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -877,6 +893,8 @@ public function items(array $params = [], array $headers = []): ItemsExportRespo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("items") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1240,6 +1258,8 @@ public function deferredRevenue(array $params, array $headers = []): DeferredRev ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("deferredRevenue") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1603,6 +1623,8 @@ public function revenueRecognition(array $params, array $headers = []): RevenueR ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("revenueRecognition") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1759,6 +1781,8 @@ public function creditNotes(array $params = [], array $headers = []): CreditNote ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("creditNotes") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1855,6 +1879,8 @@ public function coupons(array $params = [], array $headers = []): CouponsExportR ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("coupons") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2010,6 +2036,8 @@ public function orders(array $params = [], array $headers = []): OrdersExportRes ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("orders") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2154,6 +2182,8 @@ public function itemPrices(array $params = [], array $headers = []): ItemPricesE ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("itemPrices") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2304,6 +2334,8 @@ public function subscriptions(array $params = [], array $headers = []): Subscrip ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("subscriptions") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2408,6 +2440,8 @@ public function addons(array $params = [], array $headers = []): AddonsExportRes ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("addons") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2531,6 +2565,8 @@ public function plans(array $params = [], array $headers = []): PlansExportRespo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("export") + ->withTelemetryOperation("plans") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/FeatureActions.php b/src/Actions/FeatureActions.php index 7faaca09..bbfcb314 100644 --- a/src/Actions/FeatureActions.php +++ b/src/Actions/FeatureActions.php @@ -85,6 +85,8 @@ public function all(array $params = [], array $headers = []): ListFeatureRespons ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("feature") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -129,6 +131,8 @@ public function create(array $params, array $headers = []): CreateFeatureRespons ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("feature") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -160,6 +164,8 @@ public function delete(string $id, array $headers = []): DeleteFeatureResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("feature") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -190,6 +196,8 @@ public function retrieve(string $id, array $headers = []): RetrieveFeatureRespon ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("feature") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -232,6 +240,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("feature") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -263,6 +273,8 @@ public function archive(string $id, array $headers = []): ArchiveFeatureResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("feature") + ->withTelemetryOperation("archive") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -294,6 +306,8 @@ public function activate(string $id, array $headers = []): ActivateFeatureRespon ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("feature") + ->withTelemetryOperation("activate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -325,6 +339,8 @@ public function reactivate(string $id, array $headers = []): ReactivateFeatureRe ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("feature") + ->withTelemetryOperation("reactivate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/GiftActions.php b/src/Actions/GiftActions.php index 09e25516..ad573bd2 100644 --- a/src/Actions/GiftActions.php +++ b/src/Actions/GiftActions.php @@ -118,6 +118,8 @@ public function createForItems(array $params, array $headers = []): CreateForIte ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("gift") + ->withTelemetryOperation("createForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -149,6 +151,8 @@ public function cancel(string $id, array $headers = []): CancelGiftResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("gift") + ->withTelemetryOperation("cancel") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -189,6 +193,8 @@ public function updateGift(string $id, array $params = [], array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("gift") + ->withTelemetryOperation("updateGift") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -248,6 +254,8 @@ public function all(array $params = [], array $headers = []): ListGiftResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("gift") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -334,6 +342,8 @@ public function create(array $params, array $headers = []): CreateGiftResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("gift") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -364,6 +374,8 @@ public function retrieve(string $id, array $headers = []): RetrieveGiftResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("gift") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -395,6 +407,8 @@ public function claim(string $id, array $headers = []): ClaimGiftResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("gift") + ->withTelemetryOperation("claim") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/GrantBlockActions.php b/src/Actions/GrantBlockActions.php index 405ca7e7..85ba1720 100644 --- a/src/Actions/GrantBlockActions.php +++ b/src/Actions/GrantBlockActions.php @@ -80,6 +80,8 @@ public function listGrantBlocks(array $params, array $headers = []): ListGrantBl ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("grantBlock") + ->withTelemetryOperation("listGrantBlocks") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/HostedPageActions.php b/src/Actions/HostedPageActions.php index 23658eac..2be0332b 100644 --- a/src/Actions/HostedPageActions.php +++ b/src/Actions/HostedPageActions.php @@ -186,6 +186,8 @@ public function checkoutOneTimeForItems(array $params, array $headers = []): Che ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutOneTimeForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -234,6 +236,8 @@ public function updatePaymentMethod(array $params, array $headers = []): UpdateP ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("updatePaymentMethod") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -282,6 +286,8 @@ public function updateCard(array $params, array $headers = []): UpdateCardHosted ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("updateCard") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -320,6 +326,8 @@ public function extendSubscription(array $params, array $headers = []): ExtendSu ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("extendSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -357,6 +365,8 @@ public function events(array $params, array $headers = []): EventsHostedPageResp ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("events") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -413,6 +423,8 @@ public function checkoutGiftForItems(array $params = [], array $headers = []): C ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutGiftForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -472,6 +484,8 @@ public function all(array $params = [], array $headers = []): ListHostedPageResp ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -511,6 +525,8 @@ public function viewVoucher(array $params, array $headers = []): ViewVoucherHost ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("viewVoucher") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -554,6 +570,8 @@ public function collectNow(array $params, array $headers = []): CollectNowHosted ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("collectNow") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -592,6 +610,8 @@ public function acceptQuote(array $params, array $headers = []): AcceptQuoteHost ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("acceptQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -747,6 +767,8 @@ public function checkoutNewForItems(array $params, array $headers = []): Checkou ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutNewForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -787,6 +809,8 @@ public function claimGift(array $params, array $headers = []): ClaimGiftHostedPa ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("claimGift") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -910,6 +934,8 @@ public function checkoutExistingForItems(array $params, array $headers = []): Ch ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutExistingForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -949,6 +975,8 @@ public function preCancel(array $params, array $headers = []): PreCancelHostedPa ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("preCancel") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -980,6 +1008,8 @@ public function acknowledge(string $id, array $headers = []): AcknowledgeHostedP ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("acknowledge") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1014,6 +1044,8 @@ public function retrieveAgreementPdf(array $params, array $headers = []): Retrie ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("retrieveAgreementPdf") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1044,6 +1076,8 @@ public function retrieve(string $id, array $headers = []): RetrieveHostedPageRes ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1086,6 +1120,8 @@ public function managePaymentSources(array $params, array $headers = []): Manage ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("managePaymentSources") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1204,6 +1240,8 @@ public function checkoutOneTime(array $params = [], array $headers = []): Checko ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutOneTime") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1337,6 +1375,8 @@ public function checkoutNew(array $params, array $headers = []): CheckoutNewHost ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutNew") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1386,6 +1426,8 @@ public function checkoutGift(array $params, array $headers = []): CheckoutGiftHo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutGift") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1483,6 +1525,8 @@ public function checkoutExisting(array $params, array $headers = []): CheckoutEx ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("hostedPage") + ->withTelemetryOperation("checkoutExisting") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/InAppSubscriptionActions.php b/src/Actions/InAppSubscriptionActions.php index 336287ac..25f65252 100644 --- a/src/Actions/InAppSubscriptionActions.php +++ b/src/Actions/InAppSubscriptionActions.php @@ -54,6 +54,8 @@ public function retrieveStoreSubs(string $id, array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("inAppSubscription") + ->withTelemetryOperation("retrieveStoreSubs") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -95,6 +97,8 @@ public function importReceipt(string $id, array $params, array $headers = []): I ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("inAppSubscription") + ->withTelemetryOperation("importReceipt") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -142,6 +146,8 @@ public function importSubscription(string $id, array $params, array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("inAppSubscription") + ->withTelemetryOperation("importSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -191,6 +197,8 @@ public function processReceipt(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("inAppSubscription") + ->withTelemetryOperation("processReceipt") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/InvoiceActions.php b/src/Actions/InvoiceActions.php index 19f3a990..73250948 100644 --- a/src/Actions/InvoiceActions.php +++ b/src/Actions/InvoiceActions.php @@ -93,6 +93,8 @@ public function deleteLineItems(string $id, array $params = [], array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("deleteLineItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -129,6 +131,8 @@ public function removeCreditNote(string $id, array $params, array $headers = []) ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("removeCreditNote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -165,6 +169,8 @@ public function removePayment(string $id, array $params, array $headers = []): R ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("removePayment") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -199,6 +205,8 @@ public function stopDunning(string $id, array $params = [], array $headers = []) ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("stopDunning") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -237,6 +245,8 @@ public function applyPayments(string $id, array $params = [], array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("applyPayments") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -272,6 +282,8 @@ public function applyPaymentScheduleScheme(string $id, array $params, array $hea ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("applyPaymentScheduleScheme") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -307,6 +319,8 @@ public function voidInvoice(string $id, array $params = [], array $headers = []) ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("voidInvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -354,6 +368,8 @@ public function addCharge(string $id, array $params, array $headers = []): AddCh ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("addCharge") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -385,6 +401,8 @@ public function sendEinvoice(string $id, array $headers = []): SendEinvoiceInvoi ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("sendEinvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -415,6 +433,8 @@ public function paymentSchedules(string $id, array $headers = []): PaymentSchedu ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("paymentSchedules") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -449,6 +469,8 @@ public function writeOff(string $id, array $params = [], array $headers = []): W ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("writeOff") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -503,6 +525,8 @@ public function addChargeItem(string $id, array $params, array $headers = []): A ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("addChargeItem") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -538,6 +562,8 @@ public function pauseDunning(string $id, array $params, array $headers = []): Pa ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("pauseDunning") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -719,6 +745,8 @@ public function all(array $params = [], array $headers = []): ListInvoiceRespons ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -880,6 +908,8 @@ public function create(array $params = [], array $headers = []): CreateInvoiceRe ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -921,6 +951,8 @@ public function close(string $id, array $params = [], array $headers = []): Clos ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("close") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -958,6 +990,8 @@ public function applyCredits(string $id, array $params = [], array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("applyCredits") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1000,6 +1034,8 @@ public function retrieve(string $id, array $params = [], array $headers = []): R ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1060,6 +1096,8 @@ public function createForChargeItem(array $params, array $headers = []): CreateF ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("createForChargeItem") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1240,6 +1278,8 @@ public function createForChargeItemsAndCharges(array $params, array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("createForChargeItemsAndCharges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1312,6 +1352,8 @@ public function updateDetails(string $id, array $params = [], array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("updateDetails") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1347,6 +1389,8 @@ public function invoicesForCustomer(string $id, array $params = [], array $heade ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("invoicesForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1392,6 +1436,8 @@ public function recordPayment(string $id, array $params, array $headers = []): R ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("recordPayment") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1426,6 +1472,8 @@ public function delete(string $id, array $params = [], array $headers = []): Del ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1617,6 +1665,8 @@ public function importInvoice(array $params, array $headers = []): ImportInvoice ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("importInvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1651,6 +1701,8 @@ public function resumeDunning(string $id, array $params = [], array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("resumeDunning") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1690,6 +1742,8 @@ public function recordTaxWithheld(string $id, array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("recordTaxWithheld") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1721,6 +1775,8 @@ public function resendEinvoice(string $id, array $headers = []): ResendEinvoiceI ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("resendEinvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1757,6 +1813,8 @@ public function removeTaxWithheld(string $id, array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("removeTaxWithheld") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1801,6 +1859,8 @@ public function listPaymentReferenceNumbers(array $params = [], array $headers = ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("listPaymentReferenceNumbers") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1839,6 +1899,8 @@ public function collectPayment(string $id, array $params = [], array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("collectPayment") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1870,6 +1932,8 @@ public function syncUsages(string $id, array $headers = []): SyncUsagesInvoiceRe ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("syncUsages") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1910,6 +1974,8 @@ public function refund(string $id, array $params = [], array $headers = []): Ref ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("refund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1956,6 +2022,8 @@ public function recordRefund(string $id, array $params, array $headers = []): Re ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("recordRefund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1990,6 +2058,8 @@ public function pdf(string $id, array $params = [], array $headers = []): PdfInv ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("pdf") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2025,6 +2095,8 @@ public function invoicesForSubscription(string $id, array $params = [], array $h ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("invoicesForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2055,6 +2127,8 @@ public function downloadEinvoice(string $id, array $headers = []): DownloadEinvo ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("downloadEinvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2103,6 +2177,8 @@ public function chargeAddon(array $params, array $headers = []): ChargeAddonInvo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("chargeAddon") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2147,6 +2223,8 @@ public function addAddonCharge(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("addAddonCharge") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2202,6 +2280,8 @@ public function charge(array $params, array $headers = []): ChargeInvoiceRespons ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("invoice") + ->withTelemetryOperation("charge") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/ItemActions.php b/src/Actions/ItemActions.php index 598d5b0b..2e459e5a 100644 --- a/src/Actions/ItemActions.php +++ b/src/Actions/ItemActions.php @@ -142,6 +142,8 @@ public function all(array $params = [], array $headers = []): ListItemResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("item") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -206,6 +208,8 @@ public function create(array $params, array $headers = []): CreateItemResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("item") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -237,6 +241,8 @@ public function delete(string $id, array $headers = []): DeleteItemResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("item") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -267,6 +273,8 @@ public function retrieve(string $id, array $headers = []): RetrieveItemResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("item") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -337,6 +345,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("item") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/ItemEntitlementActions.php b/src/Actions/ItemEntitlementActions.php index 135e6178..13763faf 100644 --- a/src/Actions/ItemEntitlementActions.php +++ b/src/Actions/ItemEntitlementActions.php @@ -56,6 +56,8 @@ public function itemEntitlementsForFeature(string $id, array $params = [], array ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("itemEntitlement") + ->withTelemetryOperation("itemEntitlementsForFeature") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -95,6 +97,8 @@ public function addItemEntitlements(string $id, array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("itemEntitlement") + ->withTelemetryOperation("addItemEntitlements") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -131,6 +135,8 @@ public function itemEntitlementsForItem(string $id, array $params = [], array $h ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("itemEntitlement") + ->withTelemetryOperation("itemEntitlementsForItem") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -169,6 +175,8 @@ public function upsertOrRemoveItemEntitlementsForItem(string $id, array $params, ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("itemEntitlement") + ->withTelemetryOperation("upsertOrRemoveItemEntitlementsForItem") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/ItemFamilyActions.php b/src/Actions/ItemFamilyActions.php index 95401836..b2f019e0 100644 --- a/src/Actions/ItemFamilyActions.php +++ b/src/Actions/ItemFamilyActions.php @@ -53,6 +53,8 @@ public function delete(string $id, array $headers = []): DeleteItemFamilyRespons ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("itemFamily") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -112,6 +114,8 @@ public function all(array $params = [], array $headers = []): ListItemFamilyResp ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("itemFamily") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -149,6 +153,8 @@ public function create(array $params, array $headers = []): CreateItemFamilyResp ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("itemFamily") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -179,6 +185,8 @@ public function retrieve(string $id, array $headers = []): RetrieveItemFamilyRes ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("itemFamily") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -214,6 +222,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("itemFamily") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/ItemPriceActions.php b/src/Actions/ItemPriceActions.php index a7e2eb76..f563f943 100644 --- a/src/Actions/ItemPriceActions.php +++ b/src/Actions/ItemPriceActions.php @@ -54,6 +54,8 @@ public function retrieve(string $id, array $headers = []): RetrieveItemPriceResp ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("itemPrice") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -146,6 +148,8 @@ public function update(string $id, array $params, array $headers = []): UpdateIt ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("itemPrice") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -177,6 +181,8 @@ public function delete(string $id, array $headers = []): DeleteItemPriceResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("itemPrice") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -216,6 +222,8 @@ public function findApplicableItemPrices(string $id, array $params = [], array $ ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("itemPrice") + ->withTelemetryOperation("findApplicableItemPrices") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -254,6 +262,8 @@ public function findApplicableItems(string $id, array $params = [], array $heade ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("itemPrice") + ->withTelemetryOperation("findApplicableItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -401,6 +411,8 @@ public function all(array $params = [], array $headers = []): ListItemPriceRespo ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("itemPrice") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -495,6 +507,8 @@ public function create(array $params, array $headers = []): CreateItemPriceRespo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("itemPrice") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/LedgerAccountBalanceActions.php b/src/Actions/LedgerAccountBalanceActions.php index 5c7de425..9a17dc6e 100644 --- a/src/Actions/LedgerAccountBalanceActions.php +++ b/src/Actions/LedgerAccountBalanceActions.php @@ -58,6 +58,8 @@ public function listLedgerAccountBalances(array $params, array $headers = []): L ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("ledgerAccountBalance") + ->withTelemetryOperation("listLedgerAccountBalances") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/LedgerOperationActions.php b/src/Actions/LedgerOperationActions.php index 259bd46b..4adeae1a 100644 --- a/src/Actions/LedgerOperationActions.php +++ b/src/Actions/LedgerOperationActions.php @@ -63,6 +63,8 @@ public function releaseAuthorization(array $params, array $headers = []): Releas ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("ledgerOperation") + ->withTelemetryOperation("releaseAuthorization") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -104,6 +106,8 @@ public function capture(array $params, array $headers = []): CaptureLedgerOperat ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("ledgerOperation") + ->withTelemetryOperation("capture") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -146,6 +150,8 @@ public function authorize(array $params, array $headers = []): AuthorizeLedgerOp ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("ledgerOperation") + ->withTelemetryOperation("authorize") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -200,6 +206,8 @@ public function listLedgerOperations(array $params, array $headers = []): ListLe ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("ledgerOperation") + ->withTelemetryOperation("listLedgerOperations") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -240,6 +248,8 @@ public function captureAuthorization(array $params, array $headers = []): Captur ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("ledgerOperation") + ->withTelemetryOperation("captureAuthorization") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -270,6 +280,8 @@ public function retrieveLedgerOperation(string $id, array $headers = []): Retrie ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("ledgerOperation") + ->withTelemetryOperation("retrieveLedgerOperation") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/NonSubscriptionActions.php b/src/Actions/NonSubscriptionActions.php index 01b614a3..d1a2214d 100644 --- a/src/Actions/NonSubscriptionActions.php +++ b/src/Actions/NonSubscriptionActions.php @@ -65,6 +65,8 @@ public function processReceipt(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("nonSubscription") + ->withTelemetryOperation("processReceipt") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/OfferEventActions.php b/src/Actions/OfferEventActions.php index fc7642ae..ae916a9e 100644 --- a/src/Actions/OfferEventActions.php +++ b/src/Actions/OfferEventActions.php @@ -54,6 +54,8 @@ public function offerEvents(array $params, array $headers = []): OfferEventsOffe ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("offerEvent") + ->withTelemetryOperation("offerEvents") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/OfferFulfillmentActions.php b/src/Actions/OfferFulfillmentActions.php index 8c7f099b..2f166fc5 100644 --- a/src/Actions/OfferFulfillmentActions.php +++ b/src/Actions/OfferFulfillmentActions.php @@ -56,6 +56,8 @@ public function offerFulfillments(array $params, array $headers = []): OfferFulf ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("offerFulfillment") + ->withTelemetryOperation("offerFulfillments") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -86,6 +88,8 @@ public function offerFulfillmentsGet(string $id, array $headers = []): OfferFulf ->withSubDomain("grow") ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("offerFulfillment") + ->withTelemetryOperation("offerFulfillmentsGet") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -123,6 +127,8 @@ public function offerFulfillmentsUpdate(string $id, array $params, array $header ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("offerFulfillment") + ->withTelemetryOperation("offerFulfillmentsUpdate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/OmnichannelOneTimeOrderActions.php b/src/Actions/OmnichannelOneTimeOrderActions.php index a07f279a..5a3aa830 100644 --- a/src/Actions/OmnichannelOneTimeOrderActions.php +++ b/src/Actions/OmnichannelOneTimeOrderActions.php @@ -64,6 +64,8 @@ public function all(array $params = [], array $headers = []): ListOmnichannelOne ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("omnichannelOneTimeOrder") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -94,6 +96,8 @@ public function retrieve(string $id, array $headers = []): RetrieveOmnichannelOn ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("omnichannelOneTimeOrder") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/OmnichannelSubscriptionActions.php b/src/Actions/OmnichannelSubscriptionActions.php index c0a48624..884f803d 100644 --- a/src/Actions/OmnichannelSubscriptionActions.php +++ b/src/Actions/OmnichannelSubscriptionActions.php @@ -55,6 +55,8 @@ public function move(string $id, array $params, array $headers = []): MoveOmnich ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("omnichannelSubscription") + ->withTelemetryOperation("move") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -85,6 +87,8 @@ public function retrieve(string $id, array $headers = []): RetrieveOmnichannelSu ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("omnichannelSubscription") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -119,6 +123,8 @@ public function omnichannelTransactionsForOmnichannelSubscription(string $id, ar ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("omnichannelSubscription") + ->withTelemetryOperation("omnichannelTransactionsForOmnichannelSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -205,6 +211,8 @@ public function all(array $params = [], array $headers = []): ListOmnichannelSub ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("omnichannelSubscription") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/OmnichannelSubscriptionItemActions.php b/src/Actions/OmnichannelSubscriptionItemActions.php index 57314c47..0feebced 100644 --- a/src/Actions/OmnichannelSubscriptionItemActions.php +++ b/src/Actions/OmnichannelSubscriptionItemActions.php @@ -52,6 +52,8 @@ public function listOmniSubItemScheduleChanges(string $id, array $params = [], a ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("omnichannelSubscriptionItem") + ->withTelemetryOperation("listOmniSubItemScheduleChanges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/OrderActions.php b/src/Actions/OrderActions.php index 396e8299..1717309d 100644 --- a/src/Actions/OrderActions.php +++ b/src/Actions/OrderActions.php @@ -150,6 +150,8 @@ public function all(array $params = [], array $headers = []): ListOrderResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("order") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -192,6 +194,8 @@ public function create(array $params, array $headers = []): CreateOrderResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -279,6 +283,8 @@ public function importOrder(array $params, array $headers = []): ImportOrderOrde ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("importOrder") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -310,6 +316,8 @@ public function assignOrderNumber(string $id, array $headers = []): AssignOrderN ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("assignOrderNumber") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -349,6 +357,8 @@ public function resend(string $id, array $params = [], array $headers = []): Res ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("resend") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -383,6 +393,8 @@ public function reopen(string $id, array $params = [], array $headers = []): Reo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("reopen") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -418,6 +430,8 @@ public function ordersForInvoice(string $id, array $params = [], array $headers ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("order") + ->withTelemetryOperation("ordersForInvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -458,6 +472,8 @@ public function cancel(string $id, array $params, array $headers = []): CancelOr ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("cancel") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -488,6 +504,8 @@ public function retrieve(string $id, array $headers = []): RetrieveOrderResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("order") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -556,6 +574,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -587,6 +607,8 @@ public function delete(string $id, array $headers = []): DeleteOrderResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -626,6 +648,8 @@ public function createRefundableCreditNote(string $id, array $params, array $hea ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("order") + ->withTelemetryOperation("createRefundableCreditNote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PaymentIntentActions.php b/src/Actions/PaymentIntentActions.php index e73efbb0..b604e515 100644 --- a/src/Actions/PaymentIntentActions.php +++ b/src/Actions/PaymentIntentActions.php @@ -49,6 +49,8 @@ public function retrieve(string $id, array $headers = []): RetrievePaymentIntent ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("paymentIntent") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -88,6 +90,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentIntent") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -131,6 +135,8 @@ public function create(array $params, array $headers = []): CreatePaymentIntentR ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentIntent") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PaymentScheduleSchemeActions.php b/src/Actions/PaymentScheduleSchemeActions.php index a7a9d190..1f0fbc97 100644 --- a/src/Actions/PaymentScheduleSchemeActions.php +++ b/src/Actions/PaymentScheduleSchemeActions.php @@ -49,6 +49,8 @@ public function retrieve(string $id, array $headers = []): RetrievePaymentSchedu ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("paymentScheduleScheme") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -90,6 +92,8 @@ public function create(array $params, array $headers = []): CreatePaymentSchedul ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentScheduleScheme") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -121,6 +125,8 @@ public function delete(string $id, array $headers = []): DeletePaymentScheduleSc ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("paymentScheduleScheme") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PaymentSourceActions.php b/src/Actions/PaymentSourceActions.php index f86e8802..f6d69c43 100644 --- a/src/Actions/PaymentSourceActions.php +++ b/src/Actions/PaymentSourceActions.php @@ -100,6 +100,8 @@ public function createUsingPermanentToken(array $params, array $headers = []): C ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("createUsingPermanentToken") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -131,6 +133,8 @@ public function delete(string $id, array $headers = []): DeletePaymentSourceResp ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -185,6 +189,8 @@ public function createCard(array $params, array $headers = []): CreateCardPaymen ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("createCard") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -220,6 +226,8 @@ public function verifyBankAccount(string $id, array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("verifyBankAccount") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -291,6 +299,8 @@ public function all(array $params = [], array $headers = []): ListPaymentSourceR ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -325,6 +335,8 @@ public function exportPaymentSource(string $id, array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("exportPaymentSource") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -372,6 +384,8 @@ public function createUsingPaymentIntent(array $params, array $headers = []): Cr ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("createUsingPaymentIntent") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -402,6 +416,8 @@ public function retrieve(string $id, array $headers = []): RetrievePaymentSource ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -443,6 +459,8 @@ public function createVoucherPaymentSource(array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("createVoucherPaymentSource") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -484,6 +502,8 @@ public function createUsingTempToken(array $params, array $headers = []): Create ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("createUsingTempToken") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -535,6 +555,8 @@ public function updateCard(string $id, array $params = [], array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("updateCard") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -569,6 +591,8 @@ public function switchGatewayAccount(string $id, array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("switchGatewayAccount") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -605,6 +629,8 @@ public function createUsingToken(array $params, array $headers = []): CreateUsin ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("createUsingToken") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -636,6 +662,8 @@ public function deleteLocal(string $id, array $headers = []): DeleteLocalPayment ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("deleteLocal") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -691,6 +719,8 @@ public function createBankAccount(array $params, array $headers = []): CreateBan ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("createBankAccount") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -729,6 +759,8 @@ public function updateBankAccount(string $id, array $params = [], array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentSource") + ->withTelemetryOperation("updateBankAccount") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PaymentVoucherActions.php b/src/Actions/PaymentVoucherActions.php index 7a189baa..e5a244e4 100644 --- a/src/Actions/PaymentVoucherActions.php +++ b/src/Actions/PaymentVoucherActions.php @@ -65,6 +65,8 @@ public function paymentVouchersForCustomer(string $id, array $params = [], array ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("paymentVoucher") + ->withTelemetryOperation("paymentVouchersForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -109,6 +111,8 @@ public function paymentVouchersForInvoice(string $id, array $params = [], array ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("paymentVoucher") + ->withTelemetryOperation("paymentVouchersForInvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -139,6 +143,8 @@ public function retrieve(string $id, array $headers = []): RetrievePaymentVouche ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("paymentVoucher") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -180,6 +186,8 @@ public function create(array $params, array $headers = []): CreatePaymentVoucher ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("paymentVoucher") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PersonalizedOfferActions.php b/src/Actions/PersonalizedOfferActions.php index 04cf967b..8ab55ee9 100644 --- a/src/Actions/PersonalizedOfferActions.php +++ b/src/Actions/PersonalizedOfferActions.php @@ -68,6 +68,8 @@ public function personalizedOffers(array $params, array $headers = []): Personal ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("personalizedOffer") + ->withTelemetryOperation("personalizedOffers") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PlanActions.php b/src/Actions/PlanActions.php index 1fa80f5f..d40c4f3f 100644 --- a/src/Actions/PlanActions.php +++ b/src/Actions/PlanActions.php @@ -55,6 +55,8 @@ public function unarchive(string $id, array $headers = []): UnarchivePlanRespons ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("plan") + ->withTelemetryOperation("unarchive") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -86,6 +88,8 @@ public function delete(string $id, array $headers = []): DeletePlanResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("plan") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -123,6 +127,8 @@ public function copy(array $params, array $headers = []): CopyPlanResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("plan") + ->withTelemetryOperation("copy") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -258,6 +264,8 @@ public function all(array $params = [], array $headers = []): ListPlanResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("plan") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -369,6 +377,8 @@ public function create(array $params, array $headers = []): CreatePlanResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("plan") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -399,6 +409,8 @@ public function retrieve(string $id, array $headers = []): RetrievePlanResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("plan") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -506,6 +518,8 @@ public function update(string $id, array $params, array $headers = []): UpdatePl ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("plan") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PortalSessionActions.php b/src/Actions/PortalSessionActions.php index 42a2167e..dc438a27 100644 --- a/src/Actions/PortalSessionActions.php +++ b/src/Actions/PortalSessionActions.php @@ -58,6 +58,8 @@ public function create(array $params, array $headers = []): CreatePortalSessionR ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("portalSession") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -92,6 +94,8 @@ public function activate(string $id, array $params, array $headers = []): Activa ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("portalSession") + ->withTelemetryOperation("activate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -123,6 +127,8 @@ public function logout(string $id, array $headers = []): LogoutPortalSessionResp ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("portalSession") + ->withTelemetryOperation("logout") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -153,6 +159,8 @@ public function retrieve(string $id, array $headers = []): RetrievePortalSession ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("portalSession") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PriceVariantActions.php b/src/Actions/PriceVariantActions.php index 1d6b672b..b3715575 100644 --- a/src/Actions/PriceVariantActions.php +++ b/src/Actions/PriceVariantActions.php @@ -53,6 +53,8 @@ public function delete(string $id, array $headers = []): DeletePriceVariantRespo ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("priceVariant") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -130,6 +132,8 @@ public function all(array $params = [], array $headers = []): ListPriceVariantRe ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("priceVariant") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -173,6 +177,8 @@ public function create(array $params, array $headers = []): CreatePriceVariantRe ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("priceVariant") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -203,6 +209,8 @@ public function retrieve(string $id, array $headers = []): RetrievePriceVariantR ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("priceVariant") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -245,6 +253,8 @@ public function update(string $id, array $params, array $headers = []): UpdatePr ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("priceVariant") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PricingPageSessionActions.php b/src/Actions/PricingPageSessionActions.php index 1ee6f3a7..015bb42c 100644 --- a/src/Actions/PricingPageSessionActions.php +++ b/src/Actions/PricingPageSessionActions.php @@ -76,6 +76,8 @@ public function createForExistingSubscription(array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("pricingPageSession") + ->withTelemetryOperation("createForExistingSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -177,6 +179,8 @@ public function createForNewSubscription(array $params, array $headers = []): Cr ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("pricingPageSession") + ->withTelemetryOperation("createForNewSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PromotionalCreditActions.php b/src/Actions/PromotionalCreditActions.php index e276fd15..e95d26d9 100644 --- a/src/Actions/PromotionalCreditActions.php +++ b/src/Actions/PromotionalCreditActions.php @@ -52,6 +52,8 @@ public function retrieve(string $id, array $headers = []): RetrievePromotionalCr ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("promotionalCredit") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -108,6 +110,8 @@ public function all(array $params = [], array $headers = []): ListPromotionalCre ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("promotionalCredit") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -148,6 +152,8 @@ public function deduct(array $params, array $headers = []): DeductPromotionalCre ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("promotionalCredit") + ->withTelemetryOperation("deduct") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -188,6 +194,8 @@ public function set(array $params, array $headers = []): SetPromotionalCreditRes ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("promotionalCredit") + ->withTelemetryOperation("set") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -228,6 +236,8 @@ public function add(array $params, array $headers = []): AddPromotionalCreditRes ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("promotionalCredit") + ->withTelemetryOperation("add") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PromotionalGrantActions.php b/src/Actions/PromotionalGrantActions.php index 2d280aa6..1c88d3c8 100644 --- a/src/Actions/PromotionalGrantActions.php +++ b/src/Actions/PromotionalGrantActions.php @@ -58,6 +58,8 @@ public function promotionalGrants(array $params, array $headers = []): Promotion ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("promotionalGrant") + ->withTelemetryOperation("promotionalGrants") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/PurchaseActions.php b/src/Actions/PurchaseActions.php index bd92f491..5bcea696 100644 --- a/src/Actions/PurchaseActions.php +++ b/src/Actions/PurchaseActions.php @@ -130,6 +130,8 @@ public function create(array $params, array $headers = []): CreatePurchaseRespon ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("purchase") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -239,6 +241,8 @@ public function estimate(array $params, array $headers = []): EstimatePurchaseRe ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("purchase") + ->withTelemetryOperation("estimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/QuoteActions.php b/src/Actions/QuoteActions.php index 0f4de861..fedce707 100644 --- a/src/Actions/QuoteActions.php +++ b/src/Actions/QuoteActions.php @@ -180,6 +180,8 @@ public function createSubItemsForCustomerQuote(string $id, array $params, array ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("createSubItemsForCustomerQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -210,6 +212,8 @@ public function retrieve(string $id, array $headers = []): RetrieveQuoteResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("quote") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -247,6 +251,8 @@ public function updateSignatureStatus(string $id, array $params = [], array $hea ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("updateSignatureStatus") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -279,6 +285,8 @@ public function updateSignature(string $id, array $headers = []): UpdateSignatur ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("updateSignature") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -314,6 +322,8 @@ public function updateStatus(string $id, array $params, array $headers = []): Up ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("updateStatus") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -348,6 +358,8 @@ public function extendExpiryDate(string $id, array $params, array $headers = []) ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("extendExpiryDate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -380,6 +392,8 @@ public function retrieveSignedPdf(string $id, array $headers = []): RetrieveSign ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("retrieveSignedPdf") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -527,6 +541,8 @@ public function editUpdateSubscriptionQuoteForItems(string $id, array $params, a ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("editUpdateSubscriptionQuoteForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -606,6 +622,8 @@ public function all(array $params = [], array $headers = []): ListQuoteResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("quote") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -637,6 +655,8 @@ public function retrieveSignature(string $id, array $headers = []): RetrieveSign ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("quote") + ->withTelemetryOperation("retrieveSignature") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -680,6 +700,8 @@ public function convert(string $id, array $params = [], array $headers = []): Co ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("convert") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -714,6 +736,8 @@ public function delete(string $id, array $params = [], array $headers = []): Del ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -850,6 +874,8 @@ public function editCreateSubCustomerQuoteForItems(string $id, array $params, ar ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("editCreateSubCustomerQuoteForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -999,6 +1025,8 @@ public function updateSubscriptionQuoteForItems(array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("updateSubscriptionQuoteForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1033,6 +1061,8 @@ public function quoteLineGroupsForQuote(string $id, array $params = [], array $h ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("quote") + ->withTelemetryOperation("quoteLineGroupsForQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1145,6 +1175,8 @@ public function editForChargeItemsAndCharges(string $id, array $params, array $h ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("editForChargeItemsAndCharges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1177,6 +1209,8 @@ public function createSignature(string $id, array $headers = []): CreateSignatur ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("createSignature") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1209,6 +1243,8 @@ public function refreshSignatureLink(string $id, array $headers = []): RefreshSi ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("refreshSignatureLink") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1244,6 +1280,8 @@ public function pdf(string $id, array $params = [], array $headers = []): PdfQuo ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("pdf") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1358,6 +1396,8 @@ public function createForChargeItemsAndCharges(array $params, array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("createForChargeItemsAndCharges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1435,6 +1475,8 @@ public function editOneTimeQuote(string $id, array $params = [], array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("editOneTimeQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1559,6 +1601,8 @@ public function updateSubscriptionQuote(array $params, array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("updateSubscriptionQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1638,6 +1682,8 @@ public function createForOnetimeCharges(array $params, array $headers = []): Cre ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("createForOnetimeCharges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1733,6 +1779,8 @@ public function createSubForCustomerQuote(string $id, array $params, array $head ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("createSubForCustomerQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1855,6 +1903,8 @@ public function editUpdateSubscriptionQuote(string $id, array $params = [], arra ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("editUpdateSubscriptionQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1949,6 +1999,8 @@ public function editCreateSubForCustomerQuote(string $id, array $params, array $ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("quote") + ->withTelemetryOperation("editCreateSubForCustomerQuote") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/RampActions.php b/src/Actions/RampActions.php index 1eb86739..e11c1e66 100644 --- a/src/Actions/RampActions.php +++ b/src/Actions/RampActions.php @@ -52,6 +52,8 @@ public function retrieve(string $id, array $headers = []): RetrieveRampResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("ramp") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -144,6 +146,8 @@ public function createForSubscription(string $id, array $params, array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("ramp") + ->withTelemetryOperation("createForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -203,6 +207,8 @@ public function all(array $params, array $headers = []): ListRampResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("ramp") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -295,6 +301,8 @@ public function update(string $id, array $params, array $headers = []): UpdateRa ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("ramp") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -326,6 +334,8 @@ public function delete(string $id, array $headers = []): DeleteRampResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("ramp") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/RecordedPurchaseActions.php b/src/Actions/RecordedPurchaseActions.php index aabe0658..78ad9798 100644 --- a/src/Actions/RecordedPurchaseActions.php +++ b/src/Actions/RecordedPurchaseActions.php @@ -48,6 +48,8 @@ public function retrieve(string $id, array $headers = []): RetrieveRecordedPurch ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("recordedPurchase") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -98,6 +100,8 @@ public function create(array $params, array $headers = []): CreateRecordedPurcha ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("recordedPurchase") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/ResourceMigrationActions.php b/src/Actions/ResourceMigrationActions.php index 51cfb2e5..0f8a61b4 100644 --- a/src/Actions/ResourceMigrationActions.php +++ b/src/Actions/ResourceMigrationActions.php @@ -52,6 +52,8 @@ public function retrieveLatest(array $params, array $headers = []): RetrieveLate ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("resourceMigration") + ->withTelemetryOperation("retrieveLatest") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/RuleActions.php b/src/Actions/RuleActions.php index de0b1980..ac8e9e7e 100644 --- a/src/Actions/RuleActions.php +++ b/src/Actions/RuleActions.php @@ -47,6 +47,8 @@ public function retrieve(string $id, array $headers = []): RetrieveRuleResponse ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("rule") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/SiteMigrationDetailActions.php b/src/Actions/SiteMigrationDetailActions.php index 743a5ab8..4f07a7c1 100644 --- a/src/Actions/SiteMigrationDetailActions.php +++ b/src/Actions/SiteMigrationDetailActions.php @@ -79,6 +79,8 @@ public function all(array $params = [], array $headers = []): ListSiteMigrationD ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("siteMigrationDetail") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/SubscriptionActions.php b/src/Actions/SubscriptionActions.php index 71c0ab45..db67ce75 100644 --- a/src/Actions/SubscriptionActions.php +++ b/src/Actions/SubscriptionActions.php @@ -90,6 +90,8 @@ public function removeAdvanceInvoiceSchedule(string $id, array $params = [], arr ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("removeAdvanceInvoiceSchedule") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -298,6 +300,8 @@ public function updateForItems(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("updateForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -332,6 +336,8 @@ public function removeCoupons(string $id, array $params = [], array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("removeCoupons") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -380,6 +386,8 @@ public function resume(string $id, array $params = [], array $headers = []): Res ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("resume") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -432,6 +440,8 @@ public function cancelForItems(string $id, array $params = [], array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("cancelForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -469,6 +479,8 @@ public function regenerateInvoice(string $id, array $params = [], array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("regenerateInvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -628,6 +640,8 @@ public function all(array $params = [], array $headers = []): ListSubscriptionRe ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -856,6 +870,8 @@ public function create(array $params, array $headers = []): CreateSubscriptionRe ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -891,6 +907,8 @@ public function move(string $id, array $params, array $headers = []): MoveSubscr ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("move") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -926,6 +944,8 @@ public function subscriptionsForCustomer(string $id, array $params = [], array $ ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("subscriptionsForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1047,6 +1067,8 @@ public function createForCustomer(string $id, array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("createForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1183,6 +1205,8 @@ public function importForItems(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("importForItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1213,6 +1237,8 @@ public function retrieveAdvanceInvoiceSchedule(string $id, array $headers = []): ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("retrieveAdvanceInvoiceSchedule") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1252,6 +1278,8 @@ public function removeScheduledCancellation(string $id, array $params = [], arra ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("removeScheduledCancellation") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1282,6 +1310,8 @@ public function retrieveWithScheduledChanges(string $id, array $headers = []): R ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("retrieveWithScheduledChanges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1342,6 +1372,8 @@ public function reactivate(string $id, array $params = [], array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("reactivate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1388,6 +1420,8 @@ public function chargeFutureRenewals(string $id, array $params = [], array $head ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("chargeFutureRenewals") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1429,6 +1463,8 @@ public function addChargeAtTermEnd(string $id, array $params, array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("addChargeAtTermEnd") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1460,6 +1496,8 @@ public function removeScheduledChanges(string $id, array $headers = []): RemoveS ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("removeScheduledChanges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1496,6 +1534,8 @@ public function changeTermEnd(string $id, array $params, array $headers = []): C ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("changeTermEnd") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1527,6 +1567,8 @@ public function delete(string $id, array $headers = []): DeleteSubscriptionRespo ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1670,6 +1712,8 @@ public function createWithItems(string $id, array $params, array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("createWithItems") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1738,6 +1782,8 @@ public function importUnbilledCharges(string $id, array $params, array $headers ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("importUnbilledCharges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1769,6 +1815,8 @@ public function removeScheduledResumption(string $id, array $headers = []): Remo ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("removeScheduledResumption") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1799,6 +1847,8 @@ public function retrieve(string $id, array $headers = []): RetrieveSubscriptionR ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -1983,6 +2033,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2031,6 +2083,8 @@ public function importContractTerm(string $id, array $params = [], array $header ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("importContractTerm") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2066,6 +2120,8 @@ public function overrideBillingProfile(string $id, array $params = [], array $he ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("overrideBillingProfile") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2097,6 +2153,8 @@ public function removeScheduledPause(string $id, array $headers = []): RemoveSch ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("removeScheduledPause") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2143,6 +2201,8 @@ public function editAdvanceInvoiceSchedule(string $id, array $params = [], array ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("editAdvanceInvoiceSchedule") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2177,6 +2237,8 @@ public function listDiscounts(string $id, array $params = [], array $headers = [ ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("listDiscounts") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2215,6 +2277,8 @@ public function contractTermsForSubscription(string $id, array $params = [], arr ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("contractTermsForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2254,6 +2318,8 @@ public function pause(string $id, array $params = [], array $headers = []): Paus ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("pause") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2373,6 +2439,8 @@ public function importForCustomer(string $id, array $params, array $headers = [] ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("importForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2557,6 +2625,8 @@ public function importSubscription(array $params, array $headers = []): ImportSu ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("importSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2606,6 +2676,8 @@ public function cancel(string $id, array $params = [], array $headers = []): Can ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("cancel") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -2646,6 +2718,8 @@ public function chargeAddonAtTermEnd(string $id, array $params, array $headers = ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscription") + ->withTelemetryOperation("chargeAddonAtTermEnd") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/SubscriptionEntitlementActions.php b/src/Actions/SubscriptionEntitlementActions.php index 6e9f4580..a652b7e6 100644 --- a/src/Actions/SubscriptionEntitlementActions.php +++ b/src/Actions/SubscriptionEntitlementActions.php @@ -56,6 +56,8 @@ public function setSubscriptionEntitlementAvailability(string $id, array $params ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("subscriptionEntitlement") + ->withTelemetryOperation("setSubscriptionEntitlementAvailability") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -93,6 +95,8 @@ public function subscriptionEntitlementsForSubscription(string $id, array $param ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("subscriptionEntitlement") + ->withTelemetryOperation("subscriptionEntitlementsForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/TimeMachineActions.php b/src/Actions/TimeMachineActions.php index c0542a2d..6dad8565 100644 --- a/src/Actions/TimeMachineActions.php +++ b/src/Actions/TimeMachineActions.php @@ -49,6 +49,8 @@ public function retrieve(string $id, array $headers = []): RetrieveTimeMachineRe ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("timeMachine") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -83,6 +85,8 @@ public function travelForward(string $id, array $params = [], array $headers = [ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("timeMachine") + ->withTelemetryOperation("travelForward") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -117,6 +121,8 @@ public function startAfresh(string $id, array $params = [], array $headers = []) ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("timeMachine") + ->withTelemetryOperation("startAfresh") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/TransactionActions.php b/src/Actions/TransactionActions.php index ea8e712f..d9954bc1 100644 --- a/src/Actions/TransactionActions.php +++ b/src/Actions/TransactionActions.php @@ -171,6 +171,8 @@ public function all(array $params = [], array $headers = []): ListTransactionRes ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -207,6 +209,8 @@ public function reconcile(string $id, array $params = [], array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("reconcile") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -237,6 +241,8 @@ public function retrieve(string $id, array $headers = []): RetrieveTransactionRe ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -272,6 +278,8 @@ public function refund(string $id, array $params = [], array $headers = []): Ref ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("refund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -307,6 +315,8 @@ public function transactionsForCustomer(string $id, array $params = [], array $h ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("transactionsForCustomer") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -346,6 +356,8 @@ public function recordRefund(string $id, array $params, array $headers = []): Re ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("recordRefund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -381,6 +393,8 @@ public function transactionsForSubscription(string $id, array $params = [], arra ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("transactionsForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -412,6 +426,8 @@ public function voidTransaction(string $id, array $headers = []): VoidTransactio ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("voidTransaction") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -443,6 +459,8 @@ public function syncTransaction(string $id, array $headers = []): SyncTransactio ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("syncTransaction") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -480,6 +498,8 @@ public function createAuthorization(array $params, array $headers = []): CreateA ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("createAuthorization") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -514,6 +534,8 @@ public function paymentsForInvoice(string $id, array $params = [], array $header ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("paymentsForInvoice") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -548,6 +570,8 @@ public function deleteOfflineTransaction(string $id, array $params = [], array $ ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("transaction") + ->withTelemetryOperation("deleteOfflineTransaction") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/UnbilledChargeActions.php b/src/Actions/UnbilledChargeActions.php index f2ea6b45..f58eedf7 100644 --- a/src/Actions/UnbilledChargeActions.php +++ b/src/Actions/UnbilledChargeActions.php @@ -54,6 +54,8 @@ public function delete(string $id, array $headers = []): DeleteUnbilledChargeRes ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("unbilledCharge") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -89,6 +91,8 @@ public function invoiceNowEstimate(array $params = [], array $headers = []): Inv ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("unbilledCharge") + ->withTelemetryOperation("invoiceNowEstimate") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -124,6 +128,8 @@ public function invoiceUnbilledCharges(array $params = [], array $headers = []): ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("unbilledCharge") + ->withTelemetryOperation("invoiceUnbilledCharges") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -176,6 +182,8 @@ public function all(array $params = [], array $headers = []): ListUnbilledCharge ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("unbilledCharge") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -251,6 +259,8 @@ public function create(array $params, array $headers = []): CreateUnbilledCharge ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("unbilledCharge") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -315,6 +325,8 @@ public function createUnbilledCharge(array $params, array $headers = []): Create ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("unbilledCharge") + ->withTelemetryOperation("createUnbilledCharge") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/UsageActions.php b/src/Actions/UsageActions.php index 95bab8cd..7d9a7ba5 100644 --- a/src/Actions/UsageActions.php +++ b/src/Actions/UsageActions.php @@ -59,6 +59,8 @@ public function pdf(array $params, array $headers = []): PdfUsageResponse ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("usage") + ->withTelemetryOperation("pdf") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -92,6 +94,8 @@ public function retrieve(string $id, array $params, array $headers = []): Retrie ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("usage") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -131,6 +135,8 @@ public function create(string $id, array $params, array $headers = []): CreateUs ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("usage") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -165,6 +171,8 @@ public function delete(string $id, array $params, array $headers = []): DeleteUs ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("usage") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -242,6 +250,8 @@ public function all(array $params = [], array $headers = []): ListUsageResponse ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("usage") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/UsageChargeActions.php b/src/Actions/UsageChargeActions.php index 51d34eb0..c0f34fe4 100644 --- a/src/Actions/UsageChargeActions.php +++ b/src/Actions/UsageChargeActions.php @@ -55,6 +55,8 @@ public function retrieveUsageChargesForSubscription(string $id, array $params = ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("usageCharge") + ->withTelemetryOperation("retrieveUsageChargesForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/UsageEventActions.php b/src/Actions/UsageEventActions.php index 2a0efca8..6f715a98 100644 --- a/src/Actions/UsageEventActions.php +++ b/src/Actions/UsageEventActions.php @@ -58,6 +58,8 @@ public function create(array $params, array $headers = []): CreateUsageEventResp ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("usageEvent") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -99,6 +101,8 @@ public function batchIngest(array $params, array $headers = []): BatchIngestUsag ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("usageEvent") + ->withTelemetryOperation("batchIngest") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/UsageFileActions.php b/src/Actions/UsageFileActions.php index 8736a7b3..a1f4678d 100644 --- a/src/Actions/UsageFileActions.php +++ b/src/Actions/UsageFileActions.php @@ -48,6 +48,8 @@ public function processingStatus(string $id, array $headers = []): ProcessingSta ->withSubDomain("file-ingest") ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("usageFile") + ->withTelemetryOperation("processingStatus") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -83,6 +85,8 @@ public function uploadUrl(array $params, array $headers = []): UploadUrlUsageFil ->withHeaders($headers) ->withParams($params) ->withIdempotent(false) + ->withTelemetryResource("usageFile") + ->withTelemetryOperation("uploadUrl") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/UsageSummaryActions.php b/src/Actions/UsageSummaryActions.php index 466b9a3c..2e2fab6a 100644 --- a/src/Actions/UsageSummaryActions.php +++ b/src/Actions/UsageSummaryActions.php @@ -56,6 +56,8 @@ public function retrieveUsageSummaryForSubscription(string $id, array $params, a ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("usageSummary") + ->withTelemetryOperation("retrieveUsageSummaryForSubscription") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/VirtualBankAccountActions.php b/src/Actions/VirtualBankAccountActions.php index bee91700..ad239f2c 100644 --- a/src/Actions/VirtualBankAccountActions.php +++ b/src/Actions/VirtualBankAccountActions.php @@ -55,6 +55,8 @@ public function deleteLocal(string $id, array $headers = []): DeleteLocalVirtual ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("virtualBankAccount") + ->withTelemetryOperation("deleteLocal") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -86,6 +88,8 @@ public function delete(string $id, array $headers = []): DeleteVirtualBankAccoun ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("virtualBankAccount") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -139,6 +143,8 @@ public function all(array $params = [], array $headers = []): ListVirtualBankAcc ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("virtualBankAccount") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -176,6 +182,8 @@ public function create(array $params, array $headers = []): CreateVirtualBankAcc ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("virtualBankAccount") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -207,6 +215,8 @@ public function syncFund(string $id, array $headers = []): SyncFundVirtualBankAc ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("virtualBankAccount") + ->withTelemetryOperation("syncFund") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -237,6 +247,8 @@ public function retrieve(string $id, array $headers = []): RetrieveVirtualBankAc ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("virtualBankAccount") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -274,6 +286,8 @@ public function createUsingPermanentToken(array $params, array $headers = []): C ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("virtualBankAccount") + ->withTelemetryOperation("createUsingPermanentToken") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Actions/WebhookEndpointActions.php b/src/Actions/WebhookEndpointActions.php index ebc90d67..af3eb2a0 100644 --- a/src/Actions/WebhookEndpointActions.php +++ b/src/Actions/WebhookEndpointActions.php @@ -53,6 +53,8 @@ public function delete(string $id, array $headers = []): DeleteWebhookEndpointRe ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withIdempotent(true) + ->withTelemetryResource("webhookEndpoint") + ->withTelemetryOperation("delete") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -83,6 +85,8 @@ public function retrieve(string $id, array $headers = []): RetrieveWebhookEndpoi ->withSubDomain(null) ->withJsonKeys($jsonKeys) ->withHeaders($headers) + ->withTelemetryResource("webhookEndpoint") + ->withTelemetryOperation("retrieve") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -125,6 +129,8 @@ public function update(string $id, array $params = [], array $headers = []): Upd ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("webhookEndpoint") + ->withTelemetryOperation("update") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -159,6 +165,8 @@ public function all(array $params = [], array $headers = []): ListWebhookEndpoin ->withJsonKeys($jsonKeys) ->withHeaders($headers) ->withParams($params) + ->withTelemetryResource("webhookEndpoint") + ->withTelemetryOperation("list") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); @@ -202,6 +210,8 @@ public function create(array $params, array $headers = []): CreateWebhookEndpoin ->withHeaders($headers) ->withParams($params) ->withIdempotent(true) + ->withTelemetryResource("webhookEndpoint") + ->withTelemetryOperation("create") ->build(); $apiRequester = new APIRequester($this->httpClientFactory, $this->env); $respObject = $apiRequester->makeRequest($payload); diff --git a/src/Telemetry/RequestTelemetryContext.php b/src/Telemetry/RequestTelemetryContext.php new file mode 100644 index 00000000..0f4968ef --- /dev/null +++ b/src/Telemetry/RequestTelemetryContext.php @@ -0,0 +1,31 @@ + $startAttributes + */ + public function __construct( + public readonly string $spanName, + public readonly string $resource, + public readonly string $operation, + public readonly string $httpMethod, + public readonly string $httpUrl, + public readonly string $serverAddress, + public readonly string $chargebeeSite, + public readonly string $chargebeeApiVersion, + public readonly string $sdkName, + public readonly string $sdkVersion, + public readonly array $startAttributes, + ) { + } +} diff --git a/src/Telemetry/RequestTelemetryError.php b/src/Telemetry/RequestTelemetryError.php new file mode 100644 index 00000000..e7ebadd1 --- /dev/null +++ b/src/Telemetry/RequestTelemetryError.php @@ -0,0 +1,21 @@ + $endAttributes + */ + public function __construct( + public readonly int $httpStatusCode, + public readonly int $durationMs, + public readonly ?RequestTelemetryError $error, + public readonly array $endAttributes, + ) { + } +} diff --git a/src/Telemetry/TelemetryAdapter.php b/src/Telemetry/TelemetryAdapter.php new file mode 100644 index 00000000..fd52d16e --- /dev/null +++ b/src/Telemetry/TelemetryAdapter.php @@ -0,0 +1,34 @@ + $requestHeaders mutable headers map for trace propagation + * @return mixed opaque handle passed back to onRequestEnd, or null + */ + public function onRequestStart(RequestTelemetryContext $context, array &$requestHeaders): mixed; + + /** + * Called once per SDK API call after the final response or terminal failure. + */ + public function onRequestEnd(mixed $handle, RequestTelemetryResult $result): void; +} diff --git a/src/Telemetry/TelemetryAttributeKeys.php b/src/Telemetry/TelemetryAttributeKeys.php new file mode 100644 index 00000000..ae9a20f3 --- /dev/null +++ b/src/Telemetry/TelemetryAttributeKeys.php @@ -0,0 +1,41 @@ +onRequestStart($context, $headers); } catch (\Throwable $err) { if ($env->getEnableDebugLogs()) { @@ -109,9 +109,13 @@ private static function endTelemetryFailure( } } + /** + * @param array $requestHeaders + */ private static function buildContext( Environment $env, ChargebeePayload $payload, + array $requestHeaders, ): RequestTelemetryContext { $parsed = parse_url($payload->getUrl()); $scheme = $parsed['scheme'] ?? 'https'; @@ -129,6 +133,7 @@ private static function buildContext( $env->getSite(), TelemetrySupport::resolveChargebeeApiVersion($apiPath), Version::VERSION, + $requestHeaders, ); } } diff --git a/src/Telemetry/TelemetrySupport.php b/src/Telemetry/TelemetrySupport.php new file mode 100644 index 00000000..53432ef4 --- /dev/null +++ b/src/Telemetry/TelemetrySupport.php @@ -0,0 +1,192 @@ + $requestHeaders + * @return array + */ + public static function buildRequestStartSpanAttributes( + string $resource, + string $operation, + string $httpMethod, + string $httpUrl, + string $serverAddress, + string $chargebeeSite, + string $chargebeeApiVersion, + string $sdkVersion, + array $requestHeaders = [], + ): array { + return array_merge([ + TelemetryAttributeKeys::URL_FULL => $httpUrl, + TelemetryAttributeKeys::HTTP_REQUEST_METHOD => $httpMethod, + TelemetryAttributeKeys::SERVER_ADDRESS => $serverAddress, + TelemetryAttributeKeys::CHARGEBEE_SITE => $chargebeeSite, + TelemetryAttributeKeys::CHARGEBEE_API_VERSION => $chargebeeApiVersion, + TelemetryAttributeKeys::CHARGEBEE_RESOURCE => $resource, + TelemetryAttributeKeys::CHARGEBEE_OPERATION => $operation, + TelemetryAttributeKeys::CHARGEBEE_SDK_NAME => TelemetryAttributeKeys::SDK_NAME, + TelemetryAttributeKeys::CHARGEBEE_SDK_VERSION => $sdkVersion, + ], self::buildRequestHeaderSpanAttributes($requestHeaders)); + } + + /** + * Promotes chargebee-* request headers to http.request.header.* attributes; excludes the chargebee-request-origin-* PII family. + * + * @param array $requestHeaders + * @return array + */ + public static function buildRequestHeaderSpanAttributes(array $requestHeaders): array + { + $attributes = []; + foreach ($requestHeaders as $name => $value) { + if ($value === null) { + continue; + } + $lowerName = strtolower((string) $name); + if ( + !str_starts_with($lowerName, TelemetryAttributeKeys::CHARGEBEE_TELEMETRY_HEADER_PREFIX) + || str_starts_with($lowerName, TelemetryAttributeKeys::CHARGEBEE_TELEMETRY_HEADER_EXCLUDE_PREFIX) + ) { + continue; + } + $attributes[TelemetryAttributeKeys::HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX . $lowerName] = (string) $value; + } + + return $attributes; + } + + /** + * @return array + */ + public static function buildRequestEndSpanAttributes( + int $httpStatusCode, + ?RequestTelemetryError $error, + ): array { + $attributes = [ + TelemetryAttributeKeys::HTTP_RESPONSE_STATUS_CODE => $httpStatusCode, + ]; + + if ($error !== null) { + $attributes[TelemetryAttributeKeys::ERROR_TYPE] = (string) $httpStatusCode; + + if ($error->chargebeeErrorCode !== null) { + $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_CODE] = $error->chargebeeErrorCode; + } + if ($error->chargebeeApiErrorType !== null) { + $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_TYPE] = $error->chargebeeApiErrorType; + } + if ($error->chargebeeErrorParam !== null) { + $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_PARAM] = $error->chargebeeErrorParam; + } + } + + return $attributes; + } + + /** + * @param array $requestHeaders + */ + public static function buildRequestTelemetryContext( + string $resource, + string $operation, + string $httpMethod, + string $httpUrl, + string $serverAddress, + string $chargebeeSite, + string $chargebeeApiVersion, + string $sdkVersion, + array $requestHeaders = [], + ): RequestTelemetryContext { + return new RequestTelemetryContext( + self::buildSpanName($resource, $operation), + $resource, + $operation, + $httpMethod, + $httpUrl, + $serverAddress, + $chargebeeSite, + $chargebeeApiVersion, + TelemetryAttributeKeys::SDK_NAME, + $sdkVersion, + self::buildRequestStartSpanAttributes( + $resource, + $operation, + $httpMethod, + $httpUrl, + $serverAddress, + $chargebeeSite, + $chargebeeApiVersion, + $sdkVersion, + $requestHeaders, + ), + ); + } + + public static function buildRequestTelemetryResult( + int $httpStatusCode, + int $durationMs, + ?RequestTelemetryError $error, + ): RequestTelemetryResult { + return new RequestTelemetryResult( + $httpStatusCode, + $durationMs, + $error, + self::buildRequestEndSpanAttributes($httpStatusCode, $error), + ); + } + + public static function extractRequestTelemetryError(?\Throwable $err): ?RequestTelemetryError + { + if ($err === null) { + return null; + } + + $message = $err->getMessage() !== '' ? $err->getMessage() : 'Chargebee API request failed'; + + if ($err instanceof APIError) { + return new RequestTelemetryError( + $message, + $err->getApiErrorCode(), + $err->getType(), + $err->getParam(), + ); + } + + return new RequestTelemetryError($message); + } + + public static function extractHttpStatusCode(?\Throwable $err): ?int + { + if ($err instanceof APIError) { + return $err->getHttpStatusCode(); + } + + return null; + } +} diff --git a/src/Version.php b/src/Version.php index cdb8658b..e9fe2cc9 100644 --- a/src/Version.php +++ b/src/Version.php @@ -4,7 +4,7 @@ final class Version { - const VERSION = '4.22.0'; + const VERSION = '4.23.0'; } ?> \ No newline at end of file diff --git a/tests/Telemetry/TelemetryExecutorTest.php b/tests/Telemetry/TelemetryExecutorTest.php index 5d5ae2f8..6ce0028b 100644 --- a/tests/Telemetry/TelemetryExecutorTest.php +++ b/tests/Telemetry/TelemetryExecutorTest.php @@ -122,6 +122,37 @@ public function testCallsAdapterOncePerApiCall(): void self::assertSame(200, $result->getStatusCode()); } + #[TestDox('promotes chargebee-* request headers and excludes chargebee-request-origin-* PII headers')] + public function testPromotesChargebeeRequestHeaders(): void + { + $adapter = new RecordingAdapter(); + $env = $this->makeEnvironment($adapter); + $payload = ChargebeePayload::builder() + ->withEnvironment($env) + ->withHttpMethod('get') + ->withUriPaths(['/customers']) + ->withParamEncoder(new URLFormEncoder()) + ->withTelemetryResource('customer') + ->withTelemetryOperation('list') + ->withHeaders([ + 'chargebee-foo' => 'bar', + 'Authorization' => 'Basic secret', + 'chargebee-request-origin-ip' => '202.170.207.70', + ]) + ->build(); + + TelemetryExecutor::execute( + $env, + $payload, + fn (ChargebeePayload $p) => new ResponseObject('{}', 200, []), + ); + + $attrs = $adapter->startContext?->startAttributes ?? []; + self::assertSame('bar', $attrs['http.request.header.chargebee-foo'] ?? null); + self::assertArrayNotHasKey('http.request.header.authorization', $attrs); + self::assertArrayNotHasKey('http.request.header.chargebee-request-origin-ip', $attrs); + } + #[TestDox('records failure details from APIError')] public function testRecordsFailureFromApiError(): void { From cc451c415a1c5b989db12a193d10ad147d37d267 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Tue, 30 Jun 2026 22:15:08 +0530 Subject: [PATCH 3/4] Update Readme --- README.md | 27 +++-- src/Telemetry/TelemetryExecutor.php | 26 +++-- tests/Telemetry/TelemetryExecutorTest.php | 110 ++++++++++++++++++++ tests/Telemetry/TelemetrySupportTest.php | 120 ++++++++++++++++++++++ 4 files changed, 269 insertions(+), 14 deletions(-) create mode 100644 tests/Telemetry/TelemetrySupportTest.php diff --git a/README.md b/README.md index c11723c5..a7c2117f 100644 --- a/README.md +++ b/README.md @@ -177,25 +177,30 @@ inbound request span > If you separately enable HTTP auto-instrumentation (e.g. an OpenTelemetry PHP agent on Guzzle), it will create an **additional transport-level HTTP span as a sibling** of the Chargebee span. For the cleanest trace where `chargebee.{resource}.{operation}` is the single propagating span, leave HTTP auto-instrumentation off for Chargebee calls. -#### OpenTelemetry example +#### OpenTelemetry setup + +OpenTelemetry is not bundled — install it in your app: ```sh -composer require chargebee/chargebee-php open-telemetry/opentelemetry open-telemetry/exporter-otlp +composer require open-telemetry/sdk open-telemetry/exporter-otlp ``` -Configure OpenTelemetry at app startup, then pass your adapter: +Configure OpenTelemetry at app startup (tracer provider, exporter, propagator), then pass your adapter: ```php use Chargebee\ChargebeeClient; use Chargebee\Telemetry\RequestTelemetryContext; use Chargebee\Telemetry\RequestTelemetryResult; use Chargebee\Telemetry\TelemetryAdapter; +use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator; +use OpenTelemetry\API\Trace\SpanInterface; use OpenTelemetry\API\Trace\SpanKind; use OpenTelemetry\API\Trace\StatusCode; +use OpenTelemetry\API\Trace\TracerInterface; class OtelTelemetryAdapter implements TelemetryAdapter { - public function __construct(private $tracer) {} + public function __construct(private readonly TracerInterface $tracer) {} public function onRequestStart(RequestTelemetryContext $context, array &$requestHeaders): mixed { @@ -205,27 +210,33 @@ class OtelTelemetryAdapter implements TelemetryAdapter ->setAttributes($context->startAttributes) ->startSpan(); - // Inject W3C trace context into request headers - // (use your OTel propagator here) + $scope = $span->activate(); + TraceContextPropagator::getInstance()->inject($requestHeaders); + $scope->detach(); return $span; } public function onRequestEnd(mixed $handle, RequestTelemetryResult $result): void { - if ($handle === null) { + if (!$handle instanceof SpanInterface) { return; } $span = $handle; $span->setAttributes($result->endAttributes); + if ($result->error !== null) { $span->setStatus(StatusCode::STATUS_ERROR, $result->error->message); + } else { + $span->setStatus(StatusCode::STATUS_OK); } + $span->end(); } } +$tracer = \OpenTelemetry\API\Globals::tracerProvider()->getTracer('your-app'); $chargebee = new ChargebeeClient([ 'site' => '{your_site}', 'apiKey' => '{your_apiKey}', @@ -233,6 +244,8 @@ $chargebee = new ChargebeeClient([ ]); ``` +`RequestTelemetryResult` also exposes `durationMs` if you want to record request duration on the span (e.g. `$span->setAttribute('chargebee.request.duration_ms', $result->durationMs)`). + To add custom span attributes (tenant ID, correlation ID, etc.), set them in your adapter's `onRequestStart` / `onRequestEnd` — use your own namespace (e.g. `app.tenant_id`), not `chargebee.*`. Spans are exported by your own OpenTelemetry setup, so they flow to whatever backend you've configured. The Chargebee config above stays the same regardless of backend. diff --git a/src/Telemetry/TelemetryExecutor.php b/src/Telemetry/TelemetryExecutor.php index ef28023a..39cd6323 100644 --- a/src/Telemetry/TelemetryExecutor.php +++ b/src/Telemetry/TelemetryExecutor.php @@ -34,10 +34,10 @@ public static function execute( try { $response = $action($requestPayload); - self::endTelemetrySuccess($adapter, $handle, $startMs, $response->getStatusCode()); + self::endTelemetrySuccess($env, $adapter, $handle, $startMs, $response->getStatusCode()); return $response; } catch (\Throwable $err) { - self::endTelemetryFailure($adapter, $handle, $startMs, $err); + self::endTelemetryFailure($env, $adapter, $handle, $startMs, $err); throw $err; } } @@ -60,14 +60,13 @@ private static function startTelemetry( $context = self::buildContext($env, $payload, $headers); return $adapter->onRequestStart($context, $headers); } catch (\Throwable $err) { - if ($env->getEnableDebugLogs()) { - echo '[ERROR] Telemetry adapter onRequestStart failed: ' . $err->getMessage() . "\n"; - } + self::logTelemetryAdapterError($env, 'onRequestStart', $err); return null; } } private static function endTelemetrySuccess( + Environment $env, TelemetryAdapter $adapter, mixed $handle, int $startMs, @@ -83,11 +82,12 @@ private static function endTelemetrySuccess( ), ); } catch (\Throwable $err) { - error_log('Telemetry adapter onRequestEnd failed: ' . $err->getMessage()); + self::logTelemetryAdapterError($env, 'onRequestEnd', $err); } } private static function endTelemetryFailure( + Environment $env, TelemetryAdapter $adapter, mixed $handle, int $startMs, @@ -105,10 +105,22 @@ private static function endTelemetryFailure( ), ); } catch (\Throwable $telemetryErr) { - error_log('Telemetry adapter onRequestEnd failed: ' . $telemetryErr->getMessage()); + self::logTelemetryAdapterError($env, 'onRequestEnd', $telemetryErr); } } + private static function logTelemetryAdapterError( + Environment $env, + string $hook, + \Throwable $err, + ): void { + if (!$env->getEnableDebugLogs()) { + return; + } + + echo '[ERROR] Telemetry adapter ' . $hook . ' failed: ' . $err->getMessage() . "\n"; + } + /** * @param array $requestHeaders */ diff --git a/tests/Telemetry/TelemetryExecutorTest.php b/tests/Telemetry/TelemetryExecutorTest.php index 6ce0028b..b95a1616 100644 --- a/tests/Telemetry/TelemetryExecutorTest.php +++ b/tests/Telemetry/TelemetryExecutorTest.php @@ -38,6 +38,31 @@ public function onRequestEnd(mixed $handle, RequestTelemetryResult $result): voi } } +final class FailingStartAdapter implements TelemetryAdapter +{ + public function onRequestStart(RequestTelemetryContext $context, array &$requestHeaders): mixed + { + throw new \RuntimeException('start failed'); + } + + public function onRequestEnd(mixed $handle, RequestTelemetryResult $result): void + { + } +} + +final class FailingEndAdapter implements TelemetryAdapter +{ + public function onRequestStart(RequestTelemetryContext $context, array &$requestHeaders): mixed + { + return 'span-1'; + } + + public function onRequestEnd(mixed $handle, RequestTelemetryResult $result): void + { + throw new \RuntimeException('end failed'); + } +} + #[TestDox('TelemetryExecutor')] final class TelemetryExecutorTest extends TestCase { @@ -182,4 +207,89 @@ public function testRecordsFailureFromApiError(): void self::assertSame(404, $adapter->endResult?->httpStatusCode); self::assertSame('resource_not_found', $adapter->endResult?->error?->chargebeeErrorCode); } + + #[TestDox('continues the API call when onRequestStart throws')] + public function testContinuesWhenStartThrows(): void + { + $env = $this->makeEnvironment(new FailingStartAdapter()); + $payload = $this->makePayload($env, 'customer', 'list'); + + $result = TelemetryExecutor::execute( + $env, + $payload, + function (ChargebeePayload $p) { + self::assertArrayNotHasKey('traceparent', $p->getHeaders()); + + return new ResponseObject('{}', 200, []); + }, + ); + + self::assertSame(200, $result->getStatusCode()); + } + + #[TestDox('continues the API call when onRequestEnd throws on success')] + public function testContinuesWhenEndThrowsOnSuccess(): void + { + $env = $this->makeEnvironment(new FailingEndAdapter()); + $payload = $this->makePayload($env, 'customer', 'list'); + + $result = TelemetryExecutor::execute( + $env, + $payload, + fn (ChargebeePayload $p) => new ResponseObject('{}', 201, []), + ); + + self::assertSame(201, $result->getStatusCode()); + } + + #[TestDox('propagates API errors when onRequestEnd throws on failure')] + public function testPropagatesApiErrorWhenEndThrowsOnFailure(): void + { + $env = $this->makeEnvironment(new FailingEndAdapter()); + $payload = $this->makePayload($env, 'customer', 'retrieve'); + + try { + TelemetryExecutor::execute($env, $payload, function (ChargebeePayload $p) { + throw new APIError( + 404, + [ + 'message' => 'Not found', + 'type' => 'invalid_request', + 'api_error_code' => 'resource_not_found', + ], + [], + ); + }); + self::fail('Expected APIError'); + } catch (APIError $err) { + self::assertSame(404, $err->getHttpStatusCode()); + } + } + + #[TestDox('logs adapter failures only when debug logs are enabled')] + public function testLogsAdapterFailuresOnlyWithDebugLogs(): void + { + $env = $this->makeEnvironment(new FailingEndAdapter()); + $payload = $this->makePayload($env, 'customer', 'list'); + + ob_start(); + TelemetryExecutor::execute( + $env, + $payload, + fn (ChargebeePayload $p) => new ResponseObject('{}', 200, []), + ); + self::assertSame('', ob_get_clean()); + + $env->setEnableDebugLogs(true); + + ob_start(); + TelemetryExecutor::execute( + $env, + $payload, + fn (ChargebeePayload $p) => new ResponseObject('{}', 200, []), + ); + $output = ob_get_clean(); + + self::assertStringContainsString('[ERROR] Telemetry adapter onRequestEnd failed: end failed', $output); + } } diff --git a/tests/Telemetry/TelemetrySupportTest.php b/tests/Telemetry/TelemetrySupportTest.php new file mode 100644 index 00000000..8b215d44 --- /dev/null +++ b/tests/Telemetry/TelemetrySupportTest.php @@ -0,0 +1,120 @@ + 'bar', + 'Authorization' => 'Basic secret', + 'chargebee-request-origin-ip' => '202.170.207.70', + ]); + + self::assertSame( + 'bar', + $attributes[TelemetryAttributeKeys::HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX . 'chargebee-foo'], + ); + self::assertArrayNotHasKey( + TelemetryAttributeKeys::HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX . 'authorization', + $attributes, + ); + self::assertArrayNotHasKey( + TelemetryAttributeKeys::HTTP_REQUEST_HEADER_ATTRIBUTE_PREFIX . 'chargebee-request-origin-ip', + $attributes, + ); + } + + #[TestDox('extracts chargebee error details from APIError')] + public function testExtractRequestTelemetryErrorFromApiError(): void + { + $error = TelemetrySupport::extractRequestTelemetryError(new APIError( + 404, + [ + 'message' => 'Not found', + 'type' => 'invalid_request', + 'api_error_code' => 'resource_not_found', + 'param' => 'customer_id', + ], + [], + )); + + self::assertNotNull($error); + self::assertSame('Not found', $error->message); + self::assertSame('resource_not_found', $error->chargebeeErrorCode); + self::assertSame('invalid_request', $error->chargebeeApiErrorType); + self::assertSame('customer_id', $error->chargebeeErrorParam); + } + + #[TestDox('extracts generic error details from non-API exceptions')] + public function testExtractRequestTelemetryErrorFromGenericException(): void + { + $error = TelemetrySupport::extractRequestTelemetryError(new \RuntimeException('network down')); + + self::assertNotNull($error); + self::assertSame('network down', $error->message); + self::assertNull($error->chargebeeErrorCode); + } + + #[TestDox('extracts HTTP status code from APIError')] + public function testExtractHttpStatusCode(): void + { + self::assertSame( + 429, + TelemetrySupport::extractHttpStatusCode(new APIError( + 429, + ['message' => 'Rate limited', 'type' => 'invalid_request', 'api_error_code' => 'rate_limit'], + [], + )), + ); + self::assertNull(TelemetrySupport::extractHttpStatusCode(new \RuntimeException('boom'))); + } + + #[TestDox('builds end attributes with chargebee error fields')] + public function testBuildRequestEndSpanAttributes(): void + { + $error = TelemetrySupport::extractRequestTelemetryError(new APIError( + 400, + [ + 'message' => 'Bad request', + 'type' => 'invalid_request', + 'api_error_code' => 'invalid_request', + 'param' => 'email', + ], + [], + )); + + $attributes = TelemetrySupport::buildRequestEndSpanAttributes(400, $error); + + self::assertSame(400, $attributes[TelemetryAttributeKeys::HTTP_RESPONSE_STATUS_CODE]); + self::assertSame('400', $attributes[TelemetryAttributeKeys::ERROR_TYPE]); + self::assertSame('invalid_request', $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_CODE]); + self::assertSame('invalid_request', $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_TYPE]); + self::assertSame('email', $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_PARAM]); + } +} From 5cbcc9c9e8cd4c058ffd1caa6ab28c7668cecaf5 Mon Sep 17 00:00:00 2001 From: cb-karthikp Date: Tue, 30 Jun 2026 22:18:42 +0530 Subject: [PATCH 4/4] update tests --- src/Telemetry/TelemetrySupport.php | 8 ++++---- tests/Telemetry/TelemetrySupportTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Telemetry/TelemetrySupport.php b/src/Telemetry/TelemetrySupport.php index 53432ef4..d8371c44 100644 --- a/src/Telemetry/TelemetrySupport.php +++ b/src/Telemetry/TelemetrySupport.php @@ -93,14 +93,14 @@ public static function buildRequestEndSpanAttributes( ]; if ($error !== null) { - $attributes[TelemetryAttributeKeys::ERROR_TYPE] = (string) $httpStatusCode; + if ($error->chargebeeApiErrorType !== null) { + $attributes[TelemetryAttributeKeys::ERROR_TYPE] = $error->chargebeeApiErrorType; + $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_TYPE] = $error->chargebeeApiErrorType; + } if ($error->chargebeeErrorCode !== null) { $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_CODE] = $error->chargebeeErrorCode; } - if ($error->chargebeeApiErrorType !== null) { - $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_TYPE] = $error->chargebeeApiErrorType; - } if ($error->chargebeeErrorParam !== null) { $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_PARAM] = $error->chargebeeErrorParam; } diff --git a/tests/Telemetry/TelemetrySupportTest.php b/tests/Telemetry/TelemetrySupportTest.php index 8b215d44..3b72158e 100644 --- a/tests/Telemetry/TelemetrySupportTest.php +++ b/tests/Telemetry/TelemetrySupportTest.php @@ -112,7 +112,7 @@ public function testBuildRequestEndSpanAttributes(): void $attributes = TelemetrySupport::buildRequestEndSpanAttributes(400, $error); self::assertSame(400, $attributes[TelemetryAttributeKeys::HTTP_RESPONSE_STATUS_CODE]); - self::assertSame('400', $attributes[TelemetryAttributeKeys::ERROR_TYPE]); + self::assertSame('invalid_request', $attributes[TelemetryAttributeKeys::ERROR_TYPE]); self::assertSame('invalid_request', $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_CODE]); self::assertSame('invalid_request', $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_TYPE]); self::assertSame('email', $attributes[TelemetryAttributeKeys::CHARGEBEE_ERROR_PARAM]);