Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpURLConnector - Thresholds should be configureable. #145

Open
dvayanu opened this issue Jan 29, 2023 · 0 comments
Open

HttpURLConnector - Thresholds should be configureable. #145

dvayanu opened this issue Jan 29, 2023 · 0 comments
Assignees

Comments

@dvayanu
Copy link
Member

dvayanu commented Jan 29, 2023

Currently HttpURLConnector thresholds are configured in the connector itself (hardcoded):

    private void initProducer() {
        ProducerRegistryFactory.getProducerRegistryInstance().registerProducer(new OnDemandStatsProducer(componentName + "-Producer", "use-case", "GET", ServiceStatsFactory.DEFAULT_INSTANCE));
        Accumulators.createAccumulator(componentName + "-AVG.1m", componentName + "-Producer", "GET", "Avg", "1m");
        Accumulators.createAccumulator(componentName + "-AVG.15m", componentName + "-Producer", "GET", "Avg", "15m");
        Accumulators.createAccumulator(componentName + "-AVG.1h", componentName + "-Producer", "GET", "Avg", "1h");
        ThresholdConditionGuard[] guards = new ThresholdConditionGuard[]{
                new DoubleBarrierPassGuard(ThresholdStatus.GREEN, 1000, GuardedDirection.DOWN),
                new DoubleBarrierPassGuard(ThresholdStatus.YELLOW, 1000, GuardedDirection.UP),
                new DoubleBarrierPassGuard(ThresholdStatus.ORANGE, 2000, GuardedDirection.UP),
                new DoubleBarrierPassGuard(ThresholdStatus.RED, 5000, GuardedDirection.UP),
                new DoubleBarrierPassGuard(ThresholdStatus.PURPLE, 20000, GuardedDirection.UP)
        };
        Thresholds.addThreshold(componentName + "-AVG.1m", componentName + "-Producer", "GET", "Avg", "1m", guards);

        DashboardsConfig dashboardsConfig = MoskitoConfigurationHolder.getConfiguration().getDashboardsConfig();
        if (dashboardsConfig == null) {
            dashboardsConfig = new DashboardsConfig();
        }
        if (dashboardsConfig.getDashboards() == null) {
            dashboardsConfig.setDashboards(new DashboardConfig[]{});
        }

        MoskitoConfigurationHolder.getConfiguration().setDashboardsConfig(dashboardsConfig);
    }

It should be moved into a separate config file (configuration for ALL instances of the connector). Additionally we could provide a possibility to override the settings for a component in component config data section, but thats not as important.

uniloftsky added a commit that referenced this issue Jan 31, 2023
…ted. Also added a config file to perform a test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants