fauna / faunadb-js

Javascript driver for Fauna v4 (deprecated)
https://docs.fauna.com/fauna/v4/
Other
702 stars 76 forks source link

Add optional, per-query parameters for providing a traceparent and tags #654

Closed trevor-fauna closed 2 years ago

trevor-fauna commented 2 years ago

Notes

FE-2382

Adds new, optional headers to driver, traceparent and tags, for providing a unique identifier per-query identifier, as well as KV-pair tags, to each submitted query. README was updated as well:


traceparent

A W3C-compliant identifier for enabling distributed tracing across different vendors. If not provided, one is automatically generated server-side and attached to the query. See Trace Context spec for more details.

var data = client.query(q.Paginate(q.Collections()), {
  traceparent: "00-c91308c112be8448dd34dc6191567fa0-b7ad6b7169203331-01",
})
tags

Allows for associating user-provided tags with a query.

var data = client.query(q.Paginate(q.Collections()), {
  tags: { key1: "value1", key2: "value2" },
})

How to test

Test cases were added to assert the new fields. They can be executed via yarn test.