Sha256: ff997652b9b77006bcef46c392bf63634d214ffac3ebc66f296abc8ce6d6dac1

Contents?: true

Size: 1.22 KB

Versions: 15

Compression:

Stored size: 1.22 KB

Contents

# Logging and monitoring

GraphqlRails behaves similar as Ruby on Rails. This allows to use existing monitoring and logging tools. Here we will add some examples on how to setup various tools for GraphqlRails

## Integrating GraphqlRails with other tools

In order to make GraphqlRails work with tools such as lograge or sentry, you need to enable them. In Ruby on Rails, you can add initializer:

```ruby
# config/initializers/graphql_rails.rb
GraphqlRails::Integrations.enable(:lograge, :sentry)
```

At the moment, GraphqlRails supports following integrations:

* lograge
* sentry

## Instrumentation

GraphqlRails uses same instrumentation tool (`ActiveSupport::Notifications`) as Ruby on Rails. At the moment there are two notification types:

* `process_action.graphql_action_controller`
* `start_action.graphql_action_controller`

you can watch those actions using with `ActiveSupport::Notifications#subscribe` like this:

```ruby
key = 'process_action.graphql_action_controller'
ActiveSupport::Notifications.subscribe(key) do |*_, payload|
  YourLogger.do_something(payload)
end
```

or you can do the same with `ActiveSupport::LogSubscriber`. More details about it [here](https://api.rubyonrails.org/classes/ActiveSupport/LogSubscriber.html).

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
graphql_rails-3.0.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-2.4.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-2.3.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-2.2.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-2.1.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-2.0.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.2.6 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.2.4 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.2.3 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.2.2 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.2.1 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.2.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.1.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-1.0.0 docs/logging_and_monitoring/logging_and_monitoring.md
graphql_rails-0.8.0 docs/logging_and_monitoring/logging_and_monitoring.md