@nsshunt/stsappframework 3.1.45 → 3.1.47

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 (36) hide show
  1. package/dist/globalServiceDefinitions.js +229 -0
  2. package/dist/globalServiceDefinitions.js.map +1 -0
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/influxdb/influxDBManager.js +10 -7
  6. package/dist/influxdb/influxDBManager.js.map +1 -1
  7. package/dist/influxdb/influxDBManagerAgent.js +0 -52
  8. package/dist/influxdb/influxDBManagerAgent.js.map +1 -1
  9. package/dist/influxdb/influxDBManagerBase.js +51 -2
  10. package/dist/influxdb/influxDBManagerBase.js.map +1 -1
  11. package/dist/influxdb/influxDBManagerLambda.js +17 -0
  12. package/dist/influxdb/influxDBManagerLambda.js.map +1 -0
  13. package/dist/influxdb/influxDBManagerService.js +0 -172
  14. package/dist/influxdb/influxDBManagerService.js.map +1 -1
  15. package/package.json +1 -1
  16. package/src/globalServiceDefinitions.ts +289 -0
  17. package/src/index.ts +2 -0
  18. package/src/influxdb/influxDBManager.ts +11 -10
  19. package/src/influxdb/influxDBManagerAgent.ts +0 -51
  20. package/src/influxdb/influxDBManagerBase.ts +51 -3
  21. package/src/influxdb/influxDBManagerLambda.ts +17 -0
  22. package/src/influxdb/influxDBManagerService.ts +3 -69
  23. package/types/globalServiceDefinitions.d.ts +60 -0
  24. package/types/globalServiceDefinitions.d.ts.map +1 -0
  25. package/types/index.d.ts +2 -0
  26. package/types/index.d.ts.map +1 -1
  27. package/types/influxdb/influxDBManager.d.ts +2 -0
  28. package/types/influxdb/influxDBManager.d.ts.map +1 -1
  29. package/types/influxdb/influxDBManagerAgent.d.ts +1 -3
  30. package/types/influxdb/influxDBManagerAgent.d.ts.map +1 -1
  31. package/types/influxdb/influxDBManagerBase.d.ts +1 -1
  32. package/types/influxdb/influxDBManagerBase.d.ts.map +1 -1
  33. package/types/influxdb/influxDBManagerLambda.d.ts +11 -0
  34. package/types/influxdb/influxDBManagerLambda.d.ts.map +1 -0
  35. package/types/influxdb/influxDBManagerService.d.ts +1 -3
  36. package/types/influxdb/influxDBManagerService.d.ts.map +1 -1
