@dudousxd/nestjs-telescope-mikro-orm 1.0.0
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/CHANGELOG.md +110 -0
- package/LICENSE +21 -0
- package/README.md +164 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/mikro-orm-query.watcher.d.ts +43 -0
- package/dist/mikro-orm-query.watcher.d.ts.map +1 -0
- package/dist/mikro-orm-query.watcher.js +62 -0
- package/dist/mikro-orm-query.watcher.js.map +1 -0
- package/dist/mikro-orm-storage.provider.d.ts +51 -0
- package/dist/mikro-orm-storage.provider.d.ts.map +1 -0
- package/dist/mikro-orm-storage.provider.js +348 -0
- package/dist/mikro-orm-storage.provider.js.map +1 -0
- package/dist/n-plus-one.d.ts +9 -0
- package/dist/n-plus-one.d.ts.map +1 -0
- package/dist/n-plus-one.js +28 -0
- package/dist/n-plus-one.js.map +1 -0
- package/dist/query-family-hash.d.ts +3 -0
- package/dist/query-family-hash.d.ts.map +1 -0
- package/dist/query-family-hash.js +26 -0
- package/dist/query-family-hash.js.map +1 -0
- package/dist/telescope-entry.entity.d.ts +19 -0
- package/dist/telescope-entry.entity.d.ts.map +1 -0
- package/dist/telescope-entry.entity.js +37 -0
- package/dist/telescope-entry.entity.js.map +1 -0
- package/dist/telescope-mikro-orm.logger.d.ts +28 -0
- package/dist/telescope-mikro-orm.logger.d.ts.map +1 -0
- package/dist/telescope-mikro-orm.logger.js +49 -0
- package/dist/telescope-mikro-orm.logger.js.map +1 -0
- package/dist/telescope-rollup.entity.d.ts +12 -0
- package/dist/telescope-rollup.entity.d.ts.map +1 -0
- package/dist/telescope-rollup.entity.js +37 -0
- package/dist/telescope-rollup.entity.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// packages/mikro-orm/src/telescope-rollup.entity.ts
|
|
2
|
+
//
|
|
3
|
+
// Pre-aggregated rollup persistence schema, defined via EntitySchema (NOT
|
|
4
|
+
// decorators) so the host does not need emitDecoratorMetadata. Mirrors the
|
|
5
|
+
// `telescope_rollups` table the core SqliteStorageProvider owns:
|
|
6
|
+
//
|
|
7
|
+
// (metric, bucket_start) composite primary key, with additive count/sum and a
|
|
8
|
+
// running max aggregate per 1-minute bucket.
|
|
9
|
+
//
|
|
10
|
+
// The MikroOrmStorageProvider registers this entity in its OWNED single-purpose
|
|
11
|
+
// ORM alongside `TelescopeEntry`, so `schema.update({ safe: true })` self-heals
|
|
12
|
+
// the table additively at boot (creates it; never drops).
|
|
13
|
+
import { BigIntType, EntitySchema } from '@mikro-orm/core';
|
|
14
|
+
// `bucket_start` is an epoch-ms timestamp and count/sum/max are accumulating
|
|
15
|
+
// aggregates, so a true SQL BIGINT column is the right width on MySQL. We pin
|
|
16
|
+
// BigIntType to `number` mode (instead of the default `bigint`) so the JS-side
|
|
17
|
+
// values are plain numbers — telescope rollup counts/sums stay well within
|
|
18
|
+
// Number.MAX_SAFE_INTEGER, and it keeps the row interface cast-free.
|
|
19
|
+
function bigintNumber() {
|
|
20
|
+
return new BigIntType('number');
|
|
21
|
+
}
|
|
22
|
+
export const TelescopeRollup = new EntitySchema({
|
|
23
|
+
name: 'TelescopeRollup',
|
|
24
|
+
tableName: 'telescope_rollups',
|
|
25
|
+
properties: {
|
|
26
|
+
metric: { type: 'string', primary: true, length: 64 },
|
|
27
|
+
bucketStart: { type: bigintNumber(), primary: true, fieldName: 'bucket_start' },
|
|
28
|
+
count: { type: bigintNumber(), fieldName: 'count' },
|
|
29
|
+
sum: { type: bigintNumber(), fieldName: 'sum' },
|
|
30
|
+
max: { type: bigintNumber(), fieldName: 'max' },
|
|
31
|
+
// JSON-typed fixed-length latency histogram. Nullable so `schema.update({
|
|
32
|
+
// safe })` can self-heal it additively onto a legacy table whose rows
|
|
33
|
+
// predate the column (those read back null → normalized to zeros).
|
|
34
|
+
histogram: { type: 'json', fieldName: 'histogram', nullable: true },
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=telescope-rollup.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telescope-rollup.entity.js","sourceRoot":"","sources":["../src/telescope-rollup.entity.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,iEAAiE;AACjE,EAAE;AACF,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,0DAA0D;AAC1D,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAY3D,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,2EAA2E;AAC3E,qEAAqE;AACrE,SAAS,YAAY;IACnB,OAAO,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,YAAY,CAAqB;IAClE,IAAI,EAAE,iBAAiB;IACvB,SAAS,EAAE,mBAAmB;IAC9B,UAAU,EAAE;QACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;QACrD,WAAW,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE;QAC/E,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE;QACnD,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;QAC/C,GAAG,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;QAC/C,0EAA0E;QAC1E,sEAAsE;QACtE,mEAAmE;QACnE,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE;KACpE;CACF,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dudousxd/nestjs-telescope-mikro-orm",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MikroORM query watcher for @dudousxd/nestjs-telescope.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/DavideCarvalho/nestjs-telescope.git",
|
|
9
|
+
"directory": "packages/mikro-orm"
|
|
10
|
+
},
|
|
11
|
+
"author": "Davi Carvalho <davi@goflip.ai>",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"default": "./dist/index.js"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist/",
|
|
24
|
+
"README.md",
|
|
25
|
+
"CHANGELOG.md"
|
|
26
|
+
],
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@mikro-orm/core": ">=7.0.0",
|
|
29
|
+
"@mikro-orm/sql": ">=7.0.0",
|
|
30
|
+
"@mikro-orm/nestjs": ">=7.0.0",
|
|
31
|
+
"@nestjs/common": ">=10.0.0",
|
|
32
|
+
"@nestjs/core": ">=10.0.0",
|
|
33
|
+
"reflect-metadata": ">=0.1.13",
|
|
34
|
+
"@dudousxd/nestjs-telescope": "1.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@mikro-orm/core": "^7.0.0",
|
|
38
|
+
"@mikro-orm/decorators": "^7.0.0",
|
|
39
|
+
"@mikro-orm/sql": "^7.0.0",
|
|
40
|
+
"@mikro-orm/nestjs": "^7.0.0",
|
|
41
|
+
"@mikro-orm/sqlite": "^7.0.0",
|
|
42
|
+
"@nestjs/common": "^11.0.0",
|
|
43
|
+
"@nestjs/core": "^11.0.0",
|
|
44
|
+
"@nestjs/testing": "^11.0.0",
|
|
45
|
+
"@types/node": "^20.0.0",
|
|
46
|
+
"reflect-metadata": "^0.2.2",
|
|
47
|
+
"@types/supertest": "^6.0.2",
|
|
48
|
+
"rxjs": "^7.8.1",
|
|
49
|
+
"supertest": "^7.0.0",
|
|
50
|
+
"typescript": "^5.4.0",
|
|
51
|
+
"vitest": "^3.0.0",
|
|
52
|
+
"@dudousxd/nestjs-telescope": "1.0.0"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=20"
|
|
56
|
+
},
|
|
57
|
+
"keywords": [
|
|
58
|
+
"nestjs",
|
|
59
|
+
"telescope",
|
|
60
|
+
"mikro-orm",
|
|
61
|
+
"observability",
|
|
62
|
+
"query"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc -p tsconfig.json",
|
|
66
|
+
"test": "vitest run --passWithNoTests",
|
|
67
|
+
"test:watch": "vitest",
|
|
68
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
69
|
+
}
|
|
70
|
+
}
|