@nsshunt/stsobservability 1.0.52 → 1.0.54

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.
@@ -17,10 +17,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
17
17
  return __privateGet(obj, member, getter);
18
18
  }
19
19
  });
20
- var _a, _label, _options, _data, _val, _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, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _httpsAgent, _inPublish, _observer2, _publishState, _publisherTransport, _PublishInstruments_instances, PublishTimeoutLoop_fn, UpdateState_fn, _instruments, _worker, _publisher, _wwClient, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options3, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options4, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options5, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options6, _sockets, _httpsAgent2, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn;
20
+ var _a, _label, _options, _data, _val, _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, _InstrumentVelocity_instances, ComputeVelocityByTimeDiff_fn, ComputeVelocity_fn, SetupAutoComputeVelocity_fn, GetVelocityStackAverage_fn, GetVal_fn, SetVal_fn, GetVelocity_fn, GetMaxVelocity_fn, GetDelta_fn, GetTimeStamp_fn, GetCountDiff_fn, GetTimeDiff_fn, GetDeltaCountDiff_fn, GetDeltaTimeDif_fn, GetAverageVelocity_fn, _histogramData, _val2, _copy2, _InstrumentHistogram_instances, GetVal_fn2, SetVal_fn2, GetHistogramData_fn, SetHistogramData_fn, _messages, _readPos, _maxSize, _copy3, _useLatestMessages, _consoleLogging, _instrumentLogging, _winstonLogging, _stsLogger, _InstrumentLog_instances, DumpToConsole_fn, GetVal_fn3, SetVal_fn3, _start, _copy4, _pauseVal, _InstrumentTimerGauge_instances, GetVal_fn4, SetVal_fn4, _val3, _maxval, _lastObservedValue, _timeSeriesList, _maxSampleSize, _timerInterval2, _observer, _min, _max, _observations, _total, _copy5, _InstrumentGauge_instances, GetVal_fn5, SetVal_fn5, GetMin_fn, GetMax_fn, GetAverage_fn, GetAndResetMaxVal_fn, NumberCompare_fn, GetPercentileData_fn, _val4, _copy6, _InstrumentObject_instances, GetVal_fn6, SetVal_fn6, _tinyEmitter, _RequestCompleted, _httpsAgent, _inPublish, _observer2, _publishState, _publisherTransport, _PublishInstruments_instances, PublishTimeoutLoop_fn, UpdateState_fn, _instruments, _publisher, _PublishInstrumentController_instances, GetInstrument_fn, ProcessTelemetryCommand_fn, CreateInstrument_fn, CreateInstruments_fn, _kafkaLog, _maxLogLength, _socketSubscribeKeepAlive, _options2, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options3, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options4, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options5, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options6, _sockets, _httpsAgent2, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn;
21
21
  import _cloneDeep from "lodash.clonedeep";
22
22
  import isNode from "detect-node";
23
- import { STSOptionsBase, WebWorkerMessageHandler, defaultLogger } from "@nsshunt/stsutils";
23
+ import { STSOptionsBase } from "@nsshunt/stsutils";
24
24
  import { TinyEmitter } from "tiny-emitter";
25
25
  import https from "node:https";
26
26
  import axios from "axios";
@@ -4722,83 +4722,40 @@ var ePublishState = /* @__PURE__ */ ((ePublishState2) => {
4722
4722
  return ePublishState2;
4723
4723
  })(ePublishState || {});
