@budibase/server 2.4.26 → 2.4.27-alpha.1
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.
- package/builder/assets/{index.9e2f47ef.js → index.2be50fcd.js} +351 -350
- package/builder/assets/{index.b0e3aca6.css → index.68ae453c.css} +2 -2
- package/builder/index.html +2 -2
- package/dist/api/controllers/datasource.js +2 -1
- package/dist/api/controllers/public/metrics.js +113 -0
- package/dist/api/controllers/row/external.js +16 -8
- package/dist/api/controllers/row/index.js +5 -1
- package/dist/api/controllers/row/internal.js +1 -10
- package/dist/api/controllers/row/utils.js +3 -4
- package/dist/api/controllers/table/external.js +16 -12
- package/dist/api/controllers/table/utils.js +15 -1
- package/dist/api/routes/public/index.js +8 -0
- package/dist/api/routes/public/metrics.js +30 -0
- package/dist/constants/index.js +2 -1
- package/dist/integrations/googlesheets.js +125 -59
- package/dist/integrations/utils.js +17 -2
- package/dist/package.json +7 -7
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/specs/openapi.json +39 -0
- package/specs/openapi.yaml +169 -0
- package/specs/resources/application.ts +11 -0
- package/specs/resources/index.ts +2 -0
- package/specs/resources/metrics.ts +81 -0
- package/src/api/controllers/datasource.ts +2 -1
- package/src/api/controllers/public/metrics.ts +251 -0
- package/src/api/controllers/row/external.ts +26 -16
- package/src/api/controllers/row/index.ts +7 -2
- package/src/api/controllers/row/internal.ts +0 -7
- package/src/api/controllers/row/utils.ts +3 -4
- package/src/api/controllers/table/external.ts +24 -17
- package/src/api/controllers/table/index.ts +9 -9
- package/src/api/controllers/table/utils.ts +18 -2
- package/src/api/routes/public/index.ts +10 -1
- package/src/api/routes/public/metrics.ts +28 -0
- package/src/api/routes/public/tests/metrics.spec.js +34 -0
- package/src/constants/index.ts +1 -0
- package/src/definitions/openapi.ts +15 -0
- package/src/integrations/googlesheets.ts +143 -71
- package/src/integrations/utils.ts +16 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.4.
|
|
4
|
+
"version": "2.4.27-alpha.1",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"license": "GPL-3.0",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
46
|
-
"@budibase/backend-core": "
|
|
47
|
-
"@budibase/client": "
|
|
48
|
-
"@budibase/pro": "2.4.
|
|
49
|
-
"@budibase/shared-core": "
|
|
50
|
-
"@budibase/string-templates": "
|
|
51
|
-
"@budibase/types": "
|
|
46
|
+
"@budibase/backend-core": "2.4.27-alpha.1",
|
|
47
|
+
"@budibase/client": "2.4.27-alpha.1",
|
|
48
|
+
"@budibase/pro": "2.4.27-alpha.0",
|
|
49
|
+
"@budibase/shared-core": "2.4.27-alpha.1",
|
|
50
|
+
"@budibase/string-templates": "2.4.27-alpha.1",
|
|
51
|
+
"@budibase/types": "2.4.27-alpha.1",
|
|
52
52
|
"@bull-board/api": "3.7.0",
|
|
53
53
|
"@bull-board/koa": "3.9.4",
|
|
54
54
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -175,5 +175,5 @@
|
|
|
175
175
|
"optionalDependencies": {
|
|
176
176
|
"oracledb": "5.3.0"
|
|
177
177
|
},
|
|
178
|
-
"gitHead": "
|
|
178
|
+
"gitHead": "6427e02e1854db744eacb5c32312f6caba8e3427"
|
|
179
179
|
}
|
package/specs/openapi.json
CHANGED
|
@@ -115,6 +115,15 @@
|
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
+
"deploymentOutput": {
|
|
119
|
+
"value": {
|
|
120
|
+
"data": {
|
|
121
|
+
"_id": "ef12381f934b4f129675cdbb76eff3c2",
|
|
122
|
+
"status": "SUCCESS",
|
|
123
|
+
"appUrl": "/app-url"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
118
127
|
"inputRow": {
|
|
119
128
|
"value": {
|
|
120
129
|
"_id": "ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4",
|
|
@@ -413,6 +422,9 @@
|
|
|
413
422
|
}
|
|
414
423
|
]
|
|
415
424
|
}
|
|
425
|
+
},
|
|
426
|
+
"metrics": {
|
|
427
|
+
"value": "# HELP budibase_os_uptime Time in seconds that the host operating system has been up.\n# TYPE budibase_os_uptime counter\nbudibase_os_uptime 54958\n# HELP budibase_os_free_mem Bytes of memory free for usage on the host operating system.\n# TYPE budibase_os_free_mem gauge\nbudibase_os_free_mem 804507648\n# HELP budibase_os_total_mem Total bytes of memory on the host operating system.\n# TYPE budibase_os_total_mem gauge\nbudibase_os_total_mem 16742404096\n# HELP budibase_os_used_mem Total bytes of memory in use on the host operating system.\n# TYPE budibase_os_used_mem gauge\nbudibase_os_used_mem 15937896448\n# HELP budibase_os_load1 Host operating system load average.\n# TYPE budibase_os_load1 gauge\nbudibase_os_load1 1.91\n# HELP budibase_os_load5 Host operating system load average.\n# TYPE budibase_os_load5 gauge\nbudibase_os_load5 1.75\n# HELP budibase_os_load15 Host operating system load average.\n# TYPE budibase_os_load15 gauge\nbudibase_os_load15 1.56\n# HELP budibase_tenant_user_count The number of users created.\n# TYPE budibase_tenant_user_count gauge\nbudibase_tenant_user_count 1\n# HELP budibase_tenant_app_count The number of apps created by a user.\n# TYPE budibase_tenant_app_count gauge\nbudibase_tenant_app_count 2\n# HELP budibase_tenant_production_app_count The number of apps a user has published.\n# TYPE budibase_tenant_production_app_count gauge\nbudibase_tenant_production_app_count 1\n# HELP budibase_tenant_dev_app_count The number of apps a user has unpublished in development.\n# TYPE budibase_tenant_dev_app_count gauge\nbudibase_tenant_dev_app_count 1\n# HELP budibase_tenant_db_count The number of couchdb databases including global tables such as _users.\n# TYPE budibase_tenant_db_count gauge\nbudibase_tenant_db_count 3\n# HELP budibase_quota_usage_apps The number of apps created.\n# TYPE budibase_quota_usage_apps gauge\nbudibase_quota_usage_apps 1\n# HELP budibase_quota_limit_apps The limit on the number of apps that can be created.\n# TYPE budibase_quota_limit_apps gauge\nbudibase_quota_limit_apps 9007199254740991\n# HELP budibase_quota_usage_rows The number of database rows used from the quota.\n# TYPE budibase_quota_usage_rows gauge\nbudibase_quota_usage_rows 0\n# HELP budibase_quota_limit_rows The limit on the number of rows that can be created.\n# TYPE budibase_quota_limit_rows gauge\nbudibase_quota_limit_rows 9007199254740991\n# HELP budibase_quota_usage_plugins The number of plugins in use.\n# TYPE budibase_quota_usage_plugins gauge\nbudibase_quota_usage_plugins 0\n# HELP budibase_quota_limit_plugins The limit on the number of plugins that can be created.\n# TYPE budibase_quota_limit_plugins gauge\nbudibase_quota_limit_plugins 9007199254740991\n# HELP budibase_quota_usage_user_groups The number of user groups created.\n# TYPE budibase_quota_usage_user_groups gauge\nbudibase_quota_usage_user_groups 0\n# HELP budibase_quota_limit_user_groups The limit on the number of user groups that can be created.\n# TYPE budibase_quota_limit_user_groups gauge\nbudibase_quota_limit_user_groups 9007199254740991\n# HELP budibase_quota_usage_queries The number of queries used in the current month.\n# TYPE budibase_quota_usage_queries gauge\nbudibase_quota_usage_queries 0\n# HELP budibase_quota_limit_queries The limit on the number of queries for the current month.\n# TYPE budibase_quota_limit_queries gauge\nbudibase_quota_limit_queries 9007199254740991\n# HELP budibase_quota_usage_automations The number of automations used in the current month.\n# TYPE budibase_quota_usage_automations gauge\nbudibase_quota_usage_automations 0\n# HELP budibase_quota_limit_automations The limit on the number of automations that can be created.\n# TYPE budibase_quota_limit_automations gauge\nbudibase_quota_limit_automations 9007199254740991\n"
|
|
416
428
|
}
|
|
417
429
|
},
|
|
418
430
|
"securitySchemes": {
|
|
@@ -2054,6 +2066,33 @@
|
|
|
2054
2066
|
}
|
|
2055
2067
|
}
|
|
2056
2068
|
},
|
|
2069
|
+
"/metrics": {
|
|
2070
|
+
"get": {
|
|
2071
|
+
"operationId": "metricsGet",
|
|
2072
|
+
"summary": "Retrieve Budibase tenant metrics",
|
|
2073
|
+
"description": "Output metrics in OpenMetrics format compatible with Prometheus",
|
|
2074
|
+
"tags": [
|
|
2075
|
+
"metrics"
|
|
2076
|
+
],
|
|
2077
|
+
"responses": {
|
|
2078
|
+
"200": {
|
|
2079
|
+
"description": "Returns tenant metrics.",
|
|
2080
|
+
"content": {
|
|
2081
|
+
"text/plain": {
|
|
2082
|
+
"schema": {
|
|
2083
|
+
"type": "string"
|
|
2084
|
+
},
|
|
2085
|
+
"examples": {
|
|
2086
|
+
"metrics": {
|
|
2087
|
+
"$ref": "#/components/examples/metrics"
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
}
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
}
|
|
2095
|
+
},
|
|
2057
2096
|
"/queries/{queryId}": {
|
|
2058
2097
|
"post": {
|
|
2059
2098
|
"operationId": "queryExecute",
|
package/specs/openapi.yaml
CHANGED
|
@@ -85,6 +85,12 @@ components:
|
|
|
85
85
|
updatedAt: 2022-02-22T13:00:54.035Z
|
|
86
86
|
createdAt: 2022-02-11T18:02:26.961Z
|
|
87
87
|
status: development
|
|
88
|
+
deploymentOutput:
|
|
89
|
+
value:
|
|
90
|
+
data:
|
|
91
|
+
_id: ef12381f934b4f129675cdbb76eff3c2
|
|
92
|
+
status: SUCCESS
|
|
93
|
+
appUrl: /app-url
|
|
88
94
|
inputRow:
|
|
89
95
|
value:
|
|
90
96
|
_id: ro_ta_5b1649e42a5b41dea4ef7742a36a7a70_e6dc7e38cf1343b2b56760265201cda4
|
|
@@ -290,6 +296,152 @@ components:
|
|
|
290
296
|
name: Admin
|
|
291
297
|
permissionId: admin
|
|
292
298
|
inherits: POWER
|
|
299
|
+
metrics:
|
|
300
|
+
value: >
|
|
301
|
+
# HELP budibase_os_uptime Time in seconds that the host operating system
|
|
302
|
+
has been up.
|
|
303
|
+
|
|
304
|
+
# TYPE budibase_os_uptime counter
|
|
305
|
+
|
|
306
|
+
budibase_os_uptime 54958
|
|
307
|
+
|
|
308
|
+
# HELP budibase_os_free_mem Bytes of memory free for usage on the host operating system.
|
|
309
|
+
|
|
310
|
+
# TYPE budibase_os_free_mem gauge
|
|
311
|
+
|
|
312
|
+
budibase_os_free_mem 804507648
|
|
313
|
+
|
|
314
|
+
# HELP budibase_os_total_mem Total bytes of memory on the host operating system.
|
|
315
|
+
|
|
316
|
+
# TYPE budibase_os_total_mem gauge
|
|
317
|
+
|
|
318
|
+
budibase_os_total_mem 16742404096
|
|
319
|
+
|
|
320
|
+
# HELP budibase_os_used_mem Total bytes of memory in use on the host operating system.
|
|
321
|
+
|
|
322
|
+
# TYPE budibase_os_used_mem gauge
|
|
323
|
+
|
|
324
|
+
budibase_os_used_mem 15937896448
|
|
325
|
+
|
|
326
|
+
# HELP budibase_os_load1 Host operating system load average.
|
|
327
|
+
|
|
328
|
+
# TYPE budibase_os_load1 gauge
|
|
329
|
+
|
|
330
|
+
budibase_os_load1 1.91
|
|
331
|
+
|
|
332
|
+
# HELP budibase_os_load5 Host operating system load average.
|
|
333
|
+
|
|
334
|
+
# TYPE budibase_os_load5 gauge
|
|
335
|
+
|
|
336
|
+
budibase_os_load5 1.75
|
|
337
|
+
|
|
338
|
+
# HELP budibase_os_load15 Host operating system load average.
|
|
339
|
+
|
|
340
|
+
# TYPE budibase_os_load15 gauge
|
|
341
|
+
|
|
342
|
+
budibase_os_load15 1.56
|
|
343
|
+
|
|
344
|
+
# HELP budibase_tenant_user_count The number of users created.
|
|
345
|
+
|
|
346
|
+
# TYPE budibase_tenant_user_count gauge
|
|
347
|
+
|
|
348
|
+
budibase_tenant_user_count 1
|
|
349
|
+
|
|
350
|
+
# HELP budibase_tenant_app_count The number of apps created by a user.
|
|
351
|
+
|
|
352
|
+
# TYPE budibase_tenant_app_count gauge
|
|
353
|
+
|
|
354
|
+
budibase_tenant_app_count 2
|
|
355
|
+
|
|
356
|
+
# HELP budibase_tenant_production_app_count The number of apps a user has published.
|
|
357
|
+
|
|
358
|
+
# TYPE budibase_tenant_production_app_count gauge
|
|
359
|
+
|
|
360
|
+
budibase_tenant_production_app_count 1
|
|
361
|
+
|
|
362
|
+
# HELP budibase_tenant_dev_app_count The number of apps a user has unpublished in development.
|
|
363
|
+
|
|
364
|
+
# TYPE budibase_tenant_dev_app_count gauge
|
|
365
|
+
|
|
366
|
+
budibase_tenant_dev_app_count 1
|
|
367
|
+
|
|
368
|
+
# HELP budibase_tenant_db_count The number of couchdb databases including global tables such as _users.
|
|
369
|
+
|
|
370
|
+
# TYPE budibase_tenant_db_count gauge
|
|
371
|
+
|
|
372
|
+
budibase_tenant_db_count 3
|
|
373
|
+
|
|
374
|
+
# HELP budibase_quota_usage_apps The number of apps created.
|
|
375
|
+
|
|
376
|
+
# TYPE budibase_quota_usage_apps gauge
|
|
377
|
+
|
|
378
|
+
budibase_quota_usage_apps 1
|
|
379
|
+
|
|
380
|
+
# HELP budibase_quota_limit_apps The limit on the number of apps that can be created.
|
|
381
|
+
|
|
382
|
+
# TYPE budibase_quota_limit_apps gauge
|
|
383
|
+
|
|
384
|
+
budibase_quota_limit_apps 9007199254740991
|
|
385
|
+
|
|
386
|
+
# HELP budibase_quota_usage_rows The number of database rows used from the quota.
|
|
387
|
+
|
|
388
|
+
# TYPE budibase_quota_usage_rows gauge
|
|
389
|
+
|
|
390
|
+
budibase_quota_usage_rows 0
|
|
391
|
+
|
|
392
|
+
# HELP budibase_quota_limit_rows The limit on the number of rows that can be created.
|
|
393
|
+
|
|
394
|
+
# TYPE budibase_quota_limit_rows gauge
|
|
395
|
+
|
|
396
|
+
budibase_quota_limit_rows 9007199254740991
|
|
397
|
+
|
|
398
|
+
# HELP budibase_quota_usage_plugins The number of plugins in use.
|
|
399
|
+
|
|
400
|
+
# TYPE budibase_quota_usage_plugins gauge
|
|
401
|
+
|
|
402
|
+
budibase_quota_usage_plugins 0
|
|
403
|
+
|
|
404
|
+
# HELP budibase_quota_limit_plugins The limit on the number of plugins that can be created.
|
|
405
|
+
|
|
406
|
+
# TYPE budibase_quota_limit_plugins gauge
|
|
407
|
+
|
|
408
|
+
budibase_quota_limit_plugins 9007199254740991
|
|
409
|
+
|
|
410
|
+
# HELP budibase_quota_usage_user_groups The number of user groups created.
|
|
411
|
+
|
|
412
|
+
# TYPE budibase_quota_usage_user_groups gauge
|
|
413
|
+
|
|
414
|
+
budibase_quota_usage_user_groups 0
|
|
415
|
+
|
|
416
|
+
# HELP budibase_quota_limit_user_groups The limit on the number of user groups that can be created.
|
|
417
|
+
|
|
418
|
+
# TYPE budibase_quota_limit_user_groups gauge
|
|
419
|
+
|
|
420
|
+
budibase_quota_limit_user_groups 9007199254740991
|
|
421
|
+
|
|
422
|
+
# HELP budibase_quota_usage_queries The number of queries used in the current month.
|
|
423
|
+
|
|
424
|
+
# TYPE budibase_quota_usage_queries gauge
|
|
425
|
+
|
|
426
|
+
budibase_quota_usage_queries 0
|
|
427
|
+
|
|
428
|
+
# HELP budibase_quota_limit_queries The limit on the number of queries for the current month.
|
|
429
|
+
|
|
430
|
+
# TYPE budibase_quota_limit_queries gauge
|
|
431
|
+
|
|
432
|
+
budibase_quota_limit_queries 9007199254740991
|
|
433
|
+
|
|
434
|
+
# HELP budibase_quota_usage_automations The number of automations used in the current month.
|
|
435
|
+
|
|
436
|
+
# TYPE budibase_quota_usage_automations gauge
|
|
437
|
+
|
|
438
|
+
budibase_quota_usage_automations 0
|
|
439
|
+
|
|
440
|
+
# HELP budibase_quota_limit_automations The limit on the number of automations that can be created.
|
|
441
|
+
|
|
442
|
+
# TYPE budibase_quota_limit_automations gauge
|
|
443
|
+
|
|
444
|
+
budibase_quota_limit_automations 9007199254740991
|
|
293
445
|
securitySchemes:
|
|
294
446
|
ApiKeyAuth:
|
|
295
447
|
type: apiKey
|
|
@@ -1531,6 +1683,23 @@ paths:
|
|
|
1531
1683
|
examples:
|
|
1532
1684
|
applications:
|
|
1533
1685
|
$ref: "#/components/examples/applications"
|
|
1686
|
+
/metrics:
|
|
1687
|
+
get:
|
|
1688
|
+
operationId: metricsGet
|
|
1689
|
+
summary: Retrieve Budibase tenant metrics
|
|
1690
|
+
description: Output metrics in OpenMetrics format compatible with Prometheus
|
|
1691
|
+
tags:
|
|
1692
|
+
- metrics
|
|
1693
|
+
responses:
|
|
1694
|
+
"200":
|
|
1695
|
+
description: Returns tenant metrics.
|
|
1696
|
+
content:
|
|
1697
|
+
text/plain:
|
|
1698
|
+
schema:
|
|
1699
|
+
type: string
|
|
1700
|
+
examples:
|
|
1701
|
+
metrics:
|
|
1702
|
+
$ref: "#/components/examples/metrics"
|
|
1534
1703
|
"/queries/{queryId}":
|
|
1535
1704
|
post:
|
|
1536
1705
|
operationId: queryExecute
|
|
@@ -15,6 +15,12 @@ const application = {
|
|
|
15
15
|
lockedBy: userResource.getExamples().user.value.user,
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
const deployment = {
|
|
19
|
+
_id: "ef12381f934b4f129675cdbb76eff3c2",
|
|
20
|
+
status: "SUCCESS",
|
|
21
|
+
appUrl: "/app-url",
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
const base = {
|
|
19
25
|
name: {
|
|
20
26
|
description: "The name of the app.",
|
|
@@ -108,6 +114,11 @@ export default new Resource()
|
|
|
108
114
|
data: [application],
|
|
109
115
|
},
|
|
110
116
|
},
|
|
117
|
+
deploymentOutput: {
|
|
118
|
+
value: {
|
|
119
|
+
data: deployment,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
111
122
|
})
|
|
112
123
|
.setSchemas({
|
|
113
124
|
application: applicationSchema,
|
package/specs/resources/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ import row from "./row"
|
|
|
3
3
|
import table from "./table"
|
|
4
4
|
import query from "./query"
|
|
5
5
|
import user from "./user"
|
|
6
|
+
import metrics from "./metrics"
|
|
6
7
|
import misc from "./misc"
|
|
7
8
|
|
|
8
9
|
export const examples = {
|
|
@@ -12,6 +13,7 @@ export const examples = {
|
|
|
12
13
|
...query.getExamples(),
|
|
13
14
|
...user.getExamples(),
|
|
14
15
|
...misc.getExamples(),
|
|
16
|
+
...metrics.getExamples(),
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export const schemas = {
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import Resource from "./utils/Resource"
|
|
2
|
+
|
|
3
|
+
const metricsResponse =
|
|
4
|
+
"# HELP budibase_os_uptime Time in seconds that the host operating system has been up.\n" +
|
|
5
|
+
"# TYPE budibase_os_uptime counter\n" +
|
|
6
|
+
"budibase_os_uptime 54958\n" +
|
|
7
|
+
"# HELP budibase_os_free_mem Bytes of memory free for usage on the host operating system.\n" +
|
|
8
|
+
"# TYPE budibase_os_free_mem gauge\n" +
|
|
9
|
+
"budibase_os_free_mem 804507648\n" +
|
|
10
|
+
"# HELP budibase_os_total_mem Total bytes of memory on the host operating system.\n" +
|
|
11
|
+
"# TYPE budibase_os_total_mem gauge\n" +
|
|
12
|
+
"budibase_os_total_mem 16742404096\n" +
|
|
13
|
+
"# HELP budibase_os_used_mem Total bytes of memory in use on the host operating system.\n" +
|
|
14
|
+
"# TYPE budibase_os_used_mem gauge\n" +
|
|
15
|
+
"budibase_os_used_mem 15937896448\n" +
|
|
16
|
+
"# HELP budibase_os_load1 Host operating system load average.\n" +
|
|
17
|
+
"# TYPE budibase_os_load1 gauge\n" +
|
|
18
|
+
"budibase_os_load1 1.91\n" +
|
|
19
|
+
"# HELP budibase_os_load5 Host operating system load average.\n" +
|
|
20
|
+
"# TYPE budibase_os_load5 gauge\n" +
|
|
21
|
+
"budibase_os_load5 1.75\n" +
|
|
22
|
+
"# HELP budibase_os_load15 Host operating system load average.\n" +
|
|
23
|
+
"# TYPE budibase_os_load15 gauge\n" +
|
|
24
|
+
"budibase_os_load15 1.56\n" +
|
|
25
|
+
"# HELP budibase_tenant_user_count The number of users created.\n" +
|
|
26
|
+
"# TYPE budibase_tenant_user_count gauge\n" +
|
|
27
|
+
"budibase_tenant_user_count 1\n" +
|
|
28
|
+
"# HELP budibase_tenant_app_count The number of apps created by a user.\n" +
|
|
29
|
+
"# TYPE budibase_tenant_app_count gauge\n" +
|
|
30
|
+
"budibase_tenant_app_count 2\n" +
|
|
31
|
+
"# HELP budibase_tenant_production_app_count The number of apps a user has published.\n" +
|
|
32
|
+
"# TYPE budibase_tenant_production_app_count gauge\n" +
|
|
33
|
+
"budibase_tenant_production_app_count 1\n" +
|
|
34
|
+
"# HELP budibase_tenant_dev_app_count The number of apps a user has unpublished in development.\n" +
|
|
35
|
+
"# TYPE budibase_tenant_dev_app_count gauge\n" +
|
|
36
|
+
"budibase_tenant_dev_app_count 1\n" +
|
|
37
|
+
"# HELP budibase_tenant_db_count The number of couchdb databases including global tables such as _users.\n" +
|
|
38
|
+
"# TYPE budibase_tenant_db_count gauge\n" +
|
|
39
|
+
"budibase_tenant_db_count 3\n" +
|
|
40
|
+
"# HELP budibase_quota_usage_apps The number of apps created.\n" +
|
|
41
|
+
"# TYPE budibase_quota_usage_apps gauge\n" +
|
|
42
|
+
"budibase_quota_usage_apps 1\n" +
|
|
43
|
+
"# HELP budibase_quota_limit_apps The limit on the number of apps that can be created.\n" +
|
|
44
|
+
"# TYPE budibase_quota_limit_apps gauge\n" +
|
|
45
|
+
"budibase_quota_limit_apps 9007199254740991\n" +
|
|
46
|
+
"# HELP budibase_quota_usage_rows The number of database rows used from the quota.\n" +
|
|
47
|
+
"# TYPE budibase_quota_usage_rows gauge\n" +
|
|
48
|
+
"budibase_quota_usage_rows 0\n" +
|
|
49
|
+
"# HELP budibase_quota_limit_rows The limit on the number of rows that can be created.\n" +
|
|
50
|
+
"# TYPE budibase_quota_limit_rows gauge\n" +
|
|
51
|
+
"budibase_quota_limit_rows 9007199254740991\n" +
|
|
52
|
+
"# HELP budibase_quota_usage_plugins The number of plugins in use.\n" +
|
|
53
|
+
"# TYPE budibase_quota_usage_plugins gauge\n" +
|
|
54
|
+
"budibase_quota_usage_plugins 0\n" +
|
|
55
|
+
"# HELP budibase_quota_limit_plugins The limit on the number of plugins that can be created.\n" +
|
|
56
|
+
"# TYPE budibase_quota_limit_plugins gauge\n" +
|
|
57
|
+
"budibase_quota_limit_plugins 9007199254740991\n" +
|
|
58
|
+
"# HELP budibase_quota_usage_user_groups The number of user groups created.\n" +
|
|
59
|
+
"# TYPE budibase_quota_usage_user_groups gauge\n" +
|
|
60
|
+
"budibase_quota_usage_user_groups 0\n" +
|
|
61
|
+
"# HELP budibase_quota_limit_user_groups The limit on the number of user groups that can be created.\n" +
|
|
62
|
+
"# TYPE budibase_quota_limit_user_groups gauge\n" +
|
|
63
|
+
"budibase_quota_limit_user_groups 9007199254740991\n" +
|
|
64
|
+
"# HELP budibase_quota_usage_queries The number of queries used in the current month.\n" +
|
|
65
|
+
"# TYPE budibase_quota_usage_queries gauge\n" +
|
|
66
|
+
"budibase_quota_usage_queries 0\n" +
|
|
67
|
+
"# HELP budibase_quota_limit_queries The limit on the number of queries for the current month.\n" +
|
|
68
|
+
"# TYPE budibase_quota_limit_queries gauge\n" +
|
|
69
|
+
"budibase_quota_limit_queries 9007199254740991\n" +
|
|
70
|
+
"# HELP budibase_quota_usage_automations The number of automations used in the current month.\n" +
|
|
71
|
+
"# TYPE budibase_quota_usage_automations gauge\n" +
|
|
72
|
+
"budibase_quota_usage_automations 0\n" +
|
|
73
|
+
"# HELP budibase_quota_limit_automations The limit on the number of automations that can be created.\n" +
|
|
74
|
+
"# TYPE budibase_quota_limit_automations gauge\n" +
|
|
75
|
+
"budibase_quota_limit_automations 9007199254740991\n"
|
|
76
|
+
|
|
77
|
+
export default new Resource().setExamples({
|
|
78
|
+
metrics: {
|
|
79
|
+
value: metricsResponse,
|
|
80
|
+
},
|
|
81
|
+
})
|
|
@@ -84,8 +84,9 @@ export async function buildSchemaFromDb(ctx: UserCtx) {
|
|
|
84
84
|
setDefaultDisplayColumns(datasource)
|
|
85
85
|
const dbResp = await db.put(datasource)
|
|
86
86
|
datasource._rev = dbResp.rev
|
|
87
|
+
const cleanedDatasource = await sdk.datasources.removeSecretSingle(datasource)
|
|
87
88
|
|
|
88
|
-
const response: any = { datasource }
|
|
89
|
+
const response: any = { datasource: cleanedDatasource }
|
|
89
90
|
if (error) {
|
|
90
91
|
response.error = error
|
|
91
92
|
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Ctx } from "@budibase/types"
|
|
2
|
+
import { users as userCore, db as dbCore } from "@budibase/backend-core"
|
|
3
|
+
import { quotas, licensing } from "@budibase/pro"
|
|
4
|
+
|
|
5
|
+
import os from "os"
|
|
6
|
+
|
|
7
|
+
export async function fetch(ctx: Ctx) {
|
|
8
|
+
// *** OPERATING SYSTEM ***
|
|
9
|
+
const freeMem = os.freemem()
|
|
10
|
+
const totalMem = os.totalmem()
|
|
11
|
+
const usedMem = totalMem - freeMem
|
|
12
|
+
const uptime = os.uptime()
|
|
13
|
+
|
|
14
|
+
// *** APPS ***
|
|
15
|
+
const allDatabases = await dbCore.getAllDbs()
|
|
16
|
+
const devAppIDs = await dbCore.getDevAppIDs()
|
|
17
|
+
const prodAppIDs = await dbCore.getProdAppIDs()
|
|
18
|
+
const allAppIds = await dbCore.getAllApps({ idsOnly: true })
|
|
19
|
+
|
|
20
|
+
// *** USERS ***
|
|
21
|
+
const usersObject = await userCore.getAllUserIds()
|
|
22
|
+
|
|
23
|
+
// *** QUOTAS ***
|
|
24
|
+
const usage = await quotas.getQuotaUsage()
|
|
25
|
+
const license = await licensing.cache.getCachedLicense()
|
|
26
|
+
const appsQuotaUsage = usage.usageQuota.apps
|
|
27
|
+
const rowsQuotaUsage = usage.usageQuota.rows
|
|
28
|
+
const pluginsQuotaUsage = usage.usageQuota.plugins
|
|
29
|
+
const userGroupsQuotaUsage = usage.usageQuota.userGroups
|
|
30
|
+
const queryQuotaUsage = usage.monthly.current.queries
|
|
31
|
+
const automationsQuotaUsage = usage.monthly.current.automations
|
|
32
|
+
const appsQuotaLimit = license.quotas.usage.static.apps.value
|
|
33
|
+
const rowsQuotaLimit = license.quotas.usage.static.rows.value
|
|
34
|
+
const userGroupsQuotaLimit = license.quotas.usage.static.userGroups.value
|
|
35
|
+
const pluginsQuotaLimit = license.quotas.usage.static.plugins.value
|
|
36
|
+
const queryQuotaLimit = license.quotas.usage.monthly.queries.value
|
|
37
|
+
const automationsQuotaLimit = license.quotas.usage.monthly.automations.value
|
|
38
|
+
|
|
39
|
+
// *** BUILD THE OUTPUT STRING ***
|
|
40
|
+
var outputString = ""
|
|
41
|
+
|
|
42
|
+
// **** budibase_os_uptime ****
|
|
43
|
+
outputString += convertToOpenMetrics(
|
|
44
|
+
"budibase_os_uptime",
|
|
45
|
+
"Time in seconds that the host operating system has been up",
|
|
46
|
+
"counter",
|
|
47
|
+
uptime
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
// **** budibase_os_free_mem ****
|
|
51
|
+
outputString += convertToOpenMetrics(
|
|
52
|
+
"budibase_os_free_mem",
|
|
53
|
+
"Bytes of memory free for usage on the host operating system",
|
|
54
|
+
"gauge",
|
|
55
|
+
freeMem
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
// **** budibase_os_total_mem ****
|
|
59
|
+
outputString += convertToOpenMetrics(
|
|
60
|
+
"budibase_os_total_mem",
|
|
61
|
+
"Total bytes of memory on the host operating system",
|
|
62
|
+
"gauge",
|
|
63
|
+
totalMem
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
// **** budibase_os_used_mem ****
|
|
67
|
+
outputString += convertToOpenMetrics(
|
|
68
|
+
"budibase_os_used_mem",
|
|
69
|
+
"Total bytes of memory in use on the host operating system",
|
|
70
|
+
"gauge",
|
|
71
|
+
usedMem
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
// **** budibase_os_load1 ****
|
|
75
|
+
outputString += convertToOpenMetrics(
|
|
76
|
+
"budibase_os_load1",
|
|
77
|
+
"Host operating system load average",
|
|
78
|
+
"gauge",
|
|
79
|
+
os.loadavg()[0]
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
// **** budibase_os_load5 ****
|
|
83
|
+
outputString += convertToOpenMetrics(
|
|
84
|
+
"budibase_os_load5",
|
|
85
|
+
"Host operating system load average",
|
|
86
|
+
"gauge",
|
|
87
|
+
os.loadavg()[1]
|
|
88
|
+
)
|
|
89
|
+
// **** budibase_os_load15 ****
|
|
90
|
+
outputString += convertToOpenMetrics(
|
|
91
|
+
"budibase_os_load15",
|
|
92
|
+
"Host operating system load average",
|
|
93
|
+
"gauge",
|
|
94
|
+
os.loadavg()[2]
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
// **** budibase_tenant_user_count ****
|
|
98
|
+
outputString += convertToOpenMetrics(
|
|
99
|
+
"budibase_tenant_user_count",
|
|
100
|
+
"The number of users created",
|
|
101
|
+
"gauge",
|
|
102
|
+
usersObject.length
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
// **** budibase_tenant_app_count ****
|
|
106
|
+
outputString += convertToOpenMetrics(
|
|
107
|
+
"budibase_tenant_app_count",
|
|
108
|
+
"The number of apps created by a user",
|
|
109
|
+
"gauge",
|
|
110
|
+
allAppIds.length
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
// **** budibase_tenant_production_app_count ****
|
|
114
|
+
outputString += convertToOpenMetrics(
|
|
115
|
+
"budibase_tenant_production_app_count",
|
|
116
|
+
"The number of apps a user has published",
|
|
117
|
+
"gauge",
|
|
118
|
+
prodAppIDs.length
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
// **** budibase_tenant_dev_app_count ****
|
|
122
|
+
outputString += convertToOpenMetrics(
|
|
123
|
+
"budibase_tenant_dev_app_count",
|
|
124
|
+
"The number of apps a user has unpublished in development",
|
|
125
|
+
"gauge",
|
|
126
|
+
devAppIDs.length
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
// **** budibase_tenant_db_count ****
|
|
130
|
+
outputString += convertToOpenMetrics(
|
|
131
|
+
"budibase_tenant_db_count",
|
|
132
|
+
"The number of couchdb databases including global tables such as _users",
|
|
133
|
+
"gauge",
|
|
134
|
+
allDatabases.length
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
// **** budibase_quota_usage_apps ****
|
|
138
|
+
outputString += convertToOpenMetrics(
|
|
139
|
+
"budibase_quota_usage_apps",
|
|
140
|
+
"The number of apps created",
|
|
141
|
+
"gauge",
|
|
142
|
+
appsQuotaUsage
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
// **** budibase_quota_limit_apps ****
|
|
146
|
+
outputString += convertToOpenMetrics(
|
|
147
|
+
"budibase_quota_limit_apps",
|
|
148
|
+
"The limit on the number of apps that can be created",
|
|
149
|
+
"gauge",
|
|
150
|
+
appsQuotaLimit == -1 ? Number.MAX_SAFE_INTEGER : appsQuotaLimit
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
// **** budibase_quota_usage_rows ****
|
|
154
|
+
outputString += convertToOpenMetrics(
|
|
155
|
+
"budibase_quota_usage_rows",
|
|
156
|
+
"The number of database rows used from the quota",
|
|
157
|
+
"gauge",
|
|
158
|
+
rowsQuotaUsage
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
// **** budibase_quota_limit_rows ****
|
|
162
|
+
outputString += convertToOpenMetrics(
|
|
163
|
+
"budibase_quota_limit_rows",
|
|
164
|
+
"The limit on the number of rows that can be created",
|
|
165
|
+
"gauge",
|
|
166
|
+
rowsQuotaLimit == -1 ? Number.MAX_SAFE_INTEGER : rowsQuotaLimit
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
// **** budibase_quota_usage_plugins ****
|
|
170
|
+
outputString += convertToOpenMetrics(
|
|
171
|
+
"budibase_quota_usage_plugins",
|
|
172
|
+
"The number of plugins in use",
|
|
173
|
+
"gauge",
|
|
174
|
+
pluginsQuotaUsage
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
// **** budibase_quota_limit_plugins ****
|
|
178
|
+
outputString += convertToOpenMetrics(
|
|
179
|
+
"budibase_quota_limit_plugins",
|
|
180
|
+
"The limit on the number of plugins that can be created",
|
|
181
|
+
"gauge",
|
|
182
|
+
pluginsQuotaLimit == -1 ? Number.MAX_SAFE_INTEGER : pluginsQuotaLimit
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
// **** budibase_quota_usage_user_groups ****
|
|
186
|
+
outputString += convertToOpenMetrics(
|
|
187
|
+
"budibase_quota_usage_user_groups",
|
|
188
|
+
"The number of user groups created",
|
|
189
|
+
"gauge",
|
|
190
|
+
userGroupsQuotaUsage
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
// **** budibase_quota_limit_user_groups ****
|
|
194
|
+
outputString += convertToOpenMetrics(
|
|
195
|
+
"budibase_quota_limit_user_groups",
|
|
196
|
+
"The limit on the number of user groups that can be created",
|
|
197
|
+
"gauge",
|
|
198
|
+
userGroupsQuotaLimit == -1 ? Number.MAX_SAFE_INTEGER : userGroupsQuotaLimit
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
// **** budibase_quota_usage_queries ****
|
|
202
|
+
outputString += convertToOpenMetrics(
|
|
203
|
+
"budibase_quota_usage_queries",
|
|
204
|
+
"The number of queries used in the current month",
|
|
205
|
+
"gauge",
|
|
206
|
+
queryQuotaUsage
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
// **** budibase_quota_limit_queries ****
|
|
210
|
+
outputString += convertToOpenMetrics(
|
|
211
|
+
"budibase_quota_limit_queries",
|
|
212
|
+
"The limit on the number of queries for the current month",
|
|
213
|
+
"gauge",
|
|
214
|
+
queryQuotaLimit == -1 ? Number.MAX_SAFE_INTEGER : queryQuotaLimit
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
// **** budibase_quota_usage_automations ****
|
|
218
|
+
outputString += convertToOpenMetrics(
|
|
219
|
+
"budibase_quota_usage_automations",
|
|
220
|
+
"The number of automations used in the current month",
|
|
221
|
+
"gauge",
|
|
222
|
+
automationsQuotaUsage
|
|
223
|
+
)
|
|
224
|
+
|
|
225
|
+
// **** budibase_quota_limit_automations ****
|
|
226
|
+
outputString += convertToOpenMetrics(
|
|
227
|
+
"budibase_quota_limit_automations",
|
|
228
|
+
"The limit on the number of automations that can be created",
|
|
229
|
+
"gauge",
|
|
230
|
+
automationsQuotaLimit == -1
|
|
231
|
+
? Number.MAX_SAFE_INTEGER
|
|
232
|
+
: automationsQuotaLimit
|
|
233
|
+
)
|
|
234
|
+
ctx.body = outputString
|
|
235
|
+
ctx.set("Content-Type", "text/plain")
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export function convertToOpenMetrics(
|
|
239
|
+
metricName: string,
|
|
240
|
+
metricHelp: string,
|
|
241
|
+
metricType: string,
|
|
242
|
+
metricValue: number
|
|
243
|
+
) {
|
|
244
|
+
return `# HELP ${metricName} ${metricHelp}.
|
|
245
|
+
# TYPE ${metricName} ${metricType}
|
|
246
|
+
${metricName} ${metricValue}\n`
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export default {
|
|
250
|
+
fetch,
|
|
251
|
+
}
|