return KafkaEventReporter.Factory.forContext(context);
/** * Get a {@link org.apache.gobblin.metrics.kafka.KafkaEventReporter.Builder} for this reporting format. * @param context {@link MetricContext} that should be reported. * @param properties {@link Properties} containing information to build reporters. * @return {@link org.apache.gobblin.metrics.kafka.KafkaEventReporter.Builder}. */ public KafkaEventReporter.Builder<?> eventReporterBuilder(MetricContext context, Properties properties) { switch (this) { case AVRO: KafkaAvroEventReporter.Builder<?> builder = KafkaAvroEventReporter.Factory.forContext(context); if (Boolean.valueOf(properties.getProperty(ConfigurationKeys.METRICS_REPORTING_KAFKA_USE_SCHEMA_REGISTRY, ConfigurationKeys.DEFAULT_METRICS_REPORTING_KAFKA_USE_SCHEMA_REGISTRY))) { builder.withSchemaRegistry(new KafkaAvroSchemaRegistry(properties)); } return builder; case JSON: return KafkaEventReporter.Factory.forContext(context); default: // This should never happen. throw new IllegalArgumentException("KafkaReportingFormat not recognized."); } } }
/** * Get builder for KafkaReporter (override if testing an extension of KafkaReporter) * @param context metricregistry * @return KafkaReporter builder */ public KafkaEventReporter.Builder<? extends KafkaEventReporter.Builder> getBuilder(MetricContext context, Pusher pusher) { return KafkaEventReporter.Factory.forContext(context).withKafkaPusher(pusher); }