@nsshunt/stsobservability 1.0.75 → 1.0.76

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.
@@ -21,7 +21,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
21
21
  }
22
22
  });
23
23
 
24
- var _a, _label, _options2, _data2, _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, _agentManager2, _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, _options3, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options4, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options5, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options6, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options7, _sockets, _agentManager3, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn, _socketIoServerHelperOptions, _namespace, _SetupStandardEvents, _SetupConnectionMiddleware, _SetupMessageMiddleware;
24
+ var _a, _label, _options2, _data2, _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, _agentManager2, _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, _options3, _agentManager3, _ObservabilityRESTAPISubscriber_instances, LogDebugMessage_fn, LogErrorMessage_fn, InvokeRESTAPI_fn, _GetData, SetupTimeout_fn, AddKeepAlive_fn, RemoveKeepAlive_fn, _messageWithAckPayloadRecords, _socket, _maxReties, _timeoutValue, _options4, _SocketIoMessageSender_instances, LogDebugMessage_fn2, GetSubscribeKeepAliveAckEventName_fn, _socketSubscribeKeepAlive2, _socket2, _options5, _socketIoMessageSender, _ObservabilitySocketIOSubscriber_instances, LogDebugMessage_fn3, LogErrorMessage_fn2, AddKeepAlive_fn2, RemoveKeepAlive_fn2, _observabilitySocketIOSubscriber, _subscriptions, _kafkaHelper, _serviceModel, _agentModel, _lambdaModel, _options6, _ObservabilitySubscriptionManager_instances, LogDebugMessage_fn4, LogErrorMessage_fn3, _options7, _sockets, _agentManager4, _SocketIoClientHelper_instances, LogDebugMessage_fn5, LogErrorMessage_fn4, EstablishSocketConnect_fn, _socketIoServerHelperOptions, _namespace, _SetupStandardEvents, _SetupConnectionMiddleware, _SetupMessageMiddleware;
25
25
  var Gauge = /* @__PURE__ */ ((Gauge2) => {
26
26
  Gauge2["ACTIVE_REQUEST_GAUGE"] = "a";
27
27
  Gauge2["AUTHENTICATION_COUNT_GAUGE"] = "b";
@@ -6560,10 +6560,12 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6560
6560
  __privateAdd2(this, _agentResetInterval, null);
6561
6561
  __privateAdd2(this, _requestCount, 0);
6562
6562
  __privateAdd2(this, _SetupResetInterval, () => {
6563
- __privateSet2(this, _agentResetInterval, setTimeout(() => {
6564
- this.ResetAgent();
6565
- __privateGet2(this, _SetupResetInterval).call(this);
6566
- }, __privateGet2(this, _options).agentResetInterval).unref());
6563
+ if (__privateGet2(this, _options).agentResetInterval && __privateGet2(this, _options).agentResetInterval > 0) {
6564
+ __privateSet2(this, _agentResetInterval, setTimeout(() => {
6565
+ this.ResetAgent();
6566
+ __privateGet2(this, _SetupResetInterval).call(this);
6567
+ }, __privateGet2(this, _options).agentResetInterval).unref());
6568
+ }
6567
6569
  });
6568
6570
  __privateAdd2(this, _GetAgentOptions, (https2) => {
6569
6571
  let options;
@@ -6599,6 +6601,22 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6599
6601
  __privateGet2(this, _SetupResetInterval).call(this);
6600
6602
  }
6601
6603
  }
6604
+ get agentResetInterval() {
6605
+ return __privateGet2(this, _options).agentResetInterval;
6606
+ }
6607
+ set agentResetInterval(val) {
6608
+ if (__privateGet2(this, _agentResetInterval)) {
6609
+ clearTimeout(__privateGet2(this, _agentResetInterval));
6610
+ }
6611
+ __privateGet2(this, _options).agentResetInterval = val;
6612
+ __privateGet2(this, _SetupResetInterval).call(this);
6613
+ }
6614
+ get agentResetCount() {
6615
+ return __privateGet2(this, _options).agentResetCount;
6616
+ }
6617
+ set agentResetCount(val) {
6618
+ __privateGet2(this, _options).agentResetCount = val;
6619
+ }
6602
6620
  IncRequestCount() {
6603
6621
  __privateWrapper2(this, _requestCount)._++;
6604
6622
  if (__privateGet2(this, _options).agentResetCount) {
@@ -6747,7 +6765,6 @@ var __privateWrapper = (obj, member, setter, getter) => ({
6747
6765
  //data: payload,
6748
6766
  data: Buffer.from(encodedData),
6749
6767
  headers,
6750
- //httpsAgent: this.#httpsAgent,
6751
6768
  socketPath: this.options.socketPath
6752
6769
  });
6753
6770
  } else {
@@ -7662,6 +7679,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
7662
7679
  __privateAdd(this, _options3);
7663
7680
  // This is required becuase each call to .bind create a new replica bound function - so we need the same instance for on/off event bindings.
7664
7681
  __publicField(this, "KeepAliveAckBoundFunction");
7682
+ __privateAdd(this, _agentManager3, null);
7665
7683
  __privateAdd(this, _GetData, async (subscription) => {
7666
7684
  try {
7667
7685
  const retVal = await __privateMethod(this, _ObservabilityRESTAPISubscriber_instances, InvokeRESTAPI_fn).call(this, subscription);
@@ -7678,6 +7696,9 @@ var __privateWrapper = (obj, member, setter, getter) => ({
7678
7696
  }
7679
7697
  });
7680
7698
  __privateSet(this, _options3, options);
7699
+ if (isNode && options.useAgentManager && options.useAgentManager === true) {
7700
+ __privateSet(this, _agentManager3, new AgentManager({}));
7701
+ }
7681
7702
  }
7682
7703
  SubscribeOne(subscription) {
7683
7704
  this.Subscribe([subscription]);
@@ -7706,6 +7727,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
7706
7727
  }
7707
7728
  _socketSubscribeKeepAlive = new WeakMap();
7708
7729
  _options3 = new WeakMap();
7730
+ _agentManager3 = new WeakMap();
7709
7731
  _ObservabilityRESTAPISubscriber_instances = new WeakSet();
7710
7732
  LogDebugMessage_fn = function(message) {
7711
7733
  __privateGet(this, _options3).logger.debug(message);
@@ -7788,13 +7810,8 @@ var __privateWrapper = (obj, member, setter, getter) => ({
7788
7810
  let retVal;
7789
7811
  const start = performance.now();
7790
7812
  try {
7791
- if (isNode && __privateGet(this, _options3).agent) {
7792
- retVal = await axios({
7793
- url: endPointUrl,
7794
- method: "get",
7795
- headers,
7796
- httpsAgent: __privateGet(this, _options3).agent
7797
- });
7813
+ if (isNode && __privateGet(this, _agentManager3)) {
7814
+ retVal = await axios(new STSAxiosConfig(endPointUrl, "get", headers).withAgentManager(__privateGet(this, _agentManager3)).config);
7798
7815
  } else {
7799
7816
  retVal = await axios({
7800
7817
  url: endPointUrl,
@@ -8666,10 +8683,10 @@ var __privateWrapper = (obj, member, setter, getter) => ({
8666
8683
  __privateAdd(this, _SocketIoClientHelper_instances);
8667
8684
  __privateAdd(this, _options7);
8668
8685
  __privateAdd(this, _sockets, {});
8669
- __privateAdd(this, _agentManager3, null);
8686
+ __privateAdd(this, _agentManager4, null);
8670
8687
  __privateSet(this, _options7, options);
8671
8688
  if (isNode) {
8672
- __privateSet(this, _agentManager3, new AgentManager({
8689
+ __privateSet(this, _agentManager4, new AgentManager({
8673
8690
  agentOptions: __privateGet(this, _options7).agentOptions
8674
8691
  }));
8675
8692
  }
@@ -8696,7 +8713,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
8696
8713
  }
8697
8714
  _options7 = new WeakMap();
8698
8715
  _sockets = new WeakMap();
8699
- _agentManager3 = new WeakMap();
8716
+ _agentManager4 = new WeakMap();
8700
8717
  _SocketIoClientHelper_instances = new WeakSet();
8701
8718
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8702
8719
  LogDebugMessage_fn5 = function(message) {
@@ -8726,7 +8743,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
8726
8743
  socketOptions = {
8727
8744
  transports: ["websocket"],
8728
8745
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8729
- agent: (_a2 = __privateGet(this, _agentManager3)) == null ? void 0 : _a2.GetAgent(socketDetail.address)
8746
+ agent: (_a2 = __privateGet(this, _agentManager4)) == null ? void 0 : _a2.GetAgent(socketDetail.address)
8730
8747
  };
8731
8748
  } else {
8732
8749
  socketOptions = {