@nsshunt/stsobservability 1.0.13 → 1.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,7 +34,7 @@ var __privateMethod = (obj, member, method) => {
34
34
  __accessCheck(obj, member, "access private method");
35
35
  return method;
36
36
  };
37
- var _label, _options, _data, _a, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _ComputeVelocityByTimeDiff, ComputeVelocityByTimeDiff_fn, _ComputeVelocity, ComputeVelocity_fn, _SetupAutoComputeVelocity, SetupAutoComputeVelocity_fn, _GetVelocityStackAverage, GetVelocityStackAverage_fn, _GetVal, GetVal_fn, _SetVal, SetVal_fn, _GetVelocity, GetVelocity_fn, _GetMaxVelocity, GetMaxVelocity_fn, _GetDelta, GetDelta_fn, _GetTimeStamp, GetTimeStamp_fn, _GetCountDiff, GetCountDiff_fn, _GetTimeDiff, GetTimeDiff_fn, _GetDeltaCountDiff, GetDeltaCountDiff_fn, _GetDeltaTimeDif, GetDeltaTimeDif_fn, _GetAverageVelocity, GetAverageVelocity_fn, _histogramData, _val, _copy2, _GetVal2, GetVal_fn2, _SetVal2, SetVal_fn2, _GetHistogramData, GetHistogramData_fn, _SetHistogramData, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _DumpToConsole, DumpToConsole_fn, _GetVal3, GetVal_fn3, _SetVal3, SetVal_fn3, _start, _copy4, _pauseVal, _GetVal4, GetVal_fn4, _SetVal4, SetVal_fn4, _convertMS, convertMS_fn, _val2, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _GetVal5, GetVal_fn5, _SetVal5, SetVal_fn5, _GetMin, GetMin_fn, _GetMax, GetMax_fn, _GetAverage, GetAverage_fn, _GetAndResetMaxVal, GetAndResetMaxVal_fn, _NumberCompare, NumberCompare_fn, _GetPercentileData, GetPercentileData_fn, _val3, _copy6, _GetVal6, GetVal_fn6, _SetVal6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _instruments, _inPublish, _observer2, _publishState, _GetInstrument, GetInstrument_fn, _ProcessTelemetryCommand, ProcessTelemetryCommand_fn, _CreateInstrument, CreateInstrument_fn, _CreateInstruments, CreateInstruments_fn, _GetPayloadData, GetPayloadData_fn, _PublishTimeoutLoop, PublishTimeoutLoop_fn, _httpsAgent, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2, _LogDebugMessage, LogDebugMessage_fn, _LogErrorMessage, LogErrorMessage_fn, _InvokeRESTAPI, InvokeRESTAPI_fn, _GetData, _SetupTimeout, SetupTimeout_fn, _AddKeepAlive, AddKeepAlive_fn, _RemoveKeepAlive, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options3, _LogDebugMessage2, LogDebugMessage_fn2, _GetSubscribeKeepAliveAckEventName, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options4, _socketIoMessageSender, _LogDebugMessage3, LogDebugMessage_fn3, _LogErrorMessage2, LogErrorMessage_fn2, _AddKeepAlive2, AddKeepAlive_fn2, _RemoveKeepAlive2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options5, _LogDebugMessage4, LogDebugMessage_fn4, _LogErrorMessage3, LogErrorMessage_fn3, _options6, _sockets, _httpsAgent2, _LogDebugMessage5, LogDebugMessage_fn5, _LogErrorMessage4, LogErrorMessage_fn4, _EstablishSocketConnect, EstablishSocketConnect_fn;
37
+ var _label, _options, _data, _a, _interval, _timeoutComputeVelocity, _lastVelocity, _delta, _maxVelocity, _timerInterval, _copy, _velocity, _velocityVal, _valStack, _averageValStack, _maxAverageValStack, _maxAverageIterations, _valStackMaxLength, _valStackAverage, _timeStamp, _maxTimeDiff, _vaTimeDiff, _velocityTimeDiff, _autoComputeVelocity, _autoComputeVelocityTimeout, _countDiff, _timeDiff, _deltaCountDiff, _deltaTimeDif, _minTimeForReporting, _averageVelocity, _ComputeVelocityByTimeDiff, ComputeVelocityByTimeDiff_fn, _ComputeVelocity, ComputeVelocity_fn, _SetupAutoComputeVelocity, SetupAutoComputeVelocity_fn, _GetVelocityStackAverage, GetVelocityStackAverage_fn, _GetVal, GetVal_fn, _SetVal, SetVal_fn, _GetVelocity, GetVelocity_fn, _GetMaxVelocity, GetMaxVelocity_fn, _GetDelta, GetDelta_fn, _GetTimeStamp, GetTimeStamp_fn, _GetCountDiff, GetCountDiff_fn, _GetTimeDiff, GetTimeDiff_fn, _GetDeltaCountDiff, GetDeltaCountDiff_fn, _GetDeltaTimeDif, GetDeltaTimeDif_fn, _GetAverageVelocity, GetAverageVelocity_fn, _histogramData, _val, _copy2, _GetVal2, GetVal_fn2, _SetVal2, SetVal_fn2, _GetHistogramData, GetHistogramData_fn, _SetHistogramData, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _DumpToConsole, DumpToConsole_fn, _GetVal3, GetVal_fn3, _SetVal3, SetVal_fn3, _start, _copy4, _pauseVal, _GetVal4, GetVal_fn4, _SetVal4, SetVal_fn4, _convertMS, convertMS_fn, _val2, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _GetVal5, GetVal_fn5, _SetVal5, SetVal_fn5, _GetMin, GetMin_fn, _GetMax, GetMax_fn, _GetAverage, GetAverage_fn, _GetAndResetMaxVal, GetAndResetMaxVal_fn, _NumberCompare, NumberCompare_fn, _GetPercentileData, GetPercentileData_fn, _val3, _copy6, _GetVal6, GetVal_fn6, _SetVal6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _instruments, _inPublish, _observer2, _publishState, _GetInstrument, GetInstrument_fn, _ProcessTelemetryCommand, ProcessTelemetryCommand_fn, _CreateInstrument, CreateInstrument_fn, _CreateInstruments, CreateInstruments_fn, _GetPayloadData, GetPayloadData_fn, _PublishTimeoutLoop, PublishTimeoutLoop_fn, _UpdateState, UpdateState_fn, _httpsAgent, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2, _LogDebugMessage, LogDebugMessage_fn, _LogErrorMessage, LogErrorMessage_fn, _InvokeRESTAPI, InvokeRESTAPI_fn, _GetData, _SetupTimeout, SetupTimeout_fn, _AddKeepAlive, AddKeepAlive_fn, _RemoveKeepAlive, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options3, _LogDebugMessage2, LogDebugMessage_fn2, _GetSubscribeKeepAliveAckEventName, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options4, _socketIoMessageSender, _LogDebugMessage3, LogDebugMessage_fn3, _LogErrorMessage2, LogErrorMessage_fn2, _AddKeepAlive2, AddKeepAlive_fn2, _RemoveKeepAlive2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options5, _LogDebugMessage4, LogDebugMessage_fn4, _LogErrorMessage3, LogErrorMessage_fn3, _options6, _sockets, _httpsAgent2, _LogDebugMessage5, LogDebugMessage_fn5, _LogErrorMessage4, LogErrorMessage_fn4, _EstablishSocketConnect, EstablishSocketConnect_fn;
38
38
  import _cloneDeep from "lodash.clonedeep";
