Open tomwayson opened 6 years ago
Another option is that we could also add a telemetry: ITelemetryProvider
option the stateless fn's that would act like authentication. If that option is truthy and exposes a logEvent()
fn, then tack on a call to logEvent()
after the current request.
This would move the actual logging down a level to the stateless fns. In the above scenario, the Hub()
instance would just pass in the telemetry
to the stateless fns (just like authentication
) instead of calling logEvent()
directly.
Where that starts to unravel is that is we'd also need a logEventOptions: ILogEventOptions
option passed into the request unless we didn't allow the category, etc, to be configurable at the app level. In otherwords, getInitiative('3ef')
would always log w/:
{
category: '@esri/hub-initatives',
action: 'getInitative',
label: 'Initative Title', // pull this from the getItem response
initativeId: '3ef', // is this even possible? I see datasetID in the examples
user: 'amazing_map_woman' // pull this from the authentication request option
}
TBH, that works for me, and I suppose we could also always add the logEventOptions
later if somebody really needed their events logged w/ specific categories/actions.
I'm not sure if we need to support workflows - @dbouwman would that be used by the coarse-grained initiative API?
Also, of course, we don't need to integrate w/ telemetry at this level. We could just include an example that shows how consumers could call logEvent()
themselves in any of our stateless fns' .then()
block.
@tomwayson I would lean very heavily towards having telemetry in the consuming application, not directly within this library.
I think we can easily create demo code that shows how to send telemetry to your own GA account, via the the progress callbacks in coarse-grained calls. Way better than tight coupling to telemetry.js
imho
Call https://www.npmjs.com/package/@esri/telemetry
.logEvent()
if an instance ofTelemetry
is provided.This probably makes the most sense after #75 since we'll probably want something like this:
The hub specific telemetry config might map hub.js packages/functions to categories/actions.
Also, having it as a property would expose telemetry to so that the app can use it for non-hub specific things like: