mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
chore: bulk metrics - remove a flag (#10190)
This commit is contained in:
parent
6aecc3f93e
commit
daa6461d9b
@ -71,35 +71,6 @@ export default class ClientInstanceStore implements IClientInstanceStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* `bulkUpsert` is beeing used instead. remove with `lastSeenBulkQuery` flag
|
|
||||||
*/
|
|
||||||
async setLastSeen({
|
|
||||||
appName,
|
|
||||||
instanceId,
|
|
||||||
environment,
|
|
||||||
clientIp,
|
|
||||||
}: INewClientInstance): Promise<void> {
|
|
||||||
const stopTimer = this.metricTimer('setLastSeen');
|
|
||||||
|
|
||||||
await this.db(TABLE)
|
|
||||||
.insert({
|
|
||||||
app_name: appName,
|
|
||||||
instance_id: instanceId,
|
|
||||||
environment,
|
|
||||||
last_seen: new Date(),
|
|
||||||
client_ip: clientIp,
|
|
||||||
})
|
|
||||||
.onConflict(['app_name', 'instance_id', 'environment'])
|
|
||||||
.merge({
|
|
||||||
last_seen: new Date(),
|
|
||||||
client_ip: clientIp,
|
|
||||||
});
|
|
||||||
|
|
||||||
stopTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
async bulkUpsert(instances: INewClientInstance[]): Promise<void> {
|
async bulkUpsert(instances: INewClientInstance[]): Promise<void> {
|
||||||
const stopTimer = this.metricTimer('bulkUpsert');
|
const stopTimer = this.metricTimer('bulkUpsert');
|
||||||
|
|
||||||
|
@ -101,21 +101,12 @@ export default class ClientInstanceService {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const value = await clientMetricsSchema.validateAsync(data);
|
const value = await clientMetricsSchema.validateAsync(data);
|
||||||
|
|
||||||
if (this.flagResolver.isEnabled('lastSeenBulkQuery')) {
|
|
||||||
this.seenClients[this.clientKey(value)] = {
|
this.seenClients[this.clientKey(value)] = {
|
||||||
appName: value.appName,
|
appName: value.appName,
|
||||||
instanceId: value.instanceId,
|
instanceId: value.instanceId,
|
||||||
environment: value.environment,
|
environment: value.environment,
|
||||||
clientIp: clientIp,
|
clientIp: clientIp,
|
||||||
};
|
};
|
||||||
} else {
|
|
||||||
await this.clientInstanceStore.setLastSeen({
|
|
||||||
appName: value.appName,
|
|
||||||
instanceId: value.instanceId,
|
|
||||||
environment: value.environment,
|
|
||||||
clientIp: clientIp,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public registerFrontendClient(data: IFrontendClientApp): void {
|
public registerFrontendClient(data: IFrontendClientApp): void {
|
||||||
|
@ -56,7 +56,6 @@ export type IFlagKey =
|
|||||||
| 'edgeObservability'
|
| 'edgeObservability'
|
||||||
| 'registerFrontendClient'
|
| 'registerFrontendClient'
|
||||||
| 'reportUnknownFlags'
|
| 'reportUnknownFlags'
|
||||||
| 'lastSeenBulkQuery'
|
|
||||||
| 'lifecycleMetrics'
|
| 'lifecycleMetrics'
|
||||||
| 'customMetrics'
|
| 'customMetrics'
|
||||||
| 'impactMetrics'
|
| 'impactMetrics'
|
||||||
@ -267,10 +266,6 @@ const flags: IFlags = {
|
|||||||
process.env.UNLEASH_EXPERIMENTAL_REPORT_UNKNOWN_FLAGS,
|
process.env.UNLEASH_EXPERIMENTAL_REPORT_UNKNOWN_FLAGS,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
lastSeenBulkQuery: parseEnvVarBoolean(
|
|
||||||
process.env.UNLEASH_EXPERIMENTAL_LAST_SEEN_BULK_QUERY,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
lifecycleMetrics: parseEnvVarBoolean(
|
lifecycleMetrics: parseEnvVarBoolean(
|
||||||
process.env.UNLEASH_EXPERIMENTAL_LIFECYCLE_METRICS,
|
process.env.UNLEASH_EXPERIMENTAL_LIFECYCLE_METRICS,
|
||||||
false,
|
false,
|
||||||
|
@ -18,11 +18,6 @@ export interface IClientInstanceStore
|
|||||||
Pick<INewClientInstance, 'appName' | 'instanceId'>
|
Pick<INewClientInstance, 'appName' | 'instanceId'>
|
||||||
> {
|
> {
|
||||||
bulkUpsert(instances: INewClientInstance[]): Promise<void>;
|
bulkUpsert(instances: INewClientInstance[]): Promise<void>;
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* `bulkUpsert` is beeing used instead. remove with `lastSeenBulkQuery` flag
|
|
||||||
*/
|
|
||||||
setLastSeen(INewClientInstance): Promise<void>;
|
|
||||||
insert(details: INewClientInstance): Promise<void>;
|
insert(details: INewClientInstance): Promise<void>;
|
||||||
getByAppName(appName: string): Promise<IClientInstance[]>;
|
getByAppName(appName: string): Promise<IClientInstance[]>;
|
||||||
getRecentByAppNameAndEnvironment(
|
getRecentByAppNameAndEnvironment(
|
||||||
|
@ -28,10 +28,6 @@ export default class FakeClientInstanceStore implements IClientInstanceStore {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
setLastSeen(): Promise<void> {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
async getBySdkName(sdkName: string): Promise<IClientInstance[]> {
|
async getBySdkName(sdkName: string): Promise<IClientInstance[]> {
|
||||||
return this.instances.filter((instance) =>
|
return this.instances.filter((instance) =>
|
||||||
instance.sdkVersion?.startsWith(sdkName),
|
instance.sdkVersion?.startsWith(sdkName),
|
||||||
|
Loading…
Reference in New Issue
Block a user