@@ -7,115 +7,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.InfluxDBManagerService = void 0;
10
- /*
11
- option task = {
12
- name: "task-sts-service-stats",
13
- every: 1s,
14
- }
15
-
16
- data =
17
- from(bucket: "TestBucket01")
18
- |> range(start: -5s)
19
- |> last()
20
- |> filter(fn: (r) => r["_measurement"] == "service" and r["_field"] != "memory")
21
-
22
- r1 =
23
- data
24
- |> filter(fn: (r) => r["_field"] == "requestCount"
25
- or r["_field"] == "errorCount"
26
- or r["_field"] == "retryCount"
27
- or r["_field"] == "authenticationCount"
28
- or r["_field"] == "authenticationErrorCount"
29
- or r["_field"] == "authenticationRetryCount"
30
- or r["_field"] == "activeRequestCount"
31
- or r["_field"] == "connectionCount"
32
- or r["_field"] == "connectionPoolCount"
33
- or r["_field"] == "connectionIdleCount"
34
- or r["_field"] == "connectionWaitingCount"
35
- or r["_field"] == "coreCount"
36
- or r["_field"] == "cpu"
37
- or r["_field"] == "systemcpu"
38
- or r["_field"] == "velocity"
39
- or r["_field"] == "timer"
40
- or r["_field"] == "rx"
41
- or r["_field"] == "tx")
42
- |> group(columns: ["serviceId", "serviceInstanceId", "serviceInstanceProcessId", "_field"])
43
-
44
- r2 =
45
- data
46
- |> filter(
47
- fn: (r) =>
48
- float(v: r["_value"]) > 0.0 and (r["_field"] == "duration" or r["_field"]
49
- ==
50
- "latency"),
51
- )
52
- |> group(columns: ["serviceId", "serviceInstanceId", "serviceInstanceProcessId", "_field"])
53
-
54
- serviceInstanceProcessSum =
55
- r1
56
- |> sum()
57
- |> toFloat()
58
-
59
- serviceInstanceProcessMean =
60
- r2
61
- |> mean()
62
- |> toFloat()
63
-
64
- union(tables: [serviceInstanceProcessSum, serviceInstanceProcessMean])
65
- |> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-by-serviceinstanceprocess"}))
66
- |> to(org: "my-org", bucket: "TestBucket01")
67
-
68
- serviceInstanceSum =
69
- r1
70
- |> group(columns: ["serviceId", "serviceInstanceId", "_field"])
71
- |> sum()
72
- |> toFloat()
73
-
74
- serviceInstanceMean =
75
- r2
76
- |> group(columns: ["serviceId", "serviceInstanceId", "_field"])
77
- |> mean()
78
- |> toFloat()
79
-
80
- union(tables: [serviceInstanceSum, serviceInstanceMean])
81
- |> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-by-serviceinstance"}))
82
- |> to(org: "my-org", bucket: "TestBucket01")
83
-
84
- serviceSum =
85
- r1
86
- |> group(columns: ["serviceId", "_field"])
87
- |> sum()
88
- |> toFloat()
89
-
90
- serviceMean =
91
- r2
92
- |> group(columns: ["serviceId", "_field"])
93
- |> mean()
94
- |> toFloat()
95
-
96
- union(tables: [serviceSum, serviceMean])
97
- |> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-by-service"}))
98
- |> to(org: "my-org", bucket: "TestBucket01")
99
-
100
- globalServiceSum =
101
- r1
102
- |> group(columns: ["_field"])
103
- |> sum()
104
- |> toFloat()
105
-
106
- globalServiceMean =
107
- r2
108
- |> group(columns: ["_field"])
109
- |> mean()
110
- |> toFloat()
111
-
112
- union(tables: [globalServiceSum, globalServiceMean])
113
- |> map(fn: (r) => ({r with _time: now(), _measurement: "sts-stats-globalservice"}))
114
- |> to(org: "my-org", bucket: "TestBucket01")
115
-
116
- */
117
- const influxdb_client_1 = require("@influxdata/influxdb-client");
118
- const stsinstrumentation_1 = require("@nsshunt/stsinstrumentation");
119
10
  const influxDBManagerBase_1 = require("./influxDBManagerBase");
120
11
  const chalk_1 = __importDefault(require("chalk"));
121
12
  const _logPrefix = 'InfluxDBManagerService:';
@@ -302,69 +193,6 @@ data
302
193
  data: retVal
303
194
  };
304
195
  }
