* Include in RFQ-T info log entry the query parameters that were sent to
the maker.
* Re-organize log entry
* Rename top-level field from rfqtMakerResponse to
rfqtMakerInteraction.
* Create separate `request` and `response` sub-objects.
* Rename field `latency` to `latencyMs`.
* Change QuoteRequestor logger parameters to conform to pino logging
library, duplicating (one of) their LogFunction prototype interfaces for
our purposes here. With this, every log emission now includes BOTH a
human-readable message AND a JSON object. Also, this pattern has been
applied to both the error logger and the info logger.
* Do better handling of Axios errors when logging them. Before we were
(a) logging errors in a separate log entry than the message that
explains it, and (b) dumping the whole error object to the log entry,
which was resulting in an object so massive that pino/Kibana was
splitting it into 3 separate entries. Now, we (a) follow the pattern
described in the previous bullet, which puts the error object and the
human readable message into the same log entry, and (b) we check to see
if an error object is Axios-specific, and if so then we use the
AxiosError.toJSON() method to strip out the irrelevant properties.
* Log a uniform maker response metric, with maker endpoint URL, status
code, and latency, for both successful cases and erroneous ones.
(Before, we were only doing this for successful cases.)
This comment recently got moved from one context to another. In the old
context, the whole comment made sense, but in the new context it needed
paring down.
Do case INsensitive comparison when verifying that RFQ-T firm quote
contains the requested taker address.
This commit also introduces some changes around the RfqtRequestOpts
parameter. Without these changes, there were errors (tsc or tslint?
can't remember) about takerAddress being possibly undefined.
Rather than asserting it yet again (which we're already doing via
assertTakerAddressOrThrow()), I decided to change the RfqtRequestOpts
param to be required, not optional. Coincidentally, this brings the
requestRfqtFirmQuotesAsync() interface into alignment with the
requestRfqtIndicativeQuotesAsync() one, which already requires the
options parameter.
Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2574#discussion_r419770087
For firm quotes, re-use orderCalculationUtils.willOrderExpire(), just
like utils.order_prune_utils.
For indicative quotes, duplicate the logic used in that
willOrderExpire() function, since it can't be re-used for an indicative
quote (it's not a full Order object), and since the logic is very
minimal.
Addresses review comment https://github.com/0xProject/0x-monorepo/pull/2574#discussion_r419768395
In the QuoteRequestor class, when _infoLogger() is used, log objects
directly, rather than stringifying them first. This changes the 0x API
log rendering from
{"level":"info","time":1588209135290,"pid":13022,"hostname":"precision5510","msg":"{\"aggregatedRfqtLatencyMs\":4}","v":1}
to
{"level":"info","time":1588224481908,"pid":3637,"hostname":"precision5510","aggregatedRfqtLatencyMs":2,"v":1}
This facilitates parsing of these logs by Kibana.