GraphQLSwift / GraphQL

The Swift GraphQL implementation for macOS and Linux
MIT License
938 stars 72 forks source link

Add Instrumentation support #20

Closed williambailey closed 7 years ago

williambailey commented 7 years ago

My current thinking is that having the Instrumentation protocol be a number of functions that accept started and finished arguments make implementing concrete instrumentations a lot simpler then if we had an protocol that made separate calls to beginXxx and finishXxx style functions. Especially if you have many queries running concurrently or are using a concurrent field execution strategy.

Hopefully i've hooked into all of the correct places to ensure that both success and errors are reported to any instrumentation.

For field resolution i've kept the instrumentation quite tight to include just the call to resolveOrError as this allows you to get better idea of how long your field resolution functions without any of the graphql runtime overhead (while you will see the overhead in the started, finished numbers for operation Execution).

codecov-io commented 7 years ago

Codecov Report

Merging #20 into master will increase coverage by 0.11%. The diff coverage is 86.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #20      +/-   ##
==========================================
+ Coverage   80.04%   80.16%   +0.11%     
==========================================
  Files          74       77       +3     
  Lines        8904     9114     +210     
==========================================
+ Hits         7127     7306     +179     
- Misses       1777     1808      +31
Impacted Files Coverage Δ
...rces/GraphQL/Instrumentation/Instrumentation.swift 100% <100%> (ø)
Sources/GraphQL/Validation/Validate.swift 20.66% <100%> (+1.61%) :arrow_up:
Sources/GraphQL/Language/Parser.swift 90.9% <100%> (+0.36%) :arrow_up:
Sources/GraphQL/GraphQL.swift 100% <100%> (ø) :arrow_up:
Sources/GraphQL/Execution/Execute.swift 74.1% <75.67%> (-0.49%) :arrow_down:
...entation/DispatchQueueInstrumentationWrapper.swift 81.81% <81.81%> (ø)
...ts/InstrumentationTests/InstrumentationTests.swift 89.47% <89.47%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b67c14e...4620479. Read the comment docs.