[Telemetry] Begin adding telemetry handler

Begin adding a general purpose handler for telemetry which
extends on the behavior associated with the telemetrySubscriber
by supporting access to historical data as well. WTD-806.
This commit is contained in:
Victor Woeltjen
2015-04-16 16:27:25 -07:00
parent 774c4dec1d
commit 60e888e16e
4 changed files with 128 additions and 36 deletions

View File

@ -33,6 +33,7 @@ define(
function TelemetrySubscription($q, $timeout, domainObject, callback, lossless) {
var delegator = new TelemetryDelegator($q),
unsubscribePromise,
telemetryObjectPromise,
latestValues = {},
telemetryObjects = [],
pool = lossless ? new TelemetryQueue() : new TelemetryTable(),
@ -137,8 +138,8 @@ define(
// will be unsubscribe functions. (This must be a promise
// because delegation is supported, and retrieving delegate
// telemetry-capable objects may be an asynchronous operation.)
unsubscribePromise =
promiseRelevantObjects(domainObject)
telemetryObjectPromise = promiseRelevantObjects(domainObject);
unsubscribePromise = telemetryObjectPromise
.then(cacheObjectReferences)
.then(subscribeAll);
@ -224,6 +225,17 @@ define(
*/
getMetadata: function () {
return metadatas;
},
/**
* Get a promise for all telemetry-providing objects
* associated with this subscription.
* @returns {Promise.<DomainObject[]>} a promise for
* telemetry-providing objects
*/
promiseTelemetryObjects: function () {
// Unsubscribe promise is available after objects
// are loaded.
return telemetryObjectPromise;
}
};
}