x23.ai

alpha

#236: [feat] add WebhookQuoterResponse analytics event logging

11 files changed

390 additions

32 deletions

18 commits

github.com

TL;DR:

The pull request refines logging and error handling in the WebhookQuoter class of the uniswapx-parameterization-api repository, introducing a standardized log message structure, adjusting logging levels, and enhancing error details. It also reduces the scope of the try block, removes the line calculating the quote variable, and adds a new requestContext object and import statement.

The pull request primarily focuses on refining the logging and error handling in the WebhookQuoter class of the uniswapx-parameterization-api repository.

  • A new import statement has been added to the WebhookQuoter.ts file to import the timestampInMstoSeconds function from the time utility file.

  • The scope of the try block in the WebhookQuoter class has been reduced to only cover the part of the code that deals with sending requests and handling responses.

  • A new requestContext object has been created to include properties such as requestId, quoteId, name, endpoint, createdAt, createdAtMs, and timeoutSettingMs.

  • The logging of the raw webhook response and the event when the webhook elects not to quote has been modified to include a rawResponse object and eventType respectively.

  • The logging level for various scenarios has been changed from error to info.

  • The log message structure has been standardized across different scenarios to include an eventType of 'WebhookQuoterResponse' and a body object.

  • The body object now includes the spread requestContext and rawResponse objects, a responseType indicating the type of response or error, and additional context-specific fields.

  • For validation errors, the validationError field has been added to the log message.

  • For request ID mismatches, the mismatchedRequestId field has been added to the log message.

  • For successful requests, the responseType is set to 'OK'.

  • For Axios errors, the log message now includes a status, data, responseTimeMs, and responseType fields. The responseType is set to 'TIMEOUT' for connection aborted errors and 'HTTP_ERROR' for other Axios errors.

  • For other errors, the log message now includes a responseTimeMs, responseType set to 'OTHER_ERROR', and an otherError field containing the error message.

  • The line calculating the quote variable has been removed.

The pull request ends abruptly, indicating that there may be more changes in the WebhookQuoter class that are not included in this summary.

Merged 12 days ago

Last updated 04/12 00:17