305
- // Write data points ----------------------------------------------------------------------------------------------
306
- // Agent context payload
307
- // {"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"}
308
- async OutputInfluxDB(writeApi, instrumentPayload) {
309
- if (writeApi) {
310
- try {
311
- if (this.shuttingDown) {
312
- return false;
313
- }
314
- const { serviceId, serviceInstanceId, hostName, serviceInstanceProcessId, pid, ppid, serviceName, serviceVersion } = instrumentPayload.context;
315
- let systemcpu = 0.0;
316
- if (instrumentPayload.instruments[stsinstrumentation_1.Gauge.CPU_SYSTEM_LOAD_GAUGE]) {
317
- systemcpu = instrumentPayload.instruments[stsinstrumentation_1.Gauge.CPU_SYSTEM_LOAD_GAUGE].val;
318
- }
319
- const point = new influxdb_client_1.Point('all')
320
- .measurement('service')
321
- // Context settings
322
- .tag('serviceId', serviceId)
323
- .tag('serviceName', serviceName)
324
- .tag('serviceVersion', serviceVersion)
325
- .tag('serviceInstanceId', serviceInstanceId)
326
- .tag('serviceInstanceProcessId', serviceInstanceProcessId)
327
- .tag('hostName', hostName)
328
- .tag('pid', pid.toString())
329
- .tag('ppid', ppid.toString())
330
- // Data fields
331
- .intField('requestCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.REQUEST_COUNT_GAUGE].val)
332
- .intField('errorCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.ERROR_COUNT_GAUGE].val)
333
- .intField('retryCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.RETRY_COUNT_GAUGE].val)
334
- .intField('authenticationCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.AUTHENTICATION_COUNT_GAUGE].val)
335
- .intField('authenticationErrorCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.AUTHENTICATION_ERROR_COUNT_GAUGE].val)
336
- .intField('authenticationRetryCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.AUTHENTICATION_RETRY_COUNT_GAUGE].val)
337
- .floatField('velocity', instrumentPayload.instruments[stsinstrumentation_1.Gauge.VELOCITY_GAUGE].va) // Note: Using va not val here
338
- .floatField('cpu', instrumentPayload.instruments[stsinstrumentation_1.Gauge.CPU_LOAD_GAUGE].val)
339
- .intField('activeRequestCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.ACTIVE_REQUEST_GAUGE].val)
340
- .intField('connectionCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.CONNECTION_COUNT_GAUGE].val)
341
- .intField('connectionPoolCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.CONNECTION_POOL_TOTAL_GAUGE].val)
342
- .intField('connectionIdleCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.CONNECTION_POOL_IDLE_GAUGE].val)
343
- .intField('connectionWaitingCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.CONNECTION_POOL_WAITING_GAUGE].val)
344
- .intField('coreCount', instrumentPayload.instruments[stsinstrumentation_1.Gauge.CORE_COUNT_GAUGE].val)
345
- //.intField('rx', instrumentPayload.instruments[Gauge.NETWORK_RX_GAUGE].val)
346
- //.intField('tx', instrumentPayload.instruments[Gauge.NETWORK_TX_GAUGE].val)
347
- .floatField('rx', instrumentPayload.instruments[stsinstrumentation_1.Gauge.NETWORK_RX_GAUGE].va) // Note: Using va not val here
348
- .floatField('tx', instrumentPayload.instruments[stsinstrumentation_1.Gauge.NETWORK_TX_GAUGE].va) // Note: Using va not val here
349
- .floatField('timer', instrumentPayload.instruments[stsinstrumentation_1.Gauge.TIMER_GAUGE].val)
350
- .floatField('duration', instrumentPayload.instruments[stsinstrumentation_1.Gauge.DURATION_GAUGE].val)
351
- .floatField('latency', instrumentPayload.instruments[stsinstrumentation_1.Gauge.LATENCY_GAUGE].val)
352
- .floatField('systemcpu', systemcpu)
353
- .stringField('memory', JSON.stringify(instrumentPayload.instruments[stsinstrumentation_1.Gauge.OBJECT_GAUGE].val));
354
- writeApi.writePoint(point);
355
- return true;
356
- }
357
- catch (error) {
358
- this.#LogErrorMessage(chalk_1.default.red(`${_logPrefix}OutputInfluxDB: Could not write data point: [${error}]`));
359
- this.#LogErrorMessage(chalk_1.default.red(`${JSON.stringify(instrumentPayload.context)}`));
360
- return false;
361
- }
362
- }
363
- else {
364
- this.#LogErrorMessage(chalk_1.default.red(`${_logPrefix}OutputInfluxDBService: Could not write data point as writeClient is null`));
365
- return false;
366
- }
367
- }
368
196
  }
369
197
  exports.InfluxDBManagerService = InfluxDBManagerService;
370
198
  //# sourceMappingURL=influxDBManagerService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"influxDBManagerService.js","sourceRoot":"","sources":["../../src/influxdb/influxDBManagerService.ts"],"names":[],"mappings":";AAAA,wFAAwF,CAAE,UAAU;AACpG,4FAA4F;AAC5F,+GAA+G;;;;;;AAE/G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0GE;AAEF,iEAAuE;AAEvE,oEAAuE;AAEvE,+DAA2D;AAM3D,kDAA0B;AAG1B,MAAM,UAAU,GAAG,yBAAyB,CAAA;AAE5C;;;;;EAKE;AAEF,MAAM,yCAAyC,GAAG,qCAAqC,CAAC;AACxF,MAAM,iCAAiC,GAAG,8BAA8B,CAAC;AACzE,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AACxD,MAAM,oBAAoB,GAAG,yBAAyB,CAAC;AAEvD,MAAa,sBAAuB,SAAQ,yCAAmB;IAE3D,YAAY,OAAgC,EAAE,QAAkB;QAC5D,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7B,CAAC;IAED,gBAAgB,CAAC,OAAY;QACzB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAA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1
1
  {
2
2
  "name": "@nsshunt/stsappframework",
3
- "version": "3.1.45",
3
+ "version": "3.1.47",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "./types/index.d.ts",
@@ -0,0 +1,289 @@
1
+ import { Gauge } from '@nsshunt/stsinstrumentation'
2
+ import { ISTSLogger } from '@nsshunt/stsutils';
3
+ import { SubscriptionTopic } from '@nsshunt/stssocketio-client'
4
+ import { IContextBase, IServiceProcessContext } from '@nsshunt/stspublisherserver'
5
+
6
+ export type IInstrumentHashMap = Record<string, string>;
7
+
8
+ export interface ITimeSeriesEntry {
9
+ timestamp: number
10
+ value: number
11
+ }
12
+
13
+ export interface IHistoField {
14
+ label: string
15
+ bucketLimit: number
16
+ }
17
+
18
+ export enum influxDBDataType {
19
+ intField = 'intField',
20
+ floatField = 'floatField',
21
+ stringField = 'stringField'
22
+ }
23
+
24
+ export interface IFieldRecord {
25
+ fieldName: string
26
+ gauge: Gauge
27
+ instrumentProperty: string
28
+ dataType: string
29
+ influxdbDataType: influxDBDataType
30
+ timeSeriesIndex?: boolean
31
+ quantile?: boolean // Does this field require a quantile ?
32
+ histo?: IHistoField[]
33
+ }
34
+
35
+ export interface IRedisInstrumentProcessorBaseOptions {
36
+ logger: ISTSLogger
37
+ }
38
+
39
+ //@@ current not used - delete if required ...
40
+ export interface IRedisQueryFilters {
41
+ level1ContextField: string
42
+ level2ContextField: string
43
+ level3ContextField: string
44
+ }
45
+
46
+ export interface IRedisIndexPrefixDefinitions {
47
+ timeSeriesIndex: string
48
+ timeSeriesPrefix: string
49
+ instantIndex: string
50
+ instantPrefix: string
51
+ }
52
+
53
+ export interface IsubscriptionTopic {
54
+ subscriptionTopic: SubscriptionTopic
55
+ route: string,
56
+ }
57
+
58
+ export interface IServiceDefinition {
59
+ influxDBContextTags: string[],
60
+ redisIndexPrefixDefinitions: IRedisIndexPrefixDefinitions
61
+ fieldList: IFieldRecord[] // Specific additional fields (beyond the core fields) that this service supports
62
+ GetPathFromContext: (context: IContextBase) => string
63
+ redisQueryFilters: IRedisQueryFilters
64
+ subscriptionTopics: IsubscriptionTopic[]
65
+ }
66
+
67
+ export interface IGlobalServiceDefinitions {
68
+ coreFieldList: IFieldRecord[] // Set of instruments that are used by all service types
69
+ services: Record<string, IServiceDefinition>;
70
+ }
71
+
72
+ /*
73
+ AllServicesCombined = 'AllServicesCombined',
74
+ Services = 'Services',
75
+ ServiceInstances = 'ServiceInstances',
76
+ ServiceInstance = 'ServiceInstance',
77
+
78
+ // User Agents topics
79
+ AllAgentsCombined = 'AllAgentsCombined',
80
+ Agents = 'Agents',
81
+ AgentWorkers = 'AgentWorkers',
82
+ AgentWorker = 'AgentWorker',
83
+
84
+ // Lambda topics
85
+ AllLambdasCombined = "AllLambdasCombined",
86
+ LambdaTechnologies = "LambdaTechnologies", // e.g. aws was lambdas
87
+ LambdaSubTechnologies = "LambdaSubTechnologies", // e.g. aws_s3, aws_sqs, aws_sns was LambdaInstances
88
+ LambdaSubTechnologiesInstance = "LambdaSubTechnologiesInstance", // (uuidv4()) was ServiceInstance
89
+ */
90
+
91
+ export const globalServiceDefinitions: IGlobalServiceDefinitions = {
92
+ coreFieldList: [
93
+ { fieldName: 'requestCount', gauge: Gauge.REQUEST_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
94
+ { fieldName: 'errorCount', gauge: Gauge.ERROR_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
95
+ { fieldName: 'retryCount', gauge: Gauge.RETRY_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
96
+ { fieldName: 'authenticationCount', gauge: Gauge.AUTHENTICATION_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
97
+ { fieldName: 'authenticationErrorCount', gauge: Gauge.AUTHENTICATION_ERROR_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
98
+ { fieldName: 'authenticationRetryCount', gauge: Gauge.AUTHENTICATION_RETRY_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
99
+ { fieldName: 'velocity', gauge: Gauge.VELOCITY_GAUGE, instrumentProperty: 'va', dataType: 'number', influxdbDataType: influxDBDataType.floatField },
100
+ { fieldName: 'activeRequestCount', gauge: Gauge.ACTIVE_REQUEST_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.intField },
101
+ { fieldName: 'coreCount', gauge: Gauge.CORE_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
102
+ { fieldName: 'rx', gauge: Gauge.NETWORK_RX_GAUGE, instrumentProperty: 'va', dataType: 'number', influxdbDataType: influxDBDataType.floatField },
103
+ { fieldName: 'tx', gauge: Gauge.NETWORK_TX_GAUGE, instrumentProperty: 'va', dataType: 'number', influxdbDataType: influxDBDataType.floatField },
104
+ { fieldName: 'timer', gauge: Gauge.TIMER_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.floatField },
105
+ { fieldName: 'duration', gauge: Gauge.DURATION_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.floatField,
106
+ histo: [
107
+ { label: 'B10', bucketLimit: 10 },
108
+ { label: 'B20', bucketLimit: 20 },
109
+ { label: 'B50', bucketLimit: 50 },
110
+ { label: 'B100', bucketLimit: 100 },
111
+ { label: 'B1000', bucketLimit: 1000 },
112
+ { label: 'B50000', bucketLimit: 50000 },
113
+ { label: 'BInfinity', bucketLimit: -1 }
114
+ ] },
115
+ { fieldName: 'latency', gauge: Gauge.LATENCY_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.floatField,
116
+ histo: [
117
+ { label: 'B10', bucketLimit: 10 },
118
+ { label: 'B20', bucketLimit: 20 },
119
+ { label: 'B50', bucketLimit: 50 },
120
+ { label: 'B100', bucketLimit: 100 },
121
+ { label: 'B1000', bucketLimit: 1000 },
122
+ { label: 'B50000', bucketLimit: 50000 },
123
+ { label: 'BInfinity', bucketLimit: -1 }
124
+ ] }
125
+ ],
126
+ services: {
127
+ ['service']: {
128
+ influxDBContextTags: [
129
+ 'serviceId',
130
+ 'serviceName',
131
+ 'serviceVersion',
132
+ 'serviceInstanceId',
133
+ 'serviceInstanceProcessId',
134
+ 'hostName',
135
+ 'pid',
136
+ 'ppid'
137
+ ],
138
+ redisIndexPrefixDefinitions: {
139
+ timeSeriesIndex: 'idx:serviceIndexTimeSeries',
140
+ timeSeriesPrefix: '/serviceTimeSeries:',
141
+ instantIndex: 'idx:serviceIndexInstant',
142
+ instantPrefix: '/serviceInstant:'
143
+ },
144
+ fieldList: [
145
+ { fieldName: 'cpu', gauge: Gauge.CPU_LOAD_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.floatField },
146
+ { fieldName: 'connectionCount', gauge: Gauge.CONNECTION_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.intField },
147
+ { fieldName: 'connectionPoolCount', gauge: Gauge.CONNECTION_POOL_TOTAL_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
148
+ { fieldName: 'connectionIdleCount', gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
149
+ { fieldName: 'connectionWaitingCount', gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
150
+ { fieldName: 'systemcpu', gauge: Gauge.CPU_SYSTEM_LOAD_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.floatField },
151
+ { fieldName: 'memory', gauge: Gauge.OBJECT_GAUGE, instrumentProperty: 'val', dataType: 'JSON', influxdbDataType: influxDBDataType.stringField }
152
+ ],
153
+ GetPathFromContext(context: IServiceProcessContext): string {
154
+ //const { serviceId, serviceInstanceId, hostName, serviceInstanceProcessId,
155
+ //pid, ppid, serviceName, serviceVersion } = instrumentPayload.context;
156
+ const { serviceId, serviceInstanceId, serviceInstanceProcessId } = context;
157
+ return `/${serviceId}/${serviceInstanceId}/${serviceInstanceProcessId}`; //@@ these should line up with the query filer names
158
+ },
159
+ redisQueryFilters: {
160
+ level1ContextField: 'serviceType',
161
+ level2ContextField: 'appid',
162
+ level3ContextField: 'appinstanceid'
163
+ },
164
+ subscriptionTopics: [
165
+ {
166
+ subscriptionTopic: SubscriptionTopic.AllServicesCombined,
167
+ route: '/metrics'
168
+ },
169
+ {
170
+ subscriptionTopic: SubscriptionTopic.Services,
171
+ route: '/metrics/services'
172
+ },
173
+ {
174
+ subscriptionTopic: SubscriptionTopic.ServiceInstances,
175
+ route: '/metrics/services/:key'
176
+ },
177
+ {
178
+ subscriptionTopic: SubscriptionTopic.ServiceInstance,
179
+ route: '/metrics/services/:key/:subkey'
180
+ }
181
+ ]
182
+ },
183
+ ['agent']: {
184
+ influxDBContextTags: [
185
+ 'id',
186
+ 'hostName',
187
+ 'agentName',
188
+ 'threadId',
189
+ 'asyncRunnerId'
190
+ ],
191
+ redisIndexPrefixDefinitions: {
192
+ timeSeriesIndex: 'idx:agentIndexTimeSeries',
193
+ timeSeriesPrefix: '/agentTimeSeries:',
194
+ instantIndex: 'idx:agentIndexInstant',
195
+ instantPrefix: '/agentInstant:'
196
+ },
197
+ fieldList: [
198
+ { fieldName: 'childCount', gauge: Gauge.CHILD_COUNT, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField }
199
+ ],
200
+ //@@ need type declare in appframework ?? agent does not use appframework ... perhaps stspublisher
201
+ GetPathFromContext(context: IContextBase): string {
202
+ //const { nid, id, hostName, agentName, threadId, asyncRunnerId } = context;
203
+ const { agentName, threadId, asyncRunnerId } = context;
204
+ return `/${agentName}/${threadId}/${asyncRunnerId}`; //@@ these should line up with the query filer names
205
+ },
206
+ redisQueryFilters: {
207
+ level1ContextField: 'serviceType',
208
+ level2ContextField: 'appid', //@@ this should be named something else
209
+ level3ContextField: 'appinstanceid' //@@ this should be named something else
210
+ },
211
+ subscriptionTopics: [
212
+ {
213
+ subscriptionTopic: SubscriptionTopic.AllAgentsCombined,
214
+ route: '/metrics'
215
+ },
216
+ {
217
+ subscriptionTopic: SubscriptionTopic.Agents,
218
+ route: '/metrics/agents'
219
+ },
220
+ {
221
+ subscriptionTopic: SubscriptionTopic.AgentWorkers,
222
+ route: '/metrics/agents/:key'
223
+ },
224
+ {
225
+ subscriptionTopic: SubscriptionTopic.AgentWorker,
226
+ route: '/metrics/agents/:key/:subkey'
227
+ }
228
+ ]
229
+ },
230
+ ['lambda']: {
231
+ influxDBContextTags: [
232
+ 'technology',
233
+ 'subTechnology',
234
+ 'lambdaFunctionName',
235
+ 'lambdaInstance',
236
+ 'hostName',
237
+ 'processId',
238
+ 'parentProcessId',
239
+ 'useCase',
240
+ 'pattern'
241
+ ],
242
+ redisIndexPrefixDefinitions: {
243
+ timeSeriesIndex: 'idx:lambdaIndexTimeSeries',
244
+ timeSeriesPrefix: '/lambdaTimeSeries:',
245
+ instantIndex: 'idx:lambdaIndexInstant',
246
+ instantPrefix: '/lambdaInstant:'
247
+ },
248
+ fieldList: [
249
+ { fieldName: 'cpu', gauge: Gauge.CPU_LOAD_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.floatField },
250
+ { fieldName: 'connectionCount', gauge: Gauge.CONNECTION_COUNT_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.intField },
251
+ { fieldName: 'connectionPoolCount', gauge: Gauge.CONNECTION_POOL_TOTAL_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
252
+ { fieldName: 'connectionIdleCount', gauge: Gauge.CONNECTION_POOL_IDLE_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
253
+ { fieldName: 'connectionWaitingCount', gauge: Gauge.CONNECTION_POOL_WAITING_GAUGE, instrumentProperty: 'val', dataType: 'number', influxdbDataType: influxDBDataType.intField },
254
+ { fieldName: 'systemcpu', gauge: Gauge.CPU_SYSTEM_LOAD_GAUGE, instrumentProperty: 'val', dataType: 'number', timeSeriesIndex: true, quantile: true, influxdbDataType: influxDBDataType.floatField },
255
+ { fieldName: 'memory', gauge: Gauge.OBJECT_GAUGE, instrumentProperty: 'val', dataType: 'JSON', influxdbDataType: influxDBDataType.stringField }
256
+ ],
257
+ //@@ need type declare in appframework
258
+ GetPathFromContext(context: IContextBase): string {
259
+ //const { serviceId, serviceInstanceId, hostName, serviceInstanceProcessId,
260
+ //pid, ppid, serviceName, serviceVersion } = instrumentPayload.context;
261
+ const { technology, subTechnology, lambdaInstance } = context;
262
+ return `/${technology}/${subTechnology}/${lambdaInstance}`;
263
+ },
264
+ redisQueryFilters: {
265
+ level1ContextField: 'serviceType',
266
+ level2ContextField: 'technology',
267
+ level3ContextField: 'subTechnology'
268
+ },
269
+ subscriptionTopics: [
270
+ {
271
+ subscriptionTopic: SubscriptionTopic.AllLambdasCombined, // uicontrollerlanding
272
+ route: '/metrics'
273
+ },
274
+ {
275
+ subscriptionTopic: SubscriptionTopic.LambdaTechnologies, // uicontrollerlambda
276
+ route: '/metrics/lambdas'
277
+ },
278
+ {
279
+ subscriptionTopic: SubscriptionTopic.LambdaSubTechnologies, // uicontrollerlambdasubtechnologies
280
+ route: '/metrics/lambdas/:key'
281
+ },
282
+ {
283
+ subscriptionTopic: SubscriptionTopic.LambdaSubTechnologiesInstance, // uicontrollerlambdasubtechnologiesinstance
284
+ route: '/metrics/lambdas/:key/:subkey'
285
+ }
286
+ ]
287
+ }
288
+ }
289
+ }
package/src/index.ts CHANGED
@@ -18,8 +18,10 @@ export * from './influxdb/influxDBManager'
18
18
  export * from './influxdb/influxDBManagerBase'
19
19
  export * from './influxdb/influxDBManagerService'
20
20
  export * from './influxdb/influxDBManagerAgent'
21
+ export * from './influxdb/influxDBManagerLambda'
21
22
  export * from './publishertransports/publishTransportUtils'
22
23
  export * from './publishertransports/publishTransportDirect'
23
24
  export * from './instrumentationsubscriber'
24
25
  export * from './stsTransportWinston'
25
26
  export * from './stsTransportLoggerWinston'
27
+ export * from './globalServiceDefinitions'
@@ -13,6 +13,7 @@ const goptions = $Options()
13
13
  import { InfluxDBManagerBase } from './influxDBManagerBase'
14
14
  import { InfluxDBManagerService} from './influxDBManagerService'
15
15
  import { InfluxDBManagerAgent } from './influxDBManagerAgent'
16
+ import { InfluxDBManagerLambda } from './influxDBManagerLambda'
16
17
  import { IInfluxDBManagerOptions } from './../commonTypes'
17
18
  import { IInstrumentPayload } from '@nsshunt/stspublisherserver'
18
19
 
@@ -318,6 +319,9 @@ export class InfluxDBManager
318
319
  case 'agent':
319
320
  this.#influxDBManagerClients[modelType] = new InfluxDBManagerAgent(this.#options, this.#queryApi);
320
321
  break;
322
+ case 'lambda':
323
+ this.#influxDBManagerClients[modelType] = new InfluxDBManagerLambda(this.#options, this.#queryApi);
324
+ break;
321
325
  default:
322
326
  throw new Error(`Model type: [${modelType} not supported.]`);
323
327
  }
@@ -331,6 +335,10 @@ export class InfluxDBManager
331
335
  return this.#influxDBManagerClients['agent'] as InfluxDBManagerAgent;
332
336
  }
333
337
 
338
+ get lambdaManager(): InfluxDBManagerLambda {
339
+ return this.#influxDBManagerClients['lambda'] as InfluxDBManagerLambda;
340
+ }
341
+
334
342
  Start = async () => {
335
343
  // perform any setup here
336
344
  }
@@ -510,16 +518,11 @@ export class InfluxDBManager
510
518
 
511
519
  //@@ Below is terrible - need a specific field on context for the service type
512
520
  if (instrumentPayload.context.agentName) {
513
- return this.#influxDBManagerClients['agent'].OutputInfluxDB(this.writeClient, instrumentPayload);
521
+ return this.#influxDBManagerClients['agent'].OutputInfluxDB(this.writeClient, instrumentPayload, 'agent');
514
522
  } else if (instrumentPayload.context.lambdaFunctionName) {
515
-
516
- //@@ todo
517
- this.#LogInfoMessage(`TODO: Need to output InfluxDB data for: [${instrumentPayload.context.lambdaFunctionName}], Context: [${JSON.stringify(instrumentPayload.context)}]`);
518
-
519
- return true;
520
-
523
+ return this.#influxDBManagerClients['lambda'].OutputInfluxDB(this.writeClient, instrumentPayload, 'lambda');
521
524
  } else {
522
- return this.#influxDBManagerClients['service'].OutputInfluxDB(this.writeClient, instrumentPayload);
525
+ return this.#influxDBManagerClients['service'].OutputInfluxDB(this.writeClient, instrumentPayload, 'service');
523
526
  }
524
527
  } catch (error) {
525
528
  this.#LogErrorMessage(chalk.red(`${_logPrefix}OutputInfluxDB: Could not write data point: [${error}]`));
@@ -564,8 +567,6 @@ from(bucket: "my-db/")
564
567
 
565
568
 
566
569
 
567
-
568
-
569
570
  from(bucket: "TestBucket01")
570
571
  |> range(start: -5s)
571
572
  |> last()
@@ -278,55 +278,4 @@ export class InfluxDBManagerAgent extends InfluxDBManagerBase
278
278
  data: retVal
279
279
  };
280
280
  }
281
-
282
- // Agent context payload
283
- // {"nid":"somehost@e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent|MainProcess|0","id":"somehost@e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent|MainProcess|0","hostName":"somehost"
284
- // ,"agentName":"e58f5d75-6ff6-4e04-92a4-f2bcd722fec0-someuseragent","threadId":"MainProcess","asyncRunnerId":"0"}
285
- async OutputInfluxDB(writeApi: WriteApi, instrumentPayload: IInstrumentPayload): Promise<boolean> {
286
- if (writeApi) {
287
- try {
288
- const { nid, id, hostName, agentName, threadId, asyncRunnerId } = instrumentPayload.context;
289
-
290
- let systemcpu = 0.0;
291
- if (instrumentPayload.instruments[Gauge.CPU_SYSTEM_LOAD_GAUGE]) {
292
- systemcpu = (instrumentPayload.instruments[Gauge.CPU_SYSTEM_LOAD_GAUGE].val as number);
293
- }
294
-
295
- const point = new Point('all')
296
- .measurement('agent')
297
- // Context settings
298
- .tag('id', id as string) // Must be unique (uuid)
299
- .tag('hostName', hostName as string) // Must be unique (uuid)
300
- .tag('agentName', agentName as string) // Must be unique (uuid)
301
- .tag('threadId', threadId as string) // Must be unique (uuid)
302
- .tag('asyncRunnerId', asyncRunnerId as string)
303
- // Data fields
304
- .intField('requestCount', instrumentPayload.instruments[Gauge.REQUEST_COUNT_GAUGE].val) // q
305
- .intField('errorCount', instrumentPayload.instruments[Gauge.ERROR_COUNT_GAUGE].val) // j
306
- .intField('retryCount', instrumentPayload.instruments[Gauge.RETRY_COUNT_GAUGE].val) // r
307
- .intField('authenticationCount', instrumentPayload.instruments[Gauge.AUTHENTICATION_COUNT_GAUGE].val) // b
308
- .intField('authenticationErrorCount', instrumentPayload.instruments[Gauge.AUTHENTICATION_ERROR_COUNT_GAUGE].val) // aa
309
- .intField('authenticationRetryCount', instrumentPayload.instruments[Gauge.AUTHENTICATION_RETRY_COUNT_GAUGE].val) // ab
310
- .floatField('velocity', (instrumentPayload.instruments[Gauge.VELOCITY_GAUGE] as InstrumentVelocity).va) // t - Note: Using va not val here
311
- .intField('coreCount', instrumentPayload.instruments[Gauge.CORE_COUNT_GAUGE].val) // x
312
- .floatField('rx', (instrumentPayload.instruments[Gauge.NETWORK_RX_GAUGE] as InstrumentVelocity).va) // Note: Using va not val here
313
- .floatField('tx', (instrumentPayload.instruments[Gauge.NETWORK_TX_GAUGE] as InstrumentVelocity).va) // Note: Using va not val here
314
- .floatField('timer', instrumentPayload.instruments[Gauge.TIMER_GAUGE].val) // s
315
- .floatField('duration', instrumentPayload.instruments[Gauge.DURATION_GAUGE].val) // h
316
- .floatField('latency', instrumentPayload.instruments[Gauge.LATENCY_GAUGE].val) // h
317
- .intField('activeRequestCount', instrumentPayload.instruments[Gauge.ACTIVE_REQUEST_GAUGE].val) // a
318
- .intField('childCount', instrumentPayload.instruments[Gauge.CHILD_COUNT].val) // y
319
- // logger // m
320
- // duration histo // i
321
- writeApi.writePoint(point);
322
- return true;
323
- } catch (error: any) {
324
- this.#LogErrorMessage(chalk.red(`${_logPrefix}OutputInfluxDBAgent: Could not write data point: [${error}]`));
325
- return false;
326
- }
327
- } else {
328
- this.#LogErrorMessage(chalk.red(`${_logPrefix}OutputInfluxDBAgent: Could not write data point as writeClient is null`));
329
- return false;
330
- }
331
- }
332
281
  }