Monitoring

GraphQL::Pro includes instrumentation for several platforms which add:

By default, all fields in the schema are monitored, but you can opt in or opt out on a type-by-type or field-by-field basis.

To add monitoring, provide one or more platform names to monitoring(...):

MySchema = GraphQL::Schema.define do
  # ...
  # Send query info to New Relic:
  monitoring(:new_relic)
  # Send info to Skylight and Scout:
  # monitoring(:skylight, :scout)
end

Supported platforms are:

Opting in, Opting out

By default, GraphQL::Pro measures the resolution time of every field in the schema.

You can opt out on a field- or type-basis by defining monitoring(false) in a field or type definition. For example:

# Fields returning `Post` will _not_ be monitored
PostType = GraphQL::ObjectType.define do
  name "Post"
  monitoring false
  # ...
end

CommentType = GraphQL::ObjectType.define do
  # ...
  # This field won't be monitored:
  field :created_at, DateTimeType, monitoring: false

  # This field won't be monitored
  field :author, AuthorType do
    monitoring false
    resolve ->(o, a, c) { ... }
  end
end

You can also opt out of all scalars by providing monitor_scalars: false at schema-level. For example:

MySchema = GraphQL::Schema.define do
  # ...
  # Don't monitor any Strings, Ints, Floats, IDs, Booleans, or custom scalars
  monitoring(:skylight, monitor_scalars: false)
end

If you opt out of scalars, you can specify monitoring(true) to keep an eye on specific fields or scalar types:

CommentType = GraphQL::ObjectType.define do
  # ...
  # Opt in to monitoring this field:
  field :rating, types.Float, monitoring: true
end

DateTimeType = GraphQL::Scalar.define do
  # ...
  # Always monitor fields that return this type:
  monitoring true
end

This gives you fine-tuned control over how your schema is instrumented.

AppSignal

Add AppSignal instrumentation with monitoring(:appsignal), for example:

MySchema = GraphQL::Schema.define do
  # ...
  monitoring(:appsignal)
end

Datadog

Add Datadog APM instrumentation with monitoring(:datadog), for example:

MySchema = GraphQL::Schema.define do
  # ...
  monitoring(:datadog)
end

This requires the ddtrace gem, make sure to include it in your gemfile:

gem "ddtrace"

New Relic

Add New Relic instrumentation with monitoring(:new_relic), for example:

MySchema = GraphQL::Schema.define do
  # ...
  monitoring(:new_relic)
end

Scout

Add Scout instrumentation with monitoring(:scout), for example:

MySchema = GraphQL::Schema.define do
  # ...
  monitoring(:scout)
end

Skylight

Add Skylight instrumentation with monitoring(:skylight), for example:

MySchema = GraphQL::Schema.define do
  # ...
  monitoring(:skylight)
end