Skip to content

Commit 41bffb1

Browse files
hmcfletchshishirmk
authored andcommitted
Some docs for the instrumentation
1 parent 8d905db commit 41bffb1

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,36 @@ object_method_name | Set custom method name to get related objects | ```has_many
244244
record_type | Set custom Object Type for a relationship | ```belongs_to :owner, record_type: :user```
245245
serializer | Set custom Serializer for a relationship | ```has_many :actors, serializer: :custom_actor```
246246

247+
### Instrumentation
248+
249+
`fast_jsonapi` also has builtin [Skylight](https://www.skylight.io/) integration. To enable, add the following to an initializer:
250+
251+
```ruby
252+
require 'fast_jsonapi/instrumentation/skylight'
253+
```
254+
255+
Skylight relies on `ActiveSupport::Notifications` to track these two core methods. If you would like to use these notifications without using Skylight, simply require the instrumentation integration:
256+
257+
```ruby
258+
require 'fast_jsonapi/instrumentation'
259+
```
260+
261+
The two instrumented notifcations are supplied by these two constants:
262+
* `FastJsonapi::ObjectSerializer::SERIALIZABLE_HASH_NOTIFICATION`
263+
* `FastJsonapi::ObjectSerializer::SERIALIZED_JSON_NOTIFICATION`
264+
265+
It is also possible to instrument one method without the other by using one of the following require statements:
266+
267+
```ruby
268+
require 'fast_jsonapi/instrumentation/serializable_hash'
269+
require 'fast_jsonapi/instrumentation/serialized_json'
270+
```
271+
272+
Same goes for the Skylight integration:
273+
```ruby
274+
require 'fast_jsonapi/instrumentation/skylight/normalizers/serializable_hash'
275+
require 'fast_jsonapi/instrumentation/skylight/normalizers/serialized_json'
276+
```
247277

248278
## Contributing
249279
Please see [contribution check](https://github.com/Netflix/fast_jsonapi/blob/master/CONTRIBUTING.md) for more details on contributing

0 commit comments

Comments
 (0)