mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-10 17:53:36 +02:00
don't use the old metrics schema
This commit is contained in:
parent
7e46ec9e47
commit
b95fc76aba
@ -21,8 +21,6 @@ import type {
|
|||||||
import { clientRegisterSchema } from '../shared/schema.js';
|
import { clientRegisterSchema } from '../shared/schema.js';
|
||||||
|
|
||||||
import type { IClientMetricsStoreV2 } from '../client-metrics/client-metrics-store-v2-type.js';
|
import type { IClientMetricsStoreV2 } from '../client-metrics/client-metrics-store-v2-type.js';
|
||||||
import { clientMetricsSchema } from '../shared/schema.js';
|
|
||||||
import type { PartialSome } from '../../../types/partial.js';
|
|
||||||
import type { IPrivateProjectChecker } from '../../private-project/privateProjectCheckerType.js';
|
import type { IPrivateProjectChecker } from '../../private-project/privateProjectCheckerType.js';
|
||||||
import {
|
import {
|
||||||
type ApplicationCreatedEvent,
|
type ApplicationCreatedEvent,
|
||||||
@ -35,6 +33,7 @@ import { findOutdatedSDKs, isOutdatedSdk } from './findOutdatedSdks.js';
|
|||||||
import type { OutdatedSdksSchema } from '../../../openapi/spec/outdated-sdks-schema.js';
|
import type { OutdatedSdksSchema } from '../../../openapi/spec/outdated-sdks-schema.js';
|
||||||
import { CLIENT_REGISTERED } from '../../../metric-events.js';
|
import { CLIENT_REGISTERED } from '../../../metric-events.js';
|
||||||
import { NotFoundError } from '../../../error/index.js';
|
import { NotFoundError } from '../../../error/index.js';
|
||||||
|
import type { ClientMetricsSchema, PartialSome } from '../../../server-impl.js';
|
||||||
|
|
||||||
type ClientData = IClientApp & { lastSeen?: Date };
|
type ClientData = IClientApp & { lastSeen?: Date };
|
||||||
|
|
||||||
@ -110,15 +109,16 @@ export default class ClientInstanceService {
|
|||||||
};
|
};
|
||||||
|
|
||||||
public async registerInstance(
|
public async registerInstance(
|
||||||
data: PartialSome<IClientApp, 'instanceId'>,
|
data: Pick<
|
||||||
|
ClientMetricsSchema,
|
||||||
|
'appName' | 'instanceId' | 'environment'
|
||||||
|
>,
|
||||||
clientIp: string,
|
clientIp: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const value = await clientMetricsSchema.validateAsync(data);
|
|
||||||
|
|
||||||
this.updateSeenClient({
|
this.updateSeenClient({
|
||||||
appName: value.appName,
|
appName: data.appName,
|
||||||
instanceId: value.instanceId,
|
instanceId: data.instanceId ?? 'default',
|
||||||
environment: value.environment,
|
environment: data.environment,
|
||||||
clientIp: clientIp,
|
clientIp: clientIp,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user