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
 | 
			
		||||
 | 
			
		||||
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 long maxCalculatedFieldsPerEntity;
 | 
			
		||||
    private long maxArgumentsPerCF;
 | 
			
		||||
    private long maxDataPointsPerRollingArg;
 | 
			
		||||
    private long maxStateSizeInKBytes;
 | 
			
		||||
    private long maxSingleValueArgumentSizeInKBytes;
 | 
			
		||||
    private long maxCalculatedFieldsPerEntity = 5;
 | 
			
		||||
    private long maxArgumentsPerCF = 10;
 | 
			
		||||
    private long maxDataPointsPerRollingArg = 1000;
 | 
			
		||||
    private long maxStateSizeInKBytes = 32;
 | 
			
		||||
    private long maxSingleValueArgumentSizeInKBytes = 2;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public long getProfileThreshold(ApiUsageRecordKey key) {
 | 
			
		||||
 | 
			
		||||
@ -156,11 +156,11 @@ export function createTenantProfileConfiguration(type: TenantProfileType): Tenan
 | 
			
		||||
          rpcTtlDays: 0,
 | 
			
		||||
          queueStatsTtlDays: 0,
 | 
			
		||||
          ruleEngineExceptionsTtlDays: 0,
 | 
			
		||||
          maxCalculatedFieldsPerEntity: 0,
 | 
			
		||||
          maxArgumentsPerCF: 0,
 | 
			
		||||
          maxDataPointsPerRollingArg: 0,
 | 
			
		||||
          maxStateSizeInKBytes: 0,
 | 
			
		||||
          maxSingleValueArgumentSizeInKBytes: 0,
 | 
			
		||||
          maxCalculatedFieldsPerEntity: 5,
 | 
			
		||||
          maxArgumentsPerCF: 10,
 | 
			
		||||
          maxDataPointsPerRollingArg: 1000,
 | 
			
		||||
          maxStateSizeInKBytes: 32,
 | 
			
		||||
          maxSingleValueArgumentSizeInKBytes: 2,
 | 
			
		||||
          calculatedFieldDebugEventsRateLimit: ''
 | 
			
		||||
        };
 | 
			
		||||
        configuration = {...defaultConfiguration, type: TenantProfileType.DEFAULT};
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user