mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
feat: count frontend api requests (#6495)
Now frontend API requests will be counted separately under getAllByfrontend. We are already tracking new FE db calls, so we can build grafana dashboard.
This commit is contained in:
parent
184e0e5190
commit
a544a8a4ad
@ -25,7 +25,7 @@ import Raw = Knex.Raw;
|
||||
export interface IGetAllFeatures {
|
||||
featureQuery?: IFeatureToggleQuery;
|
||||
archived: boolean;
|
||||
requestType: 'client' | 'admin' | 'playground';
|
||||
requestType: 'client' | 'admin' | 'playground' | 'frontend';
|
||||
userId?: number;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ export default class FeatureToggleClientStore
|
||||
const isAdmin = requestType === 'admin';
|
||||
const isPlayground = requestType === 'playground';
|
||||
const environment = featureQuery?.environment || DEFAULT_ENV;
|
||||
const stopTimer = this.timer(`getFeatureAdmin${requestType}`);
|
||||
const stopTimer = this.timer(`getAllBy${requestType}`);
|
||||
|
||||
let selectColumns = [
|
||||
'features.name as name',
|
||||
@ -354,6 +354,16 @@ export default class FeatureToggleClientStore
|
||||
});
|
||||
}
|
||||
|
||||
async getFrontendApiClient(
|
||||
featureQuery?: IFeatureToggleQuery,
|
||||
): Promise<IFeatureToggleClient[]> {
|
||||
return this.getAll({
|
||||
featureQuery,
|
||||
archived: false,
|
||||
requestType: 'frontend',
|
||||
});
|
||||
}
|
||||
|
||||
async getPlayground(
|
||||
featureQuery?: IFeatureToggleQuery,
|
||||
): Promise<IFeatureToggleClient[]> {
|
||||
|
@ -54,6 +54,12 @@ export default class FakeClientFeatureToggleStore
|
||||
return this.getFeatures(query);
|
||||
}
|
||||
|
||||
async getFrontendApiClient(
|
||||
query?: IFeatureToggleQuery,
|
||||
): Promise<IFeatureToggleClient[]> {
|
||||
return this.getFeatures(query);
|
||||
}
|
||||
|
||||
async getPlayground(
|
||||
query?: IFeatureToggleQuery,
|
||||
): Promise<IFeatureToggleClient[]> {
|
||||
|
@ -9,6 +9,10 @@ export interface IFeatureToggleClientStore {
|
||||
featureQuery: Partial<IFeatureToggleQuery>,
|
||||
): Promise<IFeatureToggleClient[]>;
|
||||
|
||||
getFrontendApiClient(
|
||||
featureQuery: Partial<IFeatureToggleQuery>,
|
||||
): Promise<IFeatureToggleClient[]>;
|
||||
|
||||
getPlayground(
|
||||
featureQuery: Partial<IFeatureToggleQuery>,
|
||||
): Promise<IFeatureToggleClient[]>;
|
||||
|
@ -1064,7 +1064,7 @@ class FeatureToggleService {
|
||||
async getClientFeatures(
|
||||
query?: IFeatureToggleQuery,
|
||||
): Promise<FeatureConfigurationClient[]> {
|
||||
const result = await this.clientFeatureToggleStore.getClient(
|
||||
const result = await this.clientFeatureToggleStore.getFrontendApiClient(
|
||||
query || {},
|
||||
);
|
||||
return result.map(
|
||||
|
Loading…
Reference in New Issue
Block a user