This PR adds instrumentation of cache spans to the @tanstack/react-query client. I could not find a hook for this, so I subclassed QueryClient, we should be mindful of this contract changing over time:
Note: in implementing this, I noticed that queries seem to cache for 5 minutes, which is the default garbage collection in the cache, vs., 60 seconds configured for revalidation. I believe this might be due to revalidateIfStale defaulting to false. If this is fixed, the cache span logic also needs to be updated to reflect this.
This PR adds instrumentation of cache spans to the @tanstack/react-query client. I could not find a hook for this, so I subclassed QueryClient, we should be mindful of this contract changing over time:
Note: in implementing this, I noticed that queries seem to cache for 5 minutes, which is the default garbage collection in the cache, vs., 60 seconds configured for revalidation. I believe this might be due to revalidateIfStale defaulting to
false
. If this is fixed, the cache span logic also needs to be updated to reflect this.