4724
4724
  const _PublishInstrumentController = class _PublishInstrumentController extends STSOptionsBase {
4725
+ //#worker: any = undefined; // Worker
4726
+ //#wwClient: WebWorkerMessageHandler | null = null;
4725
4727
  constructor(options) {
4726
4728
  super(options);
4727
4729
  __privateAdd(this, _PublishInstrumentController_instances);
4728
4730
  __privateAdd(this, _instruments, {});
4729
- __privateAdd(this, _worker);
4730
- // Worker
4731
4731
  __privateAdd(this, _publisher, null);
4732
- __privateAdd(this, _wwClient, null);
4733
4732
  __publicField(this, "LogEx", (message) => {
4734
4733
  this.UpdateInstrument(Gauge.LOGGER, {
4735
4734
  LogMessage: message
4736
4735
  });
4737
4736
  });
4738
4737
  this.SetupInstrumentation();
4739
- if (this.options.worker !== void 0) {
4740
- __privateSet(this, _worker, this.options.worker);
4741
- __privateSet(this, _wwClient, new WebWorkerMessageHandler({
4742
- logger: defaultLogger,
4743
- role: "CLIENT",
4744
- namespace: "mytestapp",
4745
- groups: [],
4746
- ignoreEvents: ["ping"],
4747
- messagePort: __privateGet(this, _worker)
4748
- }));
4749
- __privateGet(this, _wwClient).Start();
4750
- __privateGet(this, _wwClient).on("getpayload", (args, callback) => {
4751
- const data = this.GetPayloadData();
4752
- callback({
4753
- data
4754
- });
4755
- });
4756
- setTimeout(async () => {
4757
- var _a2;
4758
- await ((_a2 = __privateGet(this, _wwClient)) == null ? void 0 : _a2.emitex("options", {}));
4759
- this.StartPublish();
4760
- }, 1e3);
4761
- } else {
4762
- const publishInstrumentsOptions = {
4763
- logger: options.logger,
4764
- processContext: options.processContext,
4765
- publishInterval: options.publishInterval,
4766
- publishInstrumentController: this,
4767
- publishTransportBaseOptions: options.publishTransportBaseOptions
4768
- };
4769
- __privateSet(this, _publisher, new PublishInstruments(publishInstrumentsOptions));
4770
- this.StartPublish();
4771
- }
4738
+ const publishInstrumentsOptions = {
4739
+ logger: options.logger,
4740
+ processContext: options.processContext,
4741
+ publishInterval: options.publishInterval,
4742
+ publishInstrumentController: this,
4743
+ publishTransportBaseOptions: options.publishTransportBaseOptions
4744
+ };
4745
+ __privateSet(this, _publisher, new PublishInstruments(publishInstrumentsOptions));
4746
+ this.StartPublish();
4772
4747
  }
4773
4748
  get options() {
4774
4749
  return super.options;
4775
4750
  }
4776
4751
  async StartPublish() {
4777
- var _a2;
4778
- if (__privateGet(this, _worker)) {
4779
- await ((_a2 = __privateGet(this, _wwClient)) == null ? void 0 : _a2.emitex("start", {}));
4780
- return true;
4781
- } else {
4782
- return __privateGet(this, _publisher).StartPublish();
4783
- }
4752
+ return __privateGet(this, _publisher).StartPublish();
4784
4753
  }
4785
4754
  async EndPublish() {
4786
- var _a2;
4787
- if (__privateGet(this, _worker)) {
4788
- await ((_a2 = __privateGet(this, _wwClient)) == null ? void 0 : _a2.emitex("stop", {}));
4789
- return true;
4790
- } else {
4791
- return __privateGet(this, _publisher).EndPublish();
4792
- }
4755
+ return __privateGet(this, _publisher).EndPublish();
4793
4756
  }
4794
4757
  async Publish() {
4795
- var _a2;
4796
- if (__privateGet(this, _worker)) {
4797
- await ((_a2 = __privateGet(this, _wwClient)) == null ? void 0 : _a2.emitex("publish", {}));
4798
- return true;
4799
- } else {
4800
- return __privateGet(this, _publisher).Publish();
4801
- }
4758
+ return __privateGet(this, _publisher).Publish();
4802
4759
  }
4803
4760
  GetPayloadData() {
4804
4761
  const context = this.options.processContext;
@@ -4862,9 +4819,7 @@ const _PublishInstrumentController = class _PublishInstrumentController extends
4862
4819
  }
4863
4820
  };
4864
4821
  _instruments = new WeakMap();
4865
- _worker = new WeakMap();
4866
4822
  _publisher = new WeakMap();
4867
- _wwClient = new WeakMap();
4868
4823
  _PublishInstrumentController_instances = new WeakSet();
4869
4824
  GetInstrument_fn = function(instrumentName) {
4870
4825
  return __privateGet(this, _instruments)[instrumentName];