39
39
  import isNode from "detect-node";
40
40
  import { STSOptionsBase } from "@nsshunt/stsutils";
@@ -3998,6 +3998,7 @@ class PublishInstrumentController extends STSOptionsBase {
3998
3998
  __privateAdd(this, _CreateInstruments);
3999
3999
  __privateAdd(this, _GetPayloadData);
4000
4000
  __privateAdd(this, _PublishTimeoutLoop);
4001
+ __privateAdd(this, _UpdateState);
4001
4002
  __privateAdd(this, _instruments, {});
4002
4003
  __privateAdd(this, _inPublish, false);
4003
4004
  __privateAdd(this, _observer2, null);
@@ -4007,6 +4008,7 @@ class PublishInstrumentController extends STSOptionsBase {
4007
4008
  LogMessage: message
4008
4009
  });
4009
4010
  });
4011
+ __privateMethod(this, _UpdateState, UpdateState_fn).call(this, 0);
4010
4012
  this.SetupInstrumentation();
4011
4013
  this.StartPublish();
4012
4014
  }
@@ -4033,26 +4035,26 @@ class PublishInstrumentController extends STSOptionsBase {
4033
4035
  }
4034
4036
  async StartPublish() {
4035
4037
  if (__privateGet(this, _publishState) !== 0) {
4036
- this.options.logger.debug(chalk$1.yellow(`StartPublish:${this.options.processContext.nid}: StartPublish called when not currently in the init state.`));
4038
+ this.options.logger.debug(chalk$1.yellow(`StartPublish:${this.options.processContext.nid}: StartPublish called when not currently in the init state. Current State: [${__privateGet(this, _publishState)}]`));
4037
4039
  return false;
4038
4040
  }
4039
- __privateSet(this, _publishState, 1);
4041
+ __privateMethod(this, _UpdateState, UpdateState_fn).call(this, 1);
4040
4042
  __privateMethod(this, _PublishTimeoutLoop, PublishTimeoutLoop_fn).call(this, this.options.publishInterval);
4041
4043
  return true;
4042
4044
  }
