Skip to content

Commit 8a883be

Browse files
committed
chore: fix
1 parent b158cad commit 8a883be

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

packages/cubejs-backend-shared/src/track.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import { internalExceptions } from './errors';
55

66
export type BaseEvent = {
77
event: string,
8-
timestamp: string,
8+
// it's possible to fill timestamp at place of logging, otherwise it will fill it automatically
9+
timestamp?: string,
910
[key: string]: any,
1011
};
1112

packages/cubejs-server-core/src/core/agentCollect.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import crypto from 'crypto';
88
import WebSocket from 'ws';
99
import zlib from 'zlib';
1010
import { promisify } from 'util';
11-
import { LoggerFn } from './types';
11+
import { LoggerFnParams, LoggerFn } from './types';
1212

1313
const deflate = promisify(zlib.deflate);
1414
interface AgentTransport {
@@ -176,7 +176,7 @@ const clearTransport = () => {
176176
agentInterval = null;
177177
};
178178

179-
export default async (event: Record<string, any>, endpointUrl: string, logger: LoggerFn) => {
179+
export const agentCollect = async (event: LoggerFnParams, endpointUrl: string, logger: LoggerFn) => {
180180
trackEvents.push({
181181
timestamp: new Date().toJSON(),
182182
...event,
@@ -228,3 +228,5 @@ export default async (event: Record<string, any>, endpointUrl: string, logger: L
228228
}, getEnv('agentFlushInterval'));
229229
}
230230
};
231+
232+
export default agentCollect;

packages/cubejs-server-core/src/core/server.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { RefreshScheduler, ScheduledRefreshOptions } from './RefreshScheduler';
3030
import { OrchestratorApi, OrchestratorApiOptions } from './OrchestratorApi';
3131
import { CompilerApi } from './CompilerApi';
3232
import { DevServer } from './DevServer';
33-
import agentCollect from './agentCollect';
33+
import { agentCollect } from './agentCollect';
3434
import { OrchestratorStorage } from './OrchestratorStorage';
3535
import { prodLogger, devLogger } from './logger';
3636
import { OptsHandler } from './OptsHandler';
@@ -58,7 +58,8 @@ import type {
5858
LoggerFn,
5959
DriverConfig,
6060
ScheduledRefreshTimeZonesFn,
61-
ContextToCubeStoreRouterIdFn, LoggerEventParams,
61+
ContextToCubeStoreRouterIdFn,
62+
LoggerFnParams,
6263
} from './types';
6364
import {
6465
ContextToOrchestratorIdFn,
@@ -230,7 +231,7 @@ export class CubejsServerCore {
230231

231232
this.startScheduledRefreshTimer();
232233

233-
this.event = async (event, props: LoggerEventParams) => {
234+
this.event = async (event, props: LoggerFnParams) => {
234235
if (!this.options.telemetry) {
235236
return;
236237
}

packages/cubejs-server-core/src/core/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,12 @@ export type ExternalDbTypeFn = (context: RequestContext) => DatabaseType;
167167
export type ExternalDriverFactoryFn = (context: RequestContext) => Promise<BaseDriver> | BaseDriver;
168168
export type ExternalDialectFactoryFn = (context: RequestContext) => BaseQuery;
169169

170-
export type LoggerEventParams = {
170+
export type LoggerFnParams = {
171+
// it's possible to fill timestamp at place of logging, otherwise it will fill it automatically
171172
timestamp?: string,
172173
[key: string]: any,
173174
};
174-
export type LoggerFn = (msg: string, params: LoggerEventParams) => void;
175+
export type LoggerFn = (msg: string, params: LoggerFnParams) => void;
175176

176177
export type BiToolSyncConfig = {
177178
type: string;

0 commit comments

Comments
 (0)