Search in sources :

Example 1 with PushGatewayMetricsReporter

use of org.apache.hudi.metrics.prometheus.PushGatewayMetricsReporter in project hudi by apache.

the class MetricsReporterFactory method createReporter.

public static MetricsReporter createReporter(HoodieWriteConfig config, MetricRegistry registry) {
    String reporterClassName = config.getMetricReporterClassName();
    if (!StringUtils.isNullOrEmpty(reporterClassName)) {
        Object instance = ReflectionUtils.loadClass(reporterClassName, new Class<?>[] { Properties.class, MetricRegistry.class }, config.getProps(), registry);
        if (!(instance instanceof CustomizableMetricsReporter)) {
            throw new HoodieException(config.getMetricReporterClassName() + " is not a subclass of CustomizableMetricsReporter");
        }
        return (MetricsReporter) instance;
    }
    MetricsReporterType type = config.getMetricsReporterType();
    MetricsReporter reporter = null;
    switch(type) {
        case GRAPHITE:
            reporter = new MetricsGraphiteReporter(config, registry);
            break;
        case INMEMORY:
            reporter = new InMemoryMetricsReporter();
            break;
        case JMX:
            reporter = new JmxMetricsReporter(config, registry);
            break;
        case DATADOG:
            reporter = new DatadogMetricsReporter(config, registry);
            break;
        case PROMETHEUS_PUSHGATEWAY:
            reporter = new PushGatewayMetricsReporter(config, registry);
            break;
        case PROMETHEUS:
            reporter = new PrometheusReporter(config, registry);
            break;
        case CONSOLE:
            reporter = new ConsoleMetricsReporter(registry);
            break;
        case CLOUDWATCH:
            reporter = new CloudWatchMetricsReporter(config, registry);
            break;
        default:
            LOG.error("Reporter type[" + type + "] is not supported.");
            break;
    }
    return reporter;
}
Also used : HoodieException(org.apache.hudi.exception.HoodieException) PrometheusReporter(org.apache.hudi.metrics.prometheus.PrometheusReporter) CloudWatchMetricsReporter(org.apache.hudi.metrics.cloudwatch.CloudWatchMetricsReporter) CloudWatchMetricsReporter(org.apache.hudi.metrics.cloudwatch.CloudWatchMetricsReporter) DatadogMetricsReporter(org.apache.hudi.metrics.datadog.DatadogMetricsReporter) CustomizableMetricsReporter(org.apache.hudi.metrics.custom.CustomizableMetricsReporter) PushGatewayMetricsReporter(org.apache.hudi.metrics.prometheus.PushGatewayMetricsReporter) DatadogMetricsReporter(org.apache.hudi.metrics.datadog.DatadogMetricsReporter) CustomizableMetricsReporter(org.apache.hudi.metrics.custom.CustomizableMetricsReporter) PushGatewayMetricsReporter(org.apache.hudi.metrics.prometheus.PushGatewayMetricsReporter)

Aggregations

HoodieException (org.apache.hudi.exception.HoodieException)1 CloudWatchMetricsReporter (org.apache.hudi.metrics.cloudwatch.CloudWatchMetricsReporter)1 CustomizableMetricsReporter (org.apache.hudi.metrics.custom.CustomizableMetricsReporter)1 DatadogMetricsReporter (org.apache.hudi.metrics.datadog.DatadogMetricsReporter)1 PrometheusReporter (org.apache.hudi.metrics.prometheus.PrometheusReporter)1 PushGatewayMetricsReporter (org.apache.hudi.metrics.prometheus.PushGatewayMetricsReporter)1