Skip to content

HttpURLConnector - Thresholds should be configureable.  #145

Description

@dvayanu

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions