<commit_before>package com.sequenceiq.cloudbreak.telemetry.metering;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.sequenceiq.cloudbreak.telemetry.databus.AbstractDatabusStreamConfiguration;

@Component
public class MeteringConsumptionConfiguration extends AbstractDatabusStreamConfiguration {

    private final MeteringConfiguration meteringConfiguration;

    private final boolean consumptionEnabled;

    public MeteringConsumptionConfiguration(MeteringConfiguration meteringConfiguration,
            @Value("${metering.consumption.enabled:true}") boolean consumptionEnabled) {
        super(meteringConfiguration.isEnabled(), meteringConfiguration.getDbusAppName(), meteringConfiguration.getDbusStreamName());
        this.meteringConfiguration = meteringConfiguration;
        this.consumptionEnabled = consumptionEnabled;
    }

    public boolean isConsumptionEnabled() {
        return consumptionEnabled;
    }

    @Override
    public boolean isEnabled() {
        return meteringConfiguration.isEnabled() && consumptionEnabled;
    }

    @Override
    public String getDbusServiceName() {
        return meteringConfiguration.getDbusServiceName();
    }

    @Override
    public String getDbusAppNameKey() {
        return meteringConfiguration.getDbusAppNameKey();
    }<commit_msg>CB-17470 Disable metering.consumption.enabled by default and enable it in non-local environments<commit_after>package com.sequenceiq.cloudbreak.telemetry.metering;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.sequenceiq.cloudbreak.telemetry.databus.AbstractDatabusStreamConfiguration;

@Component
public class MeteringConsumptionConfiguration extends AbstractDatabusStreamConfiguration {

    private final MeteringConfiguration meteringConfiguration;

    private final boolean consumptionEnabled;

    public MeteringConsumptionConfiguration(MeteringConfiguration meteringConfiguration,
            @Value("${metering.consumption.enabled:false}") boolean consumptionEnabled) {
        super(meteringConfiguration.isEnabled(), meteringConfiguration.getDbusAppName(), meteringConfiguration.getDbusStreamName());
        this.meteringConfiguration = meteringConfiguration;
        this.consumptionEnabled = consumptionEnabled;
    }

    public boolean isConsumptionEnabled() {
        return consumptionEnabled;
    }

    @Override
    public boolean isEnabled() {
        return meteringConfiguration.isEnabled() && consumptionEnabled;
    }

    @Override
    public String getDbusServiceName() {
        return meteringConfiguration.getDbusServiceName();
    }

    @Override
    public String getDbusAppNameKey() {
        return meteringConfiguration.getDbusAppNameKey();
    }
{'fraction_non_alphanumeric': 0.07057163020465773, 'fraction_numerical': 0.0017642907551164433, 'mean_word_length': 4.7975460122699385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2567593', 'n_tokens_mistral': 690, 'n_tokens_neox': 669, 'n_words': 128}