I'm doing some application profiling on a react native application and I'm seeing pretty big differences between the request times that I'm getting using the apollo-link-logger
(as well as the links I've rolled on my own) and the Android profiler's networking lane. For a ~600ms request in the profiler I'm seeing upwards of 2 seconds from the middle ware that uses the apollo link system.
There isn't much going on in my own link (below)
const metricsLink = new ApolloLink((operation, forward) => {
const { operationName } = operation
const startTime = new Date().getTime()
const observable = forward(operation)
observable.subscribe({
complete: () => {
const elapsed = new Date().getTime() - startTime
console.warn(`[METRICS][${operationName}] (${elapsed}) complete`)
}
})
return observable
})
It seems like its going to end up factoring in the time it takes apollo to manage this request chain as well. I've confirmed that this isn't a general issue with the app by fetching from other endpoints directly with fetch and comparing those times with the profiler times (which match).
Should I expect this to actually reflect the request time? Where might the rest of the time be going between the native network request and the time I'm seeing in the apollo client?