4043
4045
  async EndPublish() {
4044
4046
  if (__privateGet(this, _publishState) !== 1) {
4045
- this.options.logger.debug(chalk$1.yellow(`EndPublish:${this.options.processContext.nid}: EndPublish called when not within the started state.`));
4047
+ this.options.logger.debug(chalk$1.yellow(`EndPublish:${this.options.processContext.nid}: EndPublish called when not within the started state. Current State: [${__privateGet(this, _publishState)}]`));
4046
4048
  return false;
4047
4049
  }
4048
- __privateSet(this, _publishState, 2);
4050
+ __privateMethod(this, _UpdateState, UpdateState_fn).call(this, 2);
4049
4051
  if (__privateGet(this, _observer2) !== null) {
4050
4052
  clearInterval(__privateGet(this, _observer2));
4051
4053
  __privateSet(this, _observer2, null);
4052
4054
  await this.Publish();
4053
4055
  }
4054
4056
  await this.options.publisherTransport.Close();
4055
- __privateSet(this, _publishState, 0);
4057
+ __privateMethod(this, _UpdateState, UpdateState_fn).call(this, 0);
4056
4058
  return true;
4057
4059
  }
4058
4060
  SetupInstrumentation() {
@@ -4286,6 +4288,12 @@ PublishTimeoutLoop_fn = function(publishInterval) {
4286
4288
  if (isNode)
4287
4289
  __privateGet(this, _observer2).unref();
4288
4290
  };
4291
+ _UpdateState = new WeakSet();
4292
+ UpdateState_fn = function(newState) {
4293
+ const previousState = __privateGet(this, _publishState);
4294
+ __privateSet(this, _publishState, newState);
4295
+ this.options.logger.debug(chalk$1.yellow(`#UpdateState:${this.options.processContext.nid}: Previous State: [${previousState}]. Current State: [${__privateGet(this, _publishState)}]`));
4296
+ };
4289
4297
  const STSInstrumentControllerPluginKey = Symbol("instrumentController");
4290
4298
  class AgentInstrumentController extends PublishInstrumentController {
4291
4299
  /**