cacheql
cacheql copied to clipboard
Documentation for timing logs is missing instrumentation
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?
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.