From f59cb36dfc509f31bad2979f29a156e6f8821e82 Mon Sep 17 00:00:00 2001 From: Charly POLY <1252066+charlypoly@users.noreply.github.com> Date: Tue, 21 Jun 2022 07:31:37 +0200 Subject: [PATCH] doc: Graphql Ruby integration (#152) * doc: graphql ruby integration * prettier --- .../web/docs/pages/features/monitoring.mdx | 48 +++++++++++++++++-- .../docs/pages/features/publish-schema.mdx | 27 ++++++++++- packages/web/docs/pages/specs/integrations.md | 7 --- 3 files changed, 71 insertions(+), 11 deletions(-) diff --git a/packages/web/docs/pages/features/monitoring.mdx b/packages/web/docs/pages/features/monitoring.mdx index 1ce3f2612..a54e7dc6b 100644 --- a/packages/web/docs/pages/features/monitoring.mdx +++ b/packages/web/docs/pages/features/monitoring.mdx @@ -180,8 +180,50 @@ Once this is done, and you start collecting the analytics as relevant you will b ![Monitoring view](../../public/monitoring-view.png) -## 3rd-party integrations +## Other languages -Here's a list of community-supported integrations: +### GraphQL Ruby -- [(php) Lighthouse GraphQL Hive](https://github.com/stayallive/lighthouse-graphql-hive) +Our [`graphql-hive` gem](https://github.com/charlypoly/graphql-ruby-hive) allows GraphQL Ruby users to use Hive to both monitor operations and publish schemas. + +**1. Install the `graphql-hive` gem** + +``` +gem install graphql-hive +``` + +
+ +**2. Configure `GraphQL::Hive` in your Schema** + +Add `GraphQL::Hive` **at the end** of your schema definition: + +```ruby +class Schema < GraphQL::Schema + query QueryType + + use( + GraphQL::Hive, + { + token: '', + reporting: { + author: ENV['GITHUB_USER'], + commit: ENV['GITHUB_COMMIT'] + }, + } + ) +end +``` + +The `reporting` configuration is required to push your GraphQL Schema to the Hive registry. +Doing so will help better detect breaking changes and more upcoming features. +If you only want to use the operations monitoring, replace the `reporting` option with the following `report_schema: false`. + +More information is available on the `graphql-hive` repository: https://github.com/charlypoly/graphql-ruby-hive + +### Laravel Lighthouse (PHP) + +The [Lighthouse GraphQL Hive](https://github.com/stayallive/lighthouse-graphql-hive) 3rd party integration can be used to measure and collect data against all your GraphQL operations. +At the moment, **it does not support Schema publishing**. + +Get started [on their repository](https://github.com/stayallive/lighthouse-graphql-hive). diff --git a/packages/web/docs/pages/features/publish-schema.mdx b/packages/web/docs/pages/features/publish-schema.mdx index 5b37adb5e..8fd06f874 100644 --- a/packages/web/docs/pages/features/publish-schema.mdx +++ b/packages/web/docs/pages/features/publish-schema.mdx @@ -141,7 +141,7 @@ const envelopProxy = envelop({ }) ``` -# Other servers +### Other Node.js servers First, `createHive` to instantiate the Hive Client. @@ -169,6 +169,31 @@ hive.reportSchema({ schema: yourSchema }) app.post('/graphql', graphqlHTTP({ schema: yourSchema })) ``` +### GraphQL Ruby + +Add `GraphQL::Hive` **at the end** of your schema definition: + +```ruby +class Schema < GraphQL::Schema + query QueryType + + use( + GraphQL::Hive, + { + token: '', + reporting: { + # feel free to set dummy values here + author: 'Author of the schema version', + commit: 'git sha or any identifier' + }, + } + ) +end + +``` + +More information is available on the `graphql-hive` repository: https://github.com/charlypoly/graphql-ruby-hive + ## GitHub Integration In case you want to integrate GraphQL Hive with your GitHub repository, follow the [GitHub integration guide](./integrations#github). diff --git a/packages/web/docs/pages/specs/integrations.md b/packages/web/docs/pages/specs/integrations.md index 113e61bc4..f3771aea7 100644 --- a/packages/web/docs/pages/specs/integrations.md +++ b/packages/web/docs/pages/specs/integrations.md @@ -1,12 +1,5 @@ # Integrations -## Laravel Lighthouse (PHP) - -The [Lighthouse GraphQL Hive](https://github.com/stayallive/lighthouse-graphql-hive) 3rd party integration can be used to measure and collect data against all your GraphQL operations. -At the moment, **it does not support Schema publishing**. - -Get started [on their repository](https://github.com/stayallive/lighthouse-graphql-hive). - ## Write a new Integration Writing a third-party integration? We'd love to hear about it and help you!