Merge pull request #12815 from irynamatveieva/cf-profile-limits
Added upgrade script for tenant profile
This commit is contained in:
		
						commit
						b881f1c298
					
				@ -64,3 +64,20 @@ $$;
 | 
				
			|||||||
-- UPDATE SAVE TIME SERIES NODES END
 | 
					-- UPDATE SAVE TIME SERIES NODES END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ALTER TABLE api_usage_state ADD COLUMN IF NOT EXISTS version BIGINT DEFAULT 1;
 | 
					ALTER TABLE api_usage_state ADD COLUMN IF NOT EXISTS version BIGINT DEFAULT 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS START
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					UPDATE tenant_profile
 | 
				
			||||||
 | 
					SET profile_data = profile_data
 | 
				
			||||||
 | 
					    || jsonb_build_object(
 | 
				
			||||||
 | 
					        'configuration', profile_data->'configuration' || jsonb_build_object(
 | 
				
			||||||
 | 
					        'maxCalculatedFieldsPerEntity', COALESCE(profile_data->'configuration'->>'maxCalculatedFieldsPerEntity', '5')::bigint,
 | 
				
			||||||
 | 
					        'maxArgumentsPerCF', COALESCE(profile_data->'configuration'->>'maxArgumentsPerCF', '10')::bigint,
 | 
				
			||||||
 | 
					        'maxDataPointsPerRollingArg', COALESCE(profile_data->'configuration'->>'maxDataPointsPerRollingArg', '1000')::bigint,
 | 
				
			||||||
 | 
					        'maxStateSizeInKBytes', COALESCE(profile_data->'configuration'->>'maxStateSizeInKBytes', '32')::bigint,
 | 
				
			||||||
 | 
					        'maxSingleValueArgumentSizeInKBytes', COALESCE(profile_data->'configuration'->>'maxSingleValueArgumentSizeInKBytes', '2')::bigint
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					WHERE profile_data->'configuration'->>'maxCalculatedFieldsPerEntity' IS NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- UPDATE TENANT PROFILE CALCULATED FIELD LIMITS END
 | 
				
			||||||
 | 
				
			|||||||
@ -135,11 +135,11 @@ public class DefaultTenantProfileConfiguration implements TenantProfileConfigura
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    private double warnThreshold;
 | 
					    private double warnThreshold;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private long maxCalculatedFieldsPerEntity;
 | 
					    private long maxCalculatedFieldsPerEntity = 5;
 | 
				
			||||||
    private long maxArgumentsPerCF;
 | 
					    private long maxArgumentsPerCF = 10;
 | 
				
			||||||
    private long maxDataPointsPerRollingArg;
 | 
					    private long maxDataPointsPerRollingArg = 1000;
 | 
				
			||||||
    private long maxStateSizeInKBytes;
 | 
					    private long maxStateSizeInKBytes = 32;
 | 
				
			||||||
    private long maxSingleValueArgumentSizeInKBytes;
 | 
					    private long maxSingleValueArgumentSizeInKBytes = 2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public long getProfileThreshold(ApiUsageRecordKey key) {
 | 
					    public long getProfileThreshold(ApiUsageRecordKey key) {
 | 
				
			||||||
 | 
				
			|||||||
@ -156,11 +156,11 @@ export function createTenantProfileConfiguration(type: TenantProfileType): Tenan
 | 
				
			|||||||
          rpcTtlDays: 0,
 | 
					          rpcTtlDays: 0,
 | 
				
			||||||
          queueStatsTtlDays: 0,
 | 
					          queueStatsTtlDays: 0,
 | 
				
			||||||
          ruleEngineExceptionsTtlDays: 0,
 | 
					          ruleEngineExceptionsTtlDays: 0,
 | 
				
			||||||
          maxCalculatedFieldsPerEntity: 0,
 | 
					          maxCalculatedFieldsPerEntity: 5,
 | 
				
			||||||
          maxArgumentsPerCF: 0,
 | 
					          maxArgumentsPerCF: 10,
 | 
				
			||||||
          maxDataPointsPerRollingArg: 0,
 | 
					          maxDataPointsPerRollingArg: 1000,
 | 
				
			||||||
          maxStateSizeInKBytes: 0,
 | 
					          maxStateSizeInKBytes: 32,
 | 
				
			||||||
          maxSingleValueArgumentSizeInKBytes: 0,
 | 
					          maxSingleValueArgumentSizeInKBytes: 2,
 | 
				
			||||||
          calculatedFieldDebugEventsRateLimit: ''
 | 
					          calculatedFieldDebugEventsRateLimit: ''
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
        configuration = {...defaultConfiguration, type: TenantProfileType.DEFAULT};
 | 
					        configuration = {...defaultConfiguration, type: TenantProfileType.DEFAULT};
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user