Expose billing metrics
berlix opened this issue · comments
Felix Engelhardt commented
Responses from Fauna include all sorts of extra headers:
'x-byte-read-ops': '34',
'x-byte-write-ops': '0',
'x-compute-ops': '2',
'x-faunadb-build': '20.11.00.rc8-01f9c94',
'x-query-bytes-in': '120',
'x-query-bytes-out': '4459',
'x-query-time': '7',
'x-read-ops': '27',
'x-storage-bytes-read': '3047',
'x-storage-bytes-write': '0',
'x-txn-retries': '0',
'x-txn-time': '1605653866258457',
'x-write-ops': '0'
(see docs)
Of these, only x-txn-time
is exposed by the JVM driver.
I can see a few ways in which those metrics could be exposed:
- Like
x-txn-time
is (which is exposed throughlong FaunaClient.getLastTxnTime()
). - By recording them onto the
MetricRegistry
which is already getting injected intoFaunaClient
. - By adding a method
CompletableFuture<Pair<Value, Map<String, String>> queryWithHeaders(...)
toFaunaClient
which returns the response headers. - By making
FaunaClient
's constructorpublic
so that one can decorate theConnection
object to expose the metrics. - By enabling the injection of a
ConnectionFactory
intoFaunaClient.Builder
so that one can decorate theConnection
object to expose the metrics.
I suppose that the second approach would the cleanest one.
Summer Schrader commented
Thanks! We have an internal ticket to fix this.
Felix Engelhardt commented
Hi Summer, that's great to hear! Any ETA on that?
Summer Schrader commented
Not yet--it's in triage.
Summer Schrader commented
@berlix I believe the release yesterday has fixed this. Please try it out and let us know if we need to reopen this issue!