cacheql icon indicating copy to clipboard operation
cacheql copied to clipboard

Documentation for timing logs is missing instrumentation

Open jsteiner opened this issue 6 years ago • 1 comments

It seems like for local logging to work you need to also include an instrumenter in your schema. This isn't mentioned in the documentation.

I'm not using Scout, but I wrote a dummy tracer just to get this working:

class DummyTracer
  def self.instrument(_, _, &block)
    block.call
  end
end

YourSchema = GraphQL::Schema.define do
  instrument :field, CacheQL::FieldInstrumentation.new(DummyTracer)
end

Should something like that be included in this gem for logging without Scout?

jsteiner avatar Apr 21 '18 21:04 jsteiner

OK, so this is really just for Scout right now. We could make it more generic. I'm using:

  instrument :field, CacheQL::FieldInstrumentation.new(ScoutApm::Tracer)

For just logging by itself, you need the around_action code in the readme, in your controller that serves GraphQL requests.

qrush avatar Apr 22 '18 01:04 qrush