@nsshunt/stsappframework 3.1.213 → 3.1.215

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.
Files changed (379) hide show
  1. package/dist/commonTypes.js.map +1 -1
  2. package/dist/index.js +1 -7
  3. package/dist/index.js.map +1 -1
  4. package/dist/masterprocessbase.js +33 -46
  5. package/dist/masterprocessbase.js.map +1 -1
  6. package/dist/processbase.js +29 -0
  7. package/dist/processbase.js.map +1 -1
  8. package/dist/serverprocessbase.js +51 -66
  9. package/dist/serverprocessbase.js.map +1 -1
  10. package/dist/stscontrollerbase.js.map +1 -1
  11. package/dist/{server.js → stsexpressserver.js} +1 -1
  12. package/dist/stsexpressserver.js.map +1 -0
  13. package/dist/stslatencycontroller.js.map +1 -1
  14. package/dist/stslatencyroute.js.map +1 -1
  15. package/dist/stsrouterbase.js.map +1 -1
  16. package/dist/vitesttesting/appSingleWSS.js +2 -1
  17. package/dist/vitesttesting/appSingleWSS.js.map +1 -1
  18. package/dist/workerprocessbase.js.map +1 -1
  19. package/package.json +5 -6
  20. package/src/commonTypes.ts +2 -0
  21. package/src/index.ts +1 -7
  22. package/src/masterprocessbase.ts +42 -55
  23. package/src/processbase.ts +32 -1
  24. package/src/serverprocessbase.ts +55 -72
  25. package/src/{socketIoServerHelper.ts → socketIoServerHelper.ts_bak} +1 -2
  26. package/src/stscontrollerbase.ts +1 -2
  27. package/src/{server.ts → stsexpressserver.ts} +1 -2
  28. package/src/stslatencycontroller.ts +1 -2
  29. package/src/stslatencyroute.ts +1 -2
  30. package/src/stsrouterbase.ts +1 -2
  31. package/src/vitesttesting/appSingleWSS.ts +2 -1
  32. package/src/workerprocessbase.ts +1 -2
  33. package/types/commonTypes.d.ts +0 -15
  34. package/types/commonTypes.d.ts.map +1 -1
  35. package/types/index.d.ts +0 -7
  36. package/types/index.d.ts.map +1 -1
  37. package/types/masterprocessbase.d.ts.map +1 -1
  38. package/types/processbase.d.ts +3 -0
  39. package/types/processbase.d.ts.map +1 -1
  40. package/types/serverprocessbase.d.ts +3 -1
  41. package/types/serverprocessbase.d.ts.map +1 -1
  42. package/types/stscontrollerbase.d.ts.map +1 -1
  43. package/types/{server.d.ts → stsexpressserver.d.ts} +1 -1
  44. package/types/stsexpressserver.d.ts.map +1 -0
  45. package/types/stslatencycontroller.d.ts.map +1 -1
  46. package/types/stslatencyroute.d.ts.map +1 -1
  47. package/types/stsrouterbase.d.ts.map +1 -1
  48. package/types/vitesttesting/appSingleWSS.d.ts.map +1 -1
  49. package/types/workerprocessbase.d.ts.map +1 -1
  50. package/dist/authDefs.js +0 -33
  51. package/dist/authDefs.js.map +0 -1
  52. package/dist/gRPC/ststest/protos/auth_sample.js +0 -3
  53. package/dist/gRPC/ststest/protos/auth_sample.js.map +0 -1
  54. package/dist/gRPC/ststest/protos/echo.js +0 -3
  55. package/dist/gRPC/ststest/protos/echo.js.map +0 -1
  56. package/dist/gRPC/ststest/protos/grpc/examples/echo/Echo.js +0 -4
  57. package/dist/gRPC/ststest/protos/grpc/examples/echo/Echo.js.map +0 -1
  58. package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.js +0 -4
  59. package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.js.map +0 -1
  60. package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.js +0 -4
  61. package/dist/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.js.map +0 -1
  62. package/dist/gRPC/ststest/protos/grpc/testing/Request.js +0 -4
  63. package/dist/gRPC/ststest/protos/grpc/testing/Request.js.map +0 -1
  64. package/dist/gRPC/ststest/protos/grpc/testing/Response.js +0 -4
  65. package/dist/gRPC/ststest/protos/grpc/testing/Response.js.map +0 -1
  66. package/dist/gRPC/ststest/protos/grpc/testing/TestService.js +0 -4
  67. package/dist/gRPC/ststest/protos/grpc/testing/TestService.js.map +0 -1
  68. package/dist/gRPC/ststest/protos/hellostreamingworld/HelloReply.js +0 -4
  69. package/dist/gRPC/ststest/protos/hellostreamingworld/HelloReply.js.map +0 -1
  70. package/dist/gRPC/ststest/protos/hellostreamingworld/HelloRequest.js +0 -4
  71. package/dist/gRPC/ststest/protos/hellostreamingworld/HelloRequest.js.map +0 -1
  72. package/dist/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.js +0 -4
  73. package/dist/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.js.map +0 -1
  74. package/dist/gRPC/ststest/protos/hellostreamingworld.js +0 -3
  75. package/dist/gRPC/ststest/protos/hellostreamingworld.js.map +0 -1
  76. package/dist/gRPC/ststest/protos/helloworld/Greeter.js +0 -4
  77. package/dist/gRPC/ststest/protos/helloworld/Greeter.js.map +0 -1
  78. package/dist/gRPC/ststest/protos/helloworld/HelloReply.js +0 -4
  79. package/dist/gRPC/ststest/protos/helloworld/HelloReply.js.map +0 -1
  80. package/dist/gRPC/ststest/protos/helloworld/HelloRequest.js +0 -4
  81. package/dist/gRPC/ststest/protos/helloworld/HelloRequest.js.map +0 -1
  82. package/dist/gRPC/ststest/protos/helloworld.js +0 -3
  83. package/dist/gRPC/ststest/protos/helloworld.js.map +0 -1
  84. package/dist/gRPC/ststest/protos/keyvaluestore/KeyValueStore.js +0 -4
  85. package/dist/gRPC/ststest/protos/keyvaluestore/KeyValueStore.js.map +0 -1
  86. package/dist/gRPC/ststest/protos/keyvaluestore/Request.js +0 -4
  87. package/dist/gRPC/ststest/protos/keyvaluestore/Request.js.map +0 -1
  88. package/dist/gRPC/ststest/protos/keyvaluestore/Response.js +0 -4
  89. package/dist/gRPC/ststest/protos/keyvaluestore/Response.js.map +0 -1
  90. package/dist/gRPC/ststest/protos/keyvaluestore.js +0 -3
  91. package/dist/gRPC/ststest/protos/keyvaluestore.js.map +0 -1
  92. package/dist/gRPC/ststest/protos/route_guide.js +0 -3
  93. package/dist/gRPC/ststest/protos/route_guide.js.map +0 -1
  94. package/dist/gRPC/ststest/protos/routeguide/Feature.js +0 -4
  95. package/dist/gRPC/ststest/protos/routeguide/Feature.js.map +0 -1
  96. package/dist/gRPC/ststest/protos/routeguide/Point.js +0 -4
  97. package/dist/gRPC/ststest/protos/routeguide/Point.js.map +0 -1
  98. package/dist/gRPC/ststest/protos/routeguide/Rectangle.js +0 -4
  99. package/dist/gRPC/ststest/protos/routeguide/Rectangle.js.map +0 -1
  100. package/dist/gRPC/ststest/protos/routeguide/RouteGuide.js +0 -4
  101. package/dist/gRPC/ststest/protos/routeguide/RouteGuide.js.map +0 -1
  102. package/dist/gRPC/ststest/protos/routeguide/RouteNote.js +0 -4
  103. package/dist/gRPC/ststest/protos/routeguide/RouteNote.js.map +0 -1
  104. package/dist/gRPC/ststest/protos/routeguide/RouteSummary.js +0 -4
  105. package/dist/gRPC/ststest/protos/routeguide/RouteSummary.js.map +0 -1
  106. package/dist/gRPC/ststest/src/commonTypes.js +0 -3
  107. package/dist/gRPC/ststest/src/commonTypes.js.map +0 -1
  108. package/dist/gRPC/ststest/src/greeter_client.js +0 -67
  109. package/dist/gRPC/ststest/src/greeter_client.js.map +0 -1
  110. package/dist/gRPC/ststest/src/greeter_server.js +0 -78
  111. package/dist/gRPC/ststest/src/greeter_server.js.map +0 -1
  112. package/dist/gRPC/ststest/src/route_guide_client.js +0 -258
  113. package/dist/gRPC/ststest/src/route_guide_client.js.map +0 -1
  114. package/dist/gRPC/ststest/src/route_guide_server.js +0 -237
  115. package/dist/gRPC/ststest/src/route_guide_server.js.map +0 -1
  116. package/dist/gRPC/ststest/src/route_guide_server2.js +0 -205
  117. package/dist/gRPC/ststest/src/route_guide_server2.js.map +0 -1
  118. package/dist/influxdb/influxDBManager.js +0 -304
  119. package/dist/influxdb/influxDBManager.js.map +0 -1
  120. package/dist/influxdb/influxDBManagerAgent.js +0 -14
  121. package/dist/influxdb/influxDBManagerAgent.js.map +0 -1
  122. package/dist/influxdb/influxDBManagerBase.js +0 -100
  123. package/dist/influxdb/influxDBManagerBase.js.map +0 -1
  124. package/dist/influxdb/influxDBManagerLambda.js +0 -17
  125. package/dist/influxdb/influxDBManagerLambda.js.map +0 -1
  126. package/dist/influxdb/influxDBManagerService.js +0 -14
  127. package/dist/influxdb/influxDBManagerService.js.map +0 -1
  128. package/dist/publishInstrumentsWebWorker.js +0 -159
  129. package/dist/publishInstrumentsWebWorker.js.map +0 -1
  130. package/dist/server.js.map +0 -1
  131. package/dist/socketIoServerHelper.js +0 -125
  132. package/dist/socketIoServerHelper.js.map +0 -1
  133. package/dist/tcpclient/app.js +0 -23
  134. package/dist/tcpclient/app.js.map +0 -1
  135. package/dist/tcpclient/app2.js +0 -57
  136. package/dist/tcpclient/app2.js.map +0 -1
  137. package/dist/tcpserver/app.js +0 -16
  138. package/dist/tcpserver/app.js.map +0 -1
  139. package/dist/tcpserver/appConfig.js +0 -83
  140. package/dist/tcpserver/appConfig.js.map +0 -1
  141. package/dist/tcpserver/appmaster.js +0 -446
  142. package/dist/tcpserver/appmaster.js.map +0 -1
  143. package/dist/testertesting/app.js +0 -284
  144. package/dist/testertesting/app.js.map +0 -1
  145. package/dist/testertesting/commonTypes.js +0 -47
  146. package/dist/testertesting/commonTypes.js.map +0 -1
  147. package/dist/testertesting/telemetryProcessor.js +0 -111
  148. package/dist/testertesting/telemetryProcessor.js.map +0 -1
  149. package/dist/testertesting/testCase01.js +0 -169
  150. package/dist/testertesting/testCase01.js.map +0 -1
  151. package/dist/testertesting/workerInstance.js +0 -263
  152. package/dist/testertesting/workerInstance.js.map +0 -1
  153. package/dist/testertesting/workerManager.js +0 -450
  154. package/dist/testertesting/workerManager.js.map +0 -1
  155. package/dist/testertesting/workerWorkerTestRunner01.js +0 -35
  156. package/dist/testertesting/workerWorkerTestRunner01.js.map +0 -1
  157. package/dist/testing/app.js +0 -18
  158. package/dist/testing/app.js.map +0 -1
  159. package/dist/testing/appConfig.js +0 -93
  160. package/dist/testing/appConfig.js.map +0 -1
  161. package/dist/testing/appTinyEmitter.js +0 -37
  162. package/dist/testing/appTinyEmitter.js.map +0 -1
  163. package/dist/testing/appWorkerWSS.js +0 -151
  164. package/dist/testing/appWorkerWSS.js.map +0 -1
  165. package/dist/testing/appredistest.js +0 -239
  166. package/dist/testing/appredistest.js.map +0 -1
  167. package/dist/testing/appsolo.js +0 -67
  168. package/dist/testing/appsolo.js.map +0 -1
  169. package/dist/testing/promiseTesting.js +0 -77
  170. package/dist/testing/promiseTesting.js.map +0 -1
  171. package/dist/testing/server.js +0 -15
  172. package/dist/testing/server.js.map +0 -1
  173. package/dist/testing/wsevents.js +0 -3
  174. package/dist/testing/wsevents.js.map +0 -1
  175. package/dist/webworkertesting/app.js +0 -44
  176. package/dist/webworkertesting/app.js.map +0 -1
  177. package/dist/webworkertesting/worker.js +0 -21
  178. package/dist/webworkertesting/worker.js.map +0 -1
  179. package/src/authDefs.ts +0 -37
  180. package/src/gRPC/ststest/protos/BUILD +0 -82
  181. package/src/gRPC/ststest/protos/README.md +0 -8
  182. package/src/gRPC/ststest/protos/auth_sample.proto +0 -42
  183. package/src/gRPC/ststest/protos/auth_sample.ts +0 -20
  184. package/src/gRPC/ststest/protos/echo.proto +0 -45
  185. package/src/gRPC/ststest/protos/echo.ts +0 -22
  186. package/src/gRPC/ststest/protos/grpc/examples/echo/Echo.ts +0 -55
  187. package/src/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.ts +0 -10
  188. package/src/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.ts +0 -10
  189. package/src/gRPC/ststest/protos/grpc/testing/Request.ts +0 -12
  190. package/src/gRPC/ststest/protos/grpc/testing/Response.ts +0 -12
  191. package/src/gRPC/ststest/protos/grpc/testing/TestService.ts +0 -27
  192. package/src/gRPC/ststest/protos/hellostreamingworld/HelloReply.ts +0 -10
  193. package/src/gRPC/ststest/protos/hellostreamingworld/HelloRequest.ts +0 -12
  194. package/src/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.ts +0 -23
  195. package/src/gRPC/ststest/protos/hellostreamingworld.proto +0 -39
  196. package/src/gRPC/ststest/protos/hellostreamingworld.ts +0 -18
  197. package/src/gRPC/ststest/protos/helloworld/Greeter.ts +0 -35
  198. package/src/gRPC/ststest/protos/helloworld/HelloReply.ts +0 -10
  199. package/src/gRPC/ststest/protos/helloworld/HelloRequest.ts +0 -10
  200. package/src/gRPC/ststest/protos/helloworld.proto +0 -40
  201. package/src/gRPC/ststest/protos/helloworld.ts +0 -18
  202. package/src/gRPC/ststest/protos/keyvaluestore/KeyValueStore.ts +0 -23
  203. package/src/gRPC/ststest/protos/keyvaluestore/Request.ts +0 -10
  204. package/src/gRPC/ststest/protos/keyvaluestore/Response.ts +0 -10
  205. package/src/gRPC/ststest/protos/keyvaluestore.proto +0 -33
  206. package/src/gRPC/ststest/protos/keyvaluestore.ts +0 -18
  207. package/src/gRPC/ststest/protos/route_guide.proto +0 -111
  208. package/src/gRPC/ststest/protos/route_guide.ts +0 -21
  209. package/src/gRPC/ststest/protos/routeguide/Feature.ts +0 -13
  210. package/src/gRPC/ststest/protos/routeguide/Point.ts +0 -12
  211. package/src/gRPC/ststest/protos/routeguide/Rectangle.ts +0 -13
  212. package/src/gRPC/ststest/protos/routeguide/RouteGuide.ts +0 -58
  213. package/src/gRPC/ststest/protos/routeguide/RouteNote.ts +0 -13
  214. package/src/gRPC/ststest/protos/routeguide/RouteSummary.ts +0 -16
  215. package/src/gRPC/ststest/src/commonTypes.ts +0 -27
  216. package/src/gRPC/ststest/src/greeter_client.ts +0 -52
  217. package/src/gRPC/ststest/src/greeter_server.ts +0 -62
  218. package/src/gRPC/ststest/src/route_guide_client.ts +0 -266
  219. package/src/gRPC/ststest/src/route_guide_server.ts +0 -234
  220. package/src/gRPC/ststest/src/route_guide_server2.ts +0 -211
  221. package/src/influxdb/influxDBManager.ts +0 -334
  222. package/src/influxdb/influxDBManagerAgent.ts +0 -14
  223. package/src/influxdb/influxDBManagerBase.ts +0 -108
  224. package/src/influxdb/influxDBManagerLambda.ts +0 -17
  225. package/src/influxdb/influxDBManagerService.ts +0 -14
  226. package/src/publishInstrumentsWebWorker.ts +0 -157
  227. package/src/tcpclient/app.ts +0 -21
  228. package/src/tcpclient/app2.ts +0 -58
  229. package/src/tcpserver/app.ts +0 -11
  230. package/src/tcpserver/appConfig.ts +0 -99
  231. package/src/tcpserver/appmaster.ts +0 -503
  232. package/src/testertesting/app.ts +0 -349
  233. package/src/testertesting/commonTypes.ts +0 -236
  234. package/src/testertesting/telemetryProcessor.ts +0 -125
  235. package/src/testertesting/testCase01.ts +0 -207
  236. package/src/testertesting/workerInstance.ts +0 -297
  237. package/src/testertesting/workerManager.ts +0 -511
  238. package/src/testertesting/workerWorkerTestRunner01.ts +0 -34
  239. package/src/testing/app.ts +0 -14
  240. package/src/testing/appConfig.ts +0 -110
  241. package/src/testing/appTinyEmitter.ts +0 -57
  242. package/src/testing/appWorkerWSS.ts +0 -174
  243. package/src/testing/appredistest.ts +0 -304
  244. package/src/testing/appsolo.ts +0 -96
  245. package/src/testing/docker-compose.yml +0 -20
  246. package/src/testing/promiseTesting.ts +0 -86
  247. package/src/testing/server.ts +0 -17
  248. package/src/testing/wsevents.ts +0 -33
  249. package/src/webworkertesting/app.ts +0 -56
  250. package/src/webworkertesting/worker.ts +0 -24
  251. package/types/authDefs.d.ts +0 -29
  252. package/types/authDefs.d.ts.map +0 -1
  253. package/types/gRPC/ststest/protos/auth_sample.d.ts +0 -19
  254. package/types/gRPC/ststest/protos/auth_sample.d.ts.map +0 -1
  255. package/types/gRPC/ststest/protos/echo.d.ts +0 -21
  256. package/types/gRPC/ststest/protos/echo.d.ts.map +0 -1
  257. package/types/gRPC/ststest/protos/grpc/examples/echo/Echo.d.ts +0 -43
  258. package/types/gRPC/ststest/protos/grpc/examples/echo/Echo.d.ts.map +0 -1
  259. package/types/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.d.ts +0 -7
  260. package/types/gRPC/ststest/protos/grpc/examples/echo/EchoRequest.d.ts.map +0 -1
  261. package/types/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.d.ts +0 -7
  262. package/types/gRPC/ststest/protos/grpc/examples/echo/EchoResponse.d.ts.map +0 -1
  263. package/types/gRPC/ststest/protos/grpc/testing/Request.d.ts +0 -9
  264. package/types/gRPC/ststest/protos/grpc/testing/Request.d.ts.map +0 -1
  265. package/types/gRPC/ststest/protos/grpc/testing/Response.d.ts +0 -9
  266. package/types/gRPC/ststest/protos/grpc/testing/Response.d.ts.map +0 -1
  267. package/types/gRPC/ststest/protos/grpc/testing/TestService.d.ts +0 -21
  268. package/types/gRPC/ststest/protos/grpc/testing/TestService.d.ts.map +0 -1
  269. package/types/gRPC/ststest/protos/hellostreamingworld/HelloReply.d.ts +0 -7
  270. package/types/gRPC/ststest/protos/hellostreamingworld/HelloReply.d.ts.map +0 -1
  271. package/types/gRPC/ststest/protos/hellostreamingworld/HelloRequest.d.ts +0 -9
  272. package/types/gRPC/ststest/protos/hellostreamingworld/HelloRequest.d.ts.map +0 -1
  273. package/types/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.d.ts +0 -17
  274. package/types/gRPC/ststest/protos/hellostreamingworld/MultiGreeter.d.ts.map +0 -1
  275. package/types/gRPC/ststest/protos/hellostreamingworld.d.ts +0 -17
  276. package/types/gRPC/ststest/protos/hellostreamingworld.d.ts.map +0 -1
  277. package/types/gRPC/ststest/protos/helloworld/Greeter.d.ts +0 -27
  278. package/types/gRPC/ststest/protos/helloworld/Greeter.d.ts.map +0 -1
  279. package/types/gRPC/ststest/protos/helloworld/HelloReply.d.ts +0 -7
  280. package/types/gRPC/ststest/protos/helloworld/HelloReply.d.ts.map +0 -1
  281. package/types/gRPC/ststest/protos/helloworld/HelloRequest.d.ts +0 -7
  282. package/types/gRPC/ststest/protos/helloworld/HelloRequest.d.ts.map +0 -1
  283. package/types/gRPC/ststest/protos/helloworld.d.ts +0 -17
  284. package/types/gRPC/ststest/protos/helloworld.d.ts.map +0 -1
  285. package/types/gRPC/ststest/protos/keyvaluestore/KeyValueStore.d.ts +0 -17
  286. package/types/gRPC/ststest/protos/keyvaluestore/KeyValueStore.d.ts.map +0 -1
  287. package/types/gRPC/ststest/protos/keyvaluestore/Request.d.ts +0 -7
  288. package/types/gRPC/ststest/protos/keyvaluestore/Request.d.ts.map +0 -1
  289. package/types/gRPC/ststest/protos/keyvaluestore/Response.d.ts +0 -7
  290. package/types/gRPC/ststest/protos/keyvaluestore/Response.d.ts.map +0 -1
  291. package/types/gRPC/ststest/protos/keyvaluestore.d.ts +0 -17
  292. package/types/gRPC/ststest/protos/keyvaluestore.d.ts.map +0 -1
  293. package/types/gRPC/ststest/protos/route_guide.d.ts +0 -20
  294. package/types/gRPC/ststest/protos/route_guide.d.ts.map +0 -1
  295. package/types/gRPC/ststest/protos/routeguide/Feature.d.ts +0 -10
  296. package/types/gRPC/ststest/protos/routeguide/Feature.d.ts.map +0 -1
  297. package/types/gRPC/ststest/protos/routeguide/Point.d.ts +0 -9
  298. package/types/gRPC/ststest/protos/routeguide/Point.d.ts.map +0 -1
  299. package/types/gRPC/ststest/protos/routeguide/Rectangle.d.ts +0 -10
  300. package/types/gRPC/ststest/protos/routeguide/Rectangle.d.ts.map +0 -1
  301. package/types/gRPC/ststest/protos/routeguide/RouteGuide.d.ts +0 -46
  302. package/types/gRPC/ststest/protos/routeguide/RouteGuide.d.ts.map +0 -1
  303. package/types/gRPC/ststest/protos/routeguide/RouteNote.d.ts +0 -10
  304. package/types/gRPC/ststest/protos/routeguide/RouteNote.d.ts.map +0 -1
  305. package/types/gRPC/ststest/protos/routeguide/RouteSummary.d.ts +0 -13
  306. package/types/gRPC/ststest/protos/routeguide/RouteSummary.d.ts.map +0 -1
  307. package/types/gRPC/ststest/src/commonTypes.d.ts +0 -23
  308. package/types/gRPC/ststest/src/commonTypes.d.ts.map +0 -1
  309. package/types/gRPC/ststest/src/greeter_client.d.ts +0 -3
  310. package/types/gRPC/ststest/src/greeter_client.d.ts.map +0 -1
  311. package/types/gRPC/ststest/src/greeter_server.d.ts +0 -3
  312. package/types/gRPC/ststest/src/greeter_server.d.ts.map +0 -1
  313. package/types/gRPC/ststest/src/route_guide_client.d.ts +0 -3
  314. package/types/gRPC/ststest/src/route_guide_client.d.ts.map +0 -1
  315. package/types/gRPC/ststest/src/route_guide_server.d.ts +0 -3
  316. package/types/gRPC/ststest/src/route_guide_server.d.ts.map +0 -1
  317. package/types/gRPC/ststest/src/route_guide_server2.d.ts +0 -3
  318. package/types/gRPC/ststest/src/route_guide_server2.d.ts.map +0 -1
  319. package/types/influxdb/influxDBManager.d.ts +0 -21
  320. package/types/influxdb/influxDBManager.d.ts.map +0 -1
  321. package/types/influxdb/influxDBManagerAgent.d.ts +0 -8
  322. package/types/influxdb/influxDBManagerAgent.d.ts.map +0 -1
  323. package/types/influxdb/influxDBManagerBase.d.ts +0 -14
  324. package/types/influxdb/influxDBManagerBase.d.ts.map +0 -1
  325. package/types/influxdb/influxDBManagerLambda.d.ts +0 -11
  326. package/types/influxdb/influxDBManagerLambda.d.ts.map +0 -1
  327. package/types/influxdb/influxDBManagerService.d.ts +0 -8
  328. package/types/influxdb/influxDBManagerService.d.ts.map +0 -1
  329. package/types/publishInstrumentsWebWorker.d.ts +0 -1
  330. package/types/publishInstrumentsWebWorker.d.ts.map +0 -1
  331. package/types/server.d.ts.map +0 -1
  332. package/types/socketIoServerHelper.d.ts +0 -20
  333. package/types/socketIoServerHelper.d.ts.map +0 -1
  334. package/types/tcpclient/app.d.ts +0 -2
  335. package/types/tcpclient/app.d.ts.map +0 -1
  336. package/types/tcpclient/app2.d.ts +0 -2
  337. package/types/tcpclient/app2.d.ts.map +0 -1
  338. package/types/tcpserver/app.d.ts +0 -2
  339. package/types/tcpserver/app.d.ts.map +0 -1
  340. package/types/tcpserver/appConfig.d.ts +0 -3
  341. package/types/tcpserver/appConfig.d.ts.map +0 -1
  342. package/types/tcpserver/appmaster.d.ts +0 -24
  343. package/types/tcpserver/appmaster.d.ts.map +0 -1
  344. package/types/testertesting/app.d.ts +0 -2
  345. package/types/testertesting/app.d.ts.map +0 -1
  346. package/types/testertesting/commonTypes.d.ts +0 -215
  347. package/types/testertesting/commonTypes.d.ts.map +0 -1
  348. package/types/testertesting/telemetryProcessor.d.ts +0 -6
  349. package/types/testertesting/telemetryProcessor.d.ts.map +0 -1
  350. package/types/testertesting/testCase01.d.ts +0 -20
  351. package/types/testertesting/testCase01.d.ts.map +0 -1
  352. package/types/testertesting/workerInstance.d.ts +0 -23
  353. package/types/testertesting/workerInstance.d.ts.map +0 -1
  354. package/types/testertesting/workerManager.d.ts +0 -16
  355. package/types/testertesting/workerManager.d.ts.map +0 -1
  356. package/types/testertesting/workerWorkerTestRunner01.d.ts +0 -7
  357. package/types/testertesting/workerWorkerTestRunner01.d.ts.map +0 -1
  358. package/types/testing/app.d.ts +0 -2
  359. package/types/testing/app.d.ts.map +0 -1
  360. package/types/testing/appConfig.d.ts +0 -3
  361. package/types/testing/appConfig.d.ts.map +0 -1
  362. package/types/testing/appTinyEmitter.d.ts +0 -2
  363. package/types/testing/appTinyEmitter.d.ts.map +0 -1
  364. package/types/testing/appWorkerWSS.d.ts +0 -26
  365. package/types/testing/appWorkerWSS.d.ts.map +0 -1
  366. package/types/testing/appredistest.d.ts +0 -4
  367. package/types/testing/appredistest.d.ts.map +0 -1
  368. package/types/testing/appsolo.d.ts +0 -3
  369. package/types/testing/appsolo.d.ts.map +0 -1
  370. package/types/testing/promiseTesting.d.ts +0 -4
  371. package/types/testing/promiseTesting.d.ts.map +0 -1
  372. package/types/testing/server.d.ts +0 -6
  373. package/types/testing/server.d.ts.map +0 -1
  374. package/types/testing/wsevents.d.ts +0 -18
  375. package/types/testing/wsevents.d.ts.map +0 -1
  376. package/types/webworkertesting/app.d.ts +0 -2
  377. package/types/webworkertesting/app.d.ts.map +0 -1
  378. package/types/webworkertesting/worker.d.ts +0 -2
  379. package/types/webworkertesting/worker.d.ts.map +0 -1
