-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #917 from rmosolgo/tracing
Add GraphQL::Tracing
- Loading branch information
Showing
63 changed files
with
1,154 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
# frozen_string_literal: true | ||
appraise 'rails_3.2' do | ||
gem "rails", "3.2.22.5" | ||
gem 'activerecord', '~> 3.2.21' | ||
gem 'actionpack', '~> 3.2.21' | ||
gem 'test-unit' | ||
end | ||
|
||
appraise 'rails_4.1' do | ||
gem "rails", "~> 4.1" | ||
gem 'activerecord', '~> 4.1.10' | ||
gem 'actionpack', '~> 4.1.10' | ||
gem 'test-unit' | ||
end | ||
|
||
appraise 'rails_4.2' do | ||
gem "rails", "~> 4.2" | ||
gem 'activerecord', '~> 4.2.4' | ||
gem 'actionpack', '~> 4.2.4' | ||
gem 'concurrent-ruby', '1.0.0' | ||
end | ||
|
||
appraise 'rails_5.0' do | ||
gem "rails", "~> 5.0" | ||
gem 'activerecord', '~> 5.0.0' | ||
gem 'actionpack', '~> 5.0.0' | ||
end | ||
|
||
appraise 'rails_5.1' do | ||
gem 'rails', '~> 5.1.0.rc2' | ||
end | ||
|
||
appraise 'without_rails' do | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "ruby-prof", platform: :ruby | ||
gem "sqlite3", platform: :ruby | ||
gem "pg", platform: :ruby | ||
gem "pry" | ||
gem "pry-stack_explorer", platform: :ruby | ||
gem "activerecord-jdbcsqlite3-adapter", platform: :jruby | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ To use persisted queries with your client application, you must: | |
- [Sync operations](#syncing) from the client to the server | ||
- [Send `params[:operationId]`](#client-usage) from the client app | ||
|
||
This documentation also touches on [`graphql-pro-js`](https://github.com/rmosolgo/graphql-pro-js), a JavaScript client library for using `OperationStore`. | ||
This documentation also touches on [`graphql-ruby-client`](https://github.com/rmosolgo/graphql-ruby-client), a JavaScript client library for using `OperationStore`. | ||
|
||
### Add a Client | ||
|
||
|
@@ -30,7 +30,7 @@ A default `secret` is provided for you, but you can also enter your own. The `se | |
|
||
Once a client is registered, it can push queries to the server via {% internal_link "the Sync API","/operation_store/getting_started#add-routes" %}. | ||
|
||
The easiest way to sync is with `graphql-pro sync`, a command-line tool written in JavaScript: [`graphql-pro-js`](https://github.com/rmosolgo/graphql-pro-js). | ||
The easiest way to sync is with `graphql-ruby-client sync`, a command-line tool written in JavaScript: [`graphql-ruby-client`](https://github.com/rmosolgo/graphql-ruby-client). | ||
|
||
In short, it: | ||
|
||
|
@@ -43,15 +43,15 @@ For example: | |
|
||
{{ "/operation_store/sync_example.png" | link_to_img:"OperationStore client sync" }} | ||
|
||
See the readme for [Relay support](https://github.com/rmosolgo/graphql-pro-js#use-with-relay), [Apollo Client support](https://github.com/rmosolgo/graphql-pro-js#use-with-apollo-client), and [plain JS usage](https://github.com/rmosolgo/graphql-pro-js#use-with-plain-javascript). | ||
See the readme for [Relay support](https://github.com/rmosolgo/graphql-ruby-client#use-with-relay), [Apollo Client support](https://github.com/rmosolgo/graphql-ruby-client#use-with-apollo-client), and [plain JS usage](https://github.com/rmosolgo/graphql-ruby-client#use-with-plain-javascript). | ||
|
||
|
||
|
||
For help syncing in another language, you can take inspiration from the [JavaScript implementation](https://github.com/rmosolgo/graphql-pro-js), {% open_an_issue "Implementing operation sync in another language" %}, or email `[email protected]`. | ||
For help syncing in another language, you can take inspiration from the [JavaScript implementation](https://github.com/rmosolgo/graphql-ruby-client), {% open_an_issue "Implementing operation sync in another language" %}, or email `[email protected]`. | ||
|
||
### Client Usage | ||
|
||
`graphql-pro-js` generates [Apollo middleware](https://github.com/rmosolgo/graphql-pro-js#use-with-apollo-client) and a [Relay helper function](https://github.com/rmosolgo/graphql-pro-js#use-with-relay) to get started quickly. | ||
`graphql-ruby-client` generates [Apollo middleware](https://github.com/rmosolgo/graphql-ruby-client#use-with-apollo-client) and a [Relay helper function](https://github.com/rmosolgo/graphql-ruby-client#use-with-relay) to get started quickly. | ||
|
||
To run stored operations from another client, send a param called `operationId` which is composed of: | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: Tracing | ||
layout: guide | ||
search: true | ||
section: Queries | ||
desc: Observation hooks for execution | ||
index: 11 | ||
experimental: true | ||
--- | ||
|
||
{{ "GraphQL::Tracing" | api_doc }} provides a `.trace` hook to observe events from the GraphQL runtime. | ||
|
||
A tracer must implement `.trace`, for example: | ||
|
||
```ruby | ||
class MyCustomTracer | ||
def trace(key, data) | ||
# do stuff with key & data | ||
yield | ||
end | ||
end | ||
``` | ||
|
||
`.trace` is called with: | ||
|
||
- `key`: the event happening in the runtime | ||
- `data`: a hash of metadata about the event | ||
- `&block`: the event itself, it must be `yield`ed and the value must be returned | ||
|
||
To install a tracer, use `GraphQL::Tracing.install`: | ||
|
||
```ruby | ||
GraphQL::Tracing.install(MyCustomTracer.new) | ||
``` | ||
|
||
To uninstall, use `GraphQL::Tracing.install(nil)`. | ||
|
||
For a full list of events, see the {{ "GraphQL::Tracing" | api_doc }} API docs. |
Oops, something went wrong.