@llmtap/collector 0.1.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/dist/index.d.mts +45 -0
- package/dist/index.d.ts +45 -0
- package/dist/index.js +1709 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1664 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +57 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as fastify from 'fastify';
|
|
2
|
+
import * as node_http from 'node:http';
|
|
3
|
+
import Database from 'better-sqlite3';
|
|
4
|
+
|
|
5
|
+
interface CollectorOptions {
|
|
6
|
+
port?: number;
|
|
7
|
+
host?: string;
|
|
8
|
+
dashboardPath?: string;
|
|
9
|
+
quiet?: boolean;
|
|
10
|
+
demo?: boolean;
|
|
11
|
+
/** Data retention in days. 0 = keep forever. */
|
|
12
|
+
retentionDays?: number;
|
|
13
|
+
}
|
|
14
|
+
declare function createServer(options?: CollectorOptions): Promise<{
|
|
15
|
+
app: fastify.FastifyInstance<node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse>, node_http.IncomingMessage, node_http.ServerResponse<node_http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<fastify.FastifyInstance<node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse>, node_http.IncomingMessage, node_http.ServerResponse<node_http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
|
|
16
|
+
__linterBrands: "SafePromiseLike";
|
|
17
|
+
};
|
|
18
|
+
port: number;
|
|
19
|
+
host: string;
|
|
20
|
+
}>;
|
|
21
|
+
declare function startServer(options?: CollectorOptions): Promise<string>;
|
|
22
|
+
|
|
23
|
+
/** Get or create the SQLite database */
|
|
24
|
+
declare function getDb(): Database.Database;
|
|
25
|
+
/** Close the database connection */
|
|
26
|
+
declare function closeDb(): void;
|
|
27
|
+
/** Reset the database (delete all data) */
|
|
28
|
+
declare function resetDb(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Delete spans older than `retentionDays` and reclaim disk space.
|
|
31
|
+
* Returns the number of rows deleted.
|
|
32
|
+
*/
|
|
33
|
+
declare function enforceRetention(retentionDays: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Start periodic retention enforcement (runs every hour).
|
|
36
|
+
* Also runs once immediately on call.
|
|
37
|
+
*/
|
|
38
|
+
declare function startRetentionSchedule(retentionDays: number): void;
|
|
39
|
+
|
|
40
|
+
/** Generate realistic demo data so the dashboard looks alive on first visit */
|
|
41
|
+
declare function seedDemoData(): void;
|
|
42
|
+
|
|
43
|
+
declare function getOtlpEndpoint(): string | null;
|
|
44
|
+
|
|
45
|
+
export { type CollectorOptions, closeDb, createServer, enforceRetention, getDb, getOtlpEndpoint, resetDb, seedDemoData, startRetentionSchedule, startServer };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as fastify from 'fastify';
|
|
2
|
+
import * as node_http from 'node:http';
|
|
3
|
+
import Database from 'better-sqlite3';
|
|
4
|
+
|
|
5
|
+
interface CollectorOptions {
|
|
6
|
+
port?: number;
|
|
7
|
+
host?: string;
|
|
8
|
+
dashboardPath?: string;
|
|
9
|
+
quiet?: boolean;
|
|
10
|
+
demo?: boolean;
|
|
11
|
+
/** Data retention in days. 0 = keep forever. */
|
|
12
|
+
retentionDays?: number;
|
|
13
|
+
}
|
|
14
|
+
declare function createServer(options?: CollectorOptions): Promise<{
|
|
15
|
+
app: fastify.FastifyInstance<node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse>, node_http.IncomingMessage, node_http.ServerResponse<node_http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault> & PromiseLike<fastify.FastifyInstance<node_http.Server<typeof node_http.IncomingMessage, typeof node_http.ServerResponse>, node_http.IncomingMessage, node_http.ServerResponse<node_http.IncomingMessage>, fastify.FastifyBaseLogger, fastify.FastifyTypeProviderDefault>> & {
|
|
16
|
+
__linterBrands: "SafePromiseLike";
|
|
17
|
+
};
|
|
18
|
+
port: number;
|
|
19
|
+
host: string;
|
|
20
|
+
}>;
|
|
21
|
+
declare function startServer(options?: CollectorOptions): Promise<string>;
|
|
22
|
+
|
|
23
|
+
/** Get or create the SQLite database */
|
|
24
|
+
declare function getDb(): Database.Database;
|
|
25
|
+
/** Close the database connection */
|
|
26
|
+
declare function closeDb(): void;
|
|
27
|
+
/** Reset the database (delete all data) */
|
|
28
|
+
declare function resetDb(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Delete spans older than `retentionDays` and reclaim disk space.
|
|
31
|
+
* Returns the number of rows deleted.
|
|
32
|
+
*/
|
|
33
|
+
declare function enforceRetention(retentionDays: number): number;
|
|
34
|
+
/**
|
|
35
|
+
* Start periodic retention enforcement (runs every hour).
|
|
36
|
+
* Also runs once immediately on call.
|
|
37
|
+
*/
|
|
38
|
+
declare function startRetentionSchedule(retentionDays: number): void;
|
|
39
|
+
|
|
40
|
+
/** Generate realistic demo data so the dashboard looks alive on first visit */
|
|
41
|
+
declare function seedDemoData(): void;
|
|
42
|
+
|
|
43
|
+
declare function getOtlpEndpoint(): string | null;
|
|
44
|
+
|
|
45
|
+
export { type CollectorOptions, closeDb, createServer, enforceRetention, getDb, getOtlpEndpoint, resetDb, seedDemoData, startRetentionSchedule, startServer };
|