@@ -1,211 +0,0 @@
1
- /* eslint @typescript-eslint/no-explicit-any: 0 */ // --> OFF
2
-
3
- // cd /home/marcusbettens/projects/stsappframework/src/gRPC/ststest
4
- // npx proto-loader-gen-types --longs=String --enums=String --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=protos/ protos/*.proto
5
-
6
- /*
7
- *
8
- * Copyright 2015 gRPC authors.
9
- *
10
- * Licensed under the Apache License, Version 2.0 (the "License");
11
- * you may not use this file except in compliance with the License.
12
- * You may obtain a copy of the License at
13
- *
14
- * http://www.apache.org/licenses/LICENSE-2.0
15
- *
16
- * Unless required by applicable law or agreed to in writing, software
17
- * distributed under the License is distributed on an "AS IS" BASIS,
18
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
- * See the License for the specific language governing permissions and
20
- * limitations under the License.
21
- *
22
- */
23
-
24
- const PROTO_PATH_SV = __dirname + './../../../../src/gRPC/ststest/protos/route_guide.proto';
25
-
26
- import * as grpc from '@grpc/grpc-js';
27
- import * as protoLoader from '@grpc/proto-loader';
28
-
29
- //import { IFeature, IPoint, IRectangle, IRouteNote, IRouteSummary } from './commonTypes'
30
-
31
- import chalk from 'chalk'
32
-
33
- import fs from 'node:fs'
34
-
35
- import { ProtoGrpcType } from './../protos/route_guide'
36
-
37
- import { RouteGuideHandlers } from './../protos/routeguide/RouteGuide'
38
- import { Point, Point__Output } from '../protos/routeguide/Point';
39
- import { Feature } from './../protos/routeguide/Feature'
40
- import { RouteSummary } from './../protos/routeguide/RouteSummary'
41
- import { RouteNote, RouteNote__Output } from './../protos/routeguide/RouteNote'
42
-
43
- const packageDefinition = protoLoader.loadSync(
44
- PROTO_PATH_SV,
45
- {keepCase: true,
46
- longs: String,
47
- enums: String,
48
- defaults: true,
49
- oneofs: true
50
- });
51
- //const routeguide = grpc.loadPackageDefinition(packageDefinition).routeguide;
52
-
53
- const routeguide = (grpc.loadPackageDefinition(
54
- packageDefinition
55
- ) as unknown) as ProtoGrpcType;
56
-
57
- const exampleServer: RouteGuideHandlers = {
58
- GetFeature(call, callback) {
59
- console.log(chalk.grey(`getFeature: call.request: [${JSON.stringify(call.request)}]`));
60
- const retVal = checkFeature(call.request);
61
- console.log(chalk.grey(`getFeature: return: [${JSON.stringify(retVal)}]`));
62
- callback(null, retVal);
63
- },
64
-
65
- ListFeatures(call) {
66
- console.log(chalk.green(`listFeatures: forEach: [${JSON.stringify(call.request)}]`));
67
- const rectangle = call.request;
68
- const lo = rectangle.lo;
69
- const hi = rectangle.hi;
70
-
71
- const feature_list: Feature[] = [ ];
72
- for (let i=0; i < 10; i++) {
73
- feature_list.push({
74
- location: {
75
- latitude: (hi as Point__Output).latitude * 2 * (i+1),
76
- longitude: (lo as Point__Output).longitude * 2 * (i+1)
77
- },
78
- name: `the name for index: [${i}]`
79
- });
80
- }
81
- feature_list.forEach((feature: Feature) => {
82
- console.log(chalk.green(`listFeatures: forEach: [${JSON.stringify(feature)}]`));
83
- call.write(feature);
84
- });
85
- console.log(chalk.green(`listFeatures: call.end()`));
86
- call.end();
87
- },
88
-
89
- RecordRoute(call, callback) {
90
- let point_count = 0;
91
- let feature_count = 0;
92
- let distance = 0;
93
- let previous: any = null;
94
- // Start a timer
95
- const start_time = process.hrtime();
96
- call.on('data', function(point: Point__Output) {
97
- console.log(chalk.magenta(`recordRoute: on data: [${JSON.stringify(point)}]`));
98
- point_count += 1;
99
- if (checkFeature(point).name !== '') {
100
- feature_count += 1;
101
- }
102
- /* For each point after the first, add the incremental distance from the
103
- * previous point to the total distance value */
104
- if (previous != null) {
105
- distance += 1;
106
- }
107
- previous = point;
108
- });
109
- call.on('end', function() {
110
- const returnData: RouteSummary = {
111
- pointCount: point_count,
112
- featureCount: feature_count,
113
- // Cast the distance to an integer
114
- distance: distance|0,
115
- // End the timer
116
- elapsedTime: process.hrtime(start_time)[0]
117
- }
118
- console.log(chalk.magenta(`recordRoute: on end - return data: [${JSON.stringify(returnData)}]`));
119
- callback(null, returnData);
120
- });
121
- },
122
-
123
- RouteChat(call) {
124
- call.on('data', function(note: RouteNote__Output) {
125
- console.log(chalk.cyan(`routeChat: on data: [${JSON.stringify(note)}]`));
126
- // Send back what we just got
127
- const sendBack: RouteNote = JSON.parse(JSON.stringify(note));
128
- sendBack.message = `${note.message} reply message`;
129
- (sendBack.location as Point).latitude = (note.location as Point__Output).latitude * 2;
130
- (sendBack.location as Point).longitude = (note.location as Point__Output).longitude * 2;
131
- console.log(chalk.cyan(`routeChat: sending data: [${JSON.stringify(sendBack)}]`));
132
- call.write(sendBack);
133
- });
134
- call.on('end', function() {
135
- call.end();
136
- });
137
- }
138
- };
139
-
140
- /**
141
- * Get a feature object at the given point, or creates one if it does not exist.
142
- * @param {point} point The point to check
143
- * @return {feature} The feature object at the point. Note that an empty name
144
- * indicates no feature
145
- */
146
- function checkFeature(point: Point__Output): Feature {
147
- const feature: Feature = {
148
- name: "Some name",
149
- location: {
150
- latitude: point.latitude * 2,
151
- longitude: point.longitude * 2
152
- }
153
- };
154
- return feature;
155
- }
156
-
157
- /**
158
- * Get a new server with the handler functions in this file bound to the methods
159
- * it serves.
160
- * @return {Server} The new server object
161
- */
162
- function getServer() {
163
- const server = new grpc.Server();
164
- server.addService(routeguide.routeguide.RouteGuide.service, exampleServer);
165
- return server;
166
- }
167
-
168
- // HTTPS_SERVER_KEY_PATH=/etc/letsencrypt/live/stsmda.org/privkey.pem \
169
- // HTTPS_SERVER_CERT_PATH=/etc/letsencrypt/live/stsmda.org/fullchain.pem \
170
-
171
- /*
172
- export interface KeyCertPair {
173
- private_key: Buffer;
174
- cert_chain: Buffer;
175
- }
176
- */
177
-
178
- if (require.main === module) {
179
- // If this is run as a script, start a server on an unused port
180
- const routeServer = getServer();
181
-
182
- // Secure server
183
-
184
- routeServer.bindAsync('0.0.0.0:3029', grpc.ServerCredentials.createSsl(null,
185
- [
186
- {
187
- private_key: fs.readFileSync('/etc/letsencrypt/live/stsmda.org/privkey.pem'),
188
- cert_chain: fs.readFileSync('/etc/letsencrypt/live/stsmda.org/fullchain.pem')
189
- }
190
- ]), (error, port) => {
191
- if (error) {
192
- console.log(chalk.red(`Error starting gRPC TLS server on port: [${port}], Error: [${error}]`));
193
- } else {
194
- console.log(chalk.green(`Started gRPC TLS server on port: [${port}]`));
195
- }
196
- });
197
-
198
- // Insecure server
199
- /*
200
- routeServer.bindAsync('0.0.0.0:3029', grpc.ServerCredentials.createInsecure(),
201
- (error, port) => {
202
- if (error) {
203
- console.log(chalk.red(`Error starting gRPC TLS server on port: [${port}], Error: [${error}]`));
204
- } else {
205
- console.log(chalk.green(`Started gRPC TLS server on port: [${port}]`));
206
- }
207
- });
208
- */
209
- }
210
-
211
- exports.getServer = getServer;
@@ -1,334 +0,0 @@
1
- /* eslint @typescript-eslint/no-explicit-any: 0, @typescript-eslint/no-unused-vars: 0 */ // --> OFF
2
- import { InfluxDB, WriteApi, QueryApi, DEFAULT_WriteOptions, WriteOptions } from '@influxdata/influxdb-client'
3
- // Use below for production https mode - needs to be config item
4
- //import { Agent } from 'https'
5
- import { Agent } from 'http'
6
-
7
- import chalk from 'chalk';
8
-
9
- import { goptions } from '@nsshunt/stsconfig'
10
- import { ISTSLogger, JSONObject } from '@nsshunt/stsutils'
11
-
12
- import { InfluxDBManagerBase } from './influxDBManagerBase'
13
- import { InfluxDBManagerService} from './influxDBManagerService'
14
- import { InfluxDBManagerAgent } from './influxDBManagerAgent'
15
- import { InfluxDBManagerLambda } from './influxDBManagerLambda'
16
- import { IInfluxDBManagerOptions } from './../commonTypes'
17
- import { IInstrumentPayload } from '@nsshunt/stsobservability'
18
-
19
- import { TasksAPI, Tasks, Task } from '@influxdata/influxdb-client-apis'
20
-
21
- const _logPrefix = 'InfluxDBManager:'
22
-
23
- export class InfluxDBManager
24
- {
25
- #shuttingDown: boolean = false;
26
-
27
- //#token = process.env.INFLUXDB_TOKEN;
28
- #token = '';
29
- #url = '' // 'http://192.168.14.92:8086'
30
- #org = '' // `my-org`
31
- #bucket = '' // `TestBucket01`
32
- #client: InfluxDB;
33
- #writeClient: WriteApi | null = null;
34
- #queryApi: QueryApi;
35
- #writeDataPointFlushTimeout: NodeJS.Timeout | null = null;
36
- #agent: Agent | null = null;
37
- #influxDBManagerClients: Record<string, InfluxDBManagerBase> = { };
38
- #options: IInfluxDBManagerOptions;
39
-
40
- constructor(logger: ISTSLogger)
41
- {
42
- this.#options = {
43
- token: goptions.influxDB_APIToken,
44
- url: goptions.influxDB_Url,
45
- org: goptions.influxDB_Org,
46
- bucket:goptions.influxDB_Bucket,
47
- agent: {
48
- influxDB_keepAlive: goptions.influxDB_keepAlive,
49
- influxDB_maxSockets: goptions.influxDB_maxSockets,
50
- influxDB_maxTotalSockets: goptions.influxDB_maxTotalSockets,
51
- influxDB_maxFreeSockets: goptions.influxDB_maxFreeSockets,
52
- influxDB_timeout: goptions.influxDB_timeout,
53
- },
54
- logger
55
- };
56
-
57
- this.#token = this.#options.token;
58
- this.#url = this.#options.url;
59
- this.#org = this.#options.org;
60
- this.#bucket = this.#options.bucket;
61
-
62
- if (this.#options.agent) {
63
- this.#agent = new Agent({
64
- keepAlive: this.#options.agent.influxDB_keepAlive,
65
- keepAliveMsecs: 20000, //@@
66
- maxSockets: this.#options.agent.influxDB_maxSockets,
67
- maxTotalSockets: this.#options.agent.influxDB_maxTotalSockets,
68
- maxFreeSockets: this.#options.agent.influxDB_maxFreeSockets,
69
- timeout: this.#options.agent.influxDB_timeout,
70
- //rejectUnauthorized: this.#options.agent.influxDB_rejectUnauthorized, // only for SSL
71
- })
72
-
73
- this.#client = new InfluxDB({
74
- url: this.#url,
75
- token: this.#token,
76
- transportOptions: { agent: this.#agent }
77
- })
78
- } else {
79
- this.#agent = null;
80
-
81
- this.#client = new InfluxDB({
82
- url: this.#url,
83
- token: this.#token
84
- })
85
- }
86
-
87
- this.#BoostrapInfluxDB();
88
-
89
- this.#queryApi = this.#client.getQueryApi(this.#org);
90
-
91
- this.CreateInfluxDBManagerClient('service');
92
- this.CreateInfluxDBManagerClient('agent');
93
- this.CreateInfluxDBManagerClient('lambda');
94
- }
95
-
96
- #LogErrorMessage(message: any) {
97
- this.#options.logger.error(message);
98
- }
99
-
100
- #LogDebugMessage(message: any) {
101
- this.#options.logger.debug(message);
102
- }
103
-
104
- #BoostrapInfluxDB = async(): Promise<void> => {
105
- const tasksAPI = new TasksAPI(this.#client);
106
- const tasks: Tasks = await tasksAPI.getTasks({
107
- org: 'my-org'
108
- });
109
- if (tasks.tasks) {
110
- this.#LogDebugMessage(chalk.cyan(`[InfluxDB Tasks] - Count: [${tasks.tasks.length}]`));
111
- tasks.tasks.forEach((task: Task) => {
112
- this.#LogDebugMessage(chalk.cyan(`-- [ Start Task Definition ]--`));
113
- this.#LogDebugMessage(chalk.green(`${JSON.stringify(task)}`));
114
- this.#LogDebugMessage(chalk.yellow(`authorizationID: [${task.authorizationID}]`));
115
- this.#LogDebugMessage(chalk.cyan(`-- [ End Task Definition ]--`));
116
- });
117
- } else {
118
- this.#LogDebugMessage(chalk.magenta(`[InfluxDB Tasks] - Could not get tasks from the InfluxDB API`));
119
- }
120
- }
121
-
122
- CreateInfluxDBManagerClient(modelType: string) {
123
- switch (modelType) {
124
- case 'service':
125
- this.#influxDBManagerClients[modelType] = new InfluxDBManagerService(this.#options, this.#queryApi);
126
- break;
127
- case 'agent':
128
- this.#influxDBManagerClients[modelType] = new InfluxDBManagerAgent(this.#options, this.#queryApi);
129
- break;
130
- case 'lambda':
131
- this.#influxDBManagerClients[modelType] = new InfluxDBManagerLambda(this.#options, this.#queryApi);
132
- break;
133
- default:
134
- throw new Error(`Model type: [${modelType} not supported.]`);
135
- }
136
- }
137
-
138
- get serviceManager(): InfluxDBManagerService {
139
- return this.#influxDBManagerClients['service'] as InfluxDBManagerService;
140
- }
141
-
142
- get agentManager(): InfluxDBManagerAgent {
143
- return this.#influxDBManagerClients['agent'] as InfluxDBManagerAgent;
144
- }
145
-
146
- get lambdaManager(): InfluxDBManagerLambda {
147
- return this.#influxDBManagerClients['lambda'] as InfluxDBManagerLambda;
148
- }
149
-
150
- Start = async () => {
151
- // perform any setup here
152
- }
153
-
154
- Terminate = async () => {
155
- if (this.#shuttingDown) {
156
- this.#LogDebugMessage(chalk.yellow(`${_logPrefix}Terminate: Terminate already called. Ignoring.`));
157
- } else {
158
- this.#shuttingDown = true;
159
- if (this.#writeClient) {
160
- try {
161
- this.#writeClient.flush();
162
- this.#shuttingDown = true;
163
- if (this.#writeDataPointFlushTimeout) {
164
- clearTimeout(this.#writeDataPointFlushTimeout);
165
- this.#writeDataPointFlushTimeout = null;
166
- }
167
-
168
- if (this.#agent) {
169
- this.#agent?.destroy();
170
- this.#agent = null;
171
- }
172
-
173
- this.#writeClient = null;
174
-
175
- this.#LogDebugMessage(chalk.yellow(`ProducerDisconnect`));
176
- } catch (error) {
177
- this.#LogErrorMessage(chalk.red(`${_logPrefix}#Terminate: Error: [${error}]`));
178
- }
179
- }
180
- }
181
- }
182
-
183
- CreateGlobalCountModel = (stscount: any[]) => {
184
- try {
185
- const results: any = { };
186
- stscount.forEach((o: any) => {
187
- results[o._field] = o._value;
188
- });
189
- return results;
190
- } catch (error) {
191
- this.#LogErrorMessage(chalk.red(`${_logPrefix}#CreateGlobalCountModel: Error: [${error}]`));
192
- }
193
- }
194
-
195
-
196
- CreateNestedObject(combinedResults: JSONObject, keyList: string[]): JSONObject {
197
- let workingObject = combinedResults;
198
- keyList.forEach((key) => {
199
- if (!workingObject[key]) {
200
- workingObject[key] = { };
201
- workingObject = workingObject[key];
202
- }
203
- });
204
- return combinedResults;
205
- }
206
-
207
- get writeClient(): WriteApi {
208
- if (!this.#writeClient) {
209
- /* Defaults from the library as at 12/11/2023
210
- // default RetryDelayStrategyOptions
211
- export const DEFAULT_RetryDelayStrategyOptions = {
212
- retryJitter: 200,
213
- minRetryDelay: 5000,
214
- maxRetryDelay: 125000,
215
- exponentialBase: 5,
216
- randomRetry: true,
217
- }
218
-
219
- // default writeOptions
220
- export const DEFAULT_WriteOptions: WriteOptions = {
221
- batchSize: 1000,
222
- maxBatchBytes: 50_000_000, // default max batch size in the cloud
223
- flushInterval: 60000,
224
- writeFailed: function () {},
225
- writeSuccess: function () {},
226
- writeRetrySkipped: function () {},
227
- maxRetries: 5,
228
- maxRetryTime: 180_000,
229
- maxBufferLines: 32_000,
230
- // a copy of DEFAULT_RetryDelayStrategyOptions, so that DEFAULT_WriteOptions could be tree-shaken
231
- retryJitter: 200,
232
- minRetryDelay: 5000,
233
- maxRetryDelay: 125000,
234
- exponentialBase: 2,
235
- gzipThreshold: 1000,
236
- randomRetry: true,
237
- }
238
- */
239
-
240
- const flushBatchSize = DEFAULT_WriteOptions.batchSize;
241
-
242
- const writeOptions: Partial<WriteOptions> = {
243
- /* the maximum points/lines to send in a single batch to InfluxDB server */
244
- batchSize: flushBatchSize + 1, // don't let automatically flush data
245
- /* default tags to add to every point */
246
- //defaultTags: {location: hostname},
247
- /* maximum time in millis to keep points in an unflushed batch, 0 means don't periodically flush */
248
- flushInterval: 0,
249
- // max size of a batch in bytes
250
- maxBatchBytes: 50_000_000, // default max batch size in the cloud
251
-
252
- // Retry Options
253
-
254
- /* maximum size of the retry buffer - it contains items that could not be sent for the first time */
255
- maxBufferLines: 30000,
256
- /* the count of internally-scheduled retries upon write failure, the delays between write attempts follow an exponential backoff strategy if there is no Retry-After HTTP header */
257
- maxRetries: 5, // do not retry writes
258
- // max time (millis) that can be spent with retries
259
- maxRetryTime: 180_000,
260
-
261
- // ... there are more write options that can be customized, see
262
- // https://influxdata.github.io/influxdb-client-js/influxdb-client.writeoptions.html and
263
- // https://influxdata.github.io/influxdb-client-js/influxdb-client.writeretryoptions.html
264
- writeFailed: (error, lines, attempt, expires) => {
265
- this.#LogDebugMessage(chalk.red(`writeOptions:writeSuccess(): Error: [${error}], Attempt: [${attempt}], Expires: [${expires}], Lines: [${lines}]`));
266
- },
267
- writeSuccess: (lines) => {
268
- // Needs option
269
- //@@this.#LogDebugMessage(chalk.green(`writeOptions:writeSuccess(): Lines: [${lines}]`));
270
- },
271
- writeRetrySkipped: (entry) => {
272
- this.#LogDebugMessage(chalk.magenta(`writeOptions:writeSuccess(): Expires: [${entry.expires}], Lines: [${entry.lines}]`));
273
- }
274
- }
275
-
276
- this.#writeClient = this.#client.getWriteApi(this.#org, this.#bucket, 'ns', writeOptions);
277
-
278
- let attemptCount = 0;
279
- const maxAttemptCount = 5;
280
- const normalFlushDelay = 1000;
281
- const retryFlushDelay = 2500;
282
-
283
- const StartWriteClient = (delay: number) => {
284
- this.#writeDataPointFlushTimeout = setTimeout(async () => {
285
- if (this.#writeClient) {
286
- try {
287
- attemptCount++;
288
- const start = performance.now();
289
- await this.#writeClient.flush();
290
- const end = performance.now();
291
- // Needs option
292
- //@@this.#LogDebugMessage(chalk.gray(`InfluxDB Flush time: [${end-start}]`));
293
- attemptCount = 0;
294
- StartWriteClient(normalFlushDelay);
295
- } catch (error) {
296
- this.#LogErrorMessage(chalk.red(`InfluxDBManager:StartWriteClient(): Attempt: [${attemptCount}], Error: [${error}]`));
297
- if (attemptCount === maxAttemptCount) {
298
- this.#LogErrorMessage(chalk.red(`InfluxDBManager:StartWriteClient(): Max Attempts reached. Will no longer retry.`));
299
- this.#LogErrorMessage(chalk.red(`InfluxDBManager:StartWriteClient(): InfluxDB data capture ended in permanent faiilure.`));
300
- } else {
301
- StartWriteClient(retryFlushDelay);
302
- }
303
- }
304
- }
305
- }, delay).unref();
306
- }
307
-
308
- StartWriteClient(normalFlushDelay);
309
- }
310
- return this.#writeClient;
311
- }
312
-
313
- // Agent context payload
314
- // {"nid":"somehost@e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent|MainProcess|0","id":"somehost@e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent|MainProcess|0","hostName":"somehost","agentName":"e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent","threadId":"MainProcess","asyncRunnerId":"0"}
315
- async OutputInfluxDB(instrumentPayload: IInstrumentPayload): Promise<boolean> {
316
- try {
317
- if (this.#shuttingDown) {
318
- return false;
319
- }
320
-
321
- //@@ Below is terrible - need a specific field on context for the service type
322
- if (instrumentPayload.context.agentName) {
323
- return this.#influxDBManagerClients['agent'].OutputInfluxDB(this.writeClient, instrumentPayload, 'agent');
324
- } else if (instrumentPayload.context.lambdaFunctionName) {
325
- return this.#influxDBManagerClients['lambda'].OutputInfluxDB(this.writeClient, instrumentPayload, 'lambda');
326
- } else {
327
- return this.#influxDBManagerClients['service'].OutputInfluxDB(this.writeClient, instrumentPayload, 'service');
328
- }
329
- } catch (error) {
330
- this.#LogErrorMessage(chalk.red(`${_logPrefix}OutputInfluxDB: Could not write data point: [${error}]`));
331
- return false;
332
- }
333
- }
334
- }
@@ -1,14 +0,0 @@
1
- import { QueryApi } from '@influxdata/influxdb-client'
2
- import { InfluxDBManagerBase } from './influxDBManagerBase'
3
- import { IInfluxDBManagerOptions } from './../commonTypes'
4
-
5
- export class InfluxDBManagerAgent extends InfluxDBManagerBase
6
- {
7
- constructor(options: IInfluxDBManagerOptions, queryApi: QueryApi) {
8
- super(options, queryApi);
9
- }
10
-
11
- override get modelType(): string {
12
- return 'agent'
13
- }
14
- }
@@ -1,108 +0,0 @@
1
- /* eslint @typescript-eslint/no-explicit-any: 0, @typescript-eslint/no-unused-vars: 0 */ // --> OFF
2
- // https://www.influxdata.com/blog/tldr-influxdb-tech-tips-multiple-aggregations-yield-flux/
3
- // https://www.influxdata.com/blog/top-5-hurdles-for-intermediate-flux-users-and-resources-for-optimizing-flux/
4
- import { Point, WriteApi, QueryApi } from '@influxdata/influxdb-client'
5
-
6
- import { IInfluxDBManagerOptions } from './../commonTypes'
7
- import { IInstrumentPayload } from '@nsshunt/stsobservability'
8
-
9
- import chalk from 'chalk';
10
-
11
- import { globalServiceDefinitions, IServiceDefinition, IFieldRecord, influxDBDataType } from '@nsshunt/stsobservability'
12
-
13
- const _logPrefix = 'InfluxDBManager:'
14
-
15
- export class InfluxDBManagerBase
16
- {
17
- #queryApi: QueryApi;
18
- #shuttingDown: boolean = false;
19
- #options: IInfluxDBManagerOptions;
20
-
21
- constructor(options: IInfluxDBManagerOptions, queryApi: QueryApi) {
22
- this.#queryApi = queryApi;
23
- this.#options = options;
24
- }
25
-
26
- #LogErrorMessage(message: any) {
27
- this.options.logger.error(message);
28
- }
29
-
30
- get options() {
31
- return this.#options;
32
- }
33
- get queryApi() {
34
- return this.#queryApi;
35
- }
36
-
37
- get shuttingDown() {
38
- return this.#shuttingDown;
39
- }
40
- set shuttingDown(val: boolean) {
41
- this.#shuttingDown = val;
42
- }
43
-
44
- get modelType(): string {
45
- throw new Error('modelType(): Must override in sub-class')
46
- }
47
-
48
- // Agent context payload
49
- // {"nid":"somehost@e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent|MainProcess|0","id":"somehost@e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent|MainProcess|0","hostName":"somehost","agentName":"e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent","threadId":"MainProcess","asyncRunnerId":"0"}
50
- async OutputInfluxDB(writeApi: WriteApi, instrumentPayload: IInstrumentPayload, serviceType: string): Promise<boolean> {
51
- if (writeApi) {
52
- let fieldName = '';
53
- try {
54
- if (this.shuttingDown) {
55
- return false;
56
- }
57
-
58
- const service: IServiceDefinition = globalServiceDefinitions.services[serviceType];
59
- const fieldList: IFieldRecord[] = [
60
- ...globalServiceDefinitions.coreFieldList,
61
- ...service.fieldList
62
- ];
63
-
64
- const point = new Point('all').measurement(serviceType)
65
-
66
- service.influxDBContextTags.forEach(v => {
67
- point.tag(v, instrumentPayload.context[v]);
68
- });
69
-
70
- fieldList.forEach(v => {
71
- let value;
72
- let useDefault = false;
73
- fieldName = v.fieldName;
74
-
75
- if (!Object.prototype.hasOwnProperty.call(instrumentPayload.instruments, v.gauge)) {
76
- useDefault = true;
77
- } else if (!Object.prototype.hasOwnProperty.call(instrumentPayload.instruments[v.gauge], v.instrumentProperty)) {
78
- useDefault = true;
79
- }
80
-
81
- if (useDefault) {
82
- if (v.influxdbDataType.localeCompare(influxDBDataType.floatField) == 0) {
83
- value = 0.0;
84
- } else if (v.influxdbDataType.localeCompare(influxDBDataType.intField) == 0) {
85
- value = 0;
86
- } else {
87
- value = '';
88
- }
89
- } else {
90
- value = (instrumentPayload.instruments[v.gauge] as any)[v.instrumentProperty];
91
- }
92
- point[v.influxdbDataType](v.fieldName, value);
93
- });
94
-
95
- writeApi.writePoint(point);
96
-
97
- return true;
98
- } catch (error: any) {
99
- this.#LogErrorMessage(chalk.red(`${_logPrefix}OutputInfluxDB: Could not write data point: [${error}], FieldName: [${fieldName}]`));
100
- this.#LogErrorMessage(chalk.red(`${JSON.stringify(instrumentPayload.context)}`));
101
- return false;
102
- }
103
- } else {
104
- this.#LogErrorMessage(chalk.red(`${_logPrefix}OutputInfluxDBService: Could not write data point as writeClient is null`));
105
- return false;
106
- }
107
- }
108
- }
@@ -1,17 +0,0 @@
1
- import { QueryApi } from '@influxdata/influxdb-client'
2
- import { InfluxDBManagerBase } from './influxDBManagerBase'
3
- import { IInfluxDBManagerOptions } from './../commonTypes'
4
-
5
- /**
6
- * Placeholder class for InfluxDB Lambda queries. May not implement as Redis Stacks is now used as replacement for near real time monitoring.
7
- */
8
- export class InfluxDBManagerLambda extends InfluxDBManagerBase
9
- {
10
- constructor(options: IInfluxDBManagerOptions, queryApi: QueryApi) {
11
- super(options, queryApi);
12
- }
13
-
14
- override get modelType(): string {
15
- return 'lambda'
16
- }
17
- }