use of org.apache.beam.runners.core.metrics.MetricsLogger in project beam by apache.
the class BatchedStreamingWrite method reportStreamingApiLogging.
private void reportStreamingApiLogging(BigQueryOptions options) {
MetricsContainer processWideContainer = MetricsEnvironment.getProcessWideContainer();
if (processWideContainer instanceof MetricsLogger) {
MetricsLogger processWideMetricsLogger = (MetricsLogger) processWideContainer;
processWideMetricsLogger.tryLoggingMetrics("API call Metrics: \n", this.allowedMetricUrns, options.getBqStreamingApiLoggingFrequencySec() * 1000L);
}
}
use of org.apache.beam.runners.core.metrics.MetricsLogger in project beam by apache.
the class StreamingDataflowWorker method main.
public static void main(String[] args) throws Exception {
JvmInitializers.runOnStartup();
DataflowWorkerHarnessHelper.initializeLogging(StreamingDataflowWorker.class);
DataflowWorkerHarnessOptions options = DataflowWorkerHarnessHelper.initializeGlobalStateAndPipelineOptions(StreamingDataflowWorker.class);
DataflowWorkerHarnessHelper.configureLogging(options);
checkArgument(options.isStreaming(), "%s instantiated with options indicating batch use", StreamingDataflowWorker.class.getName());
checkArgument(!DataflowRunner.hasExperiment(options, "beam_fn_api"), "%s cannot be main() class with beam_fn_api enabled", StreamingDataflowWorker.class.getSimpleName());
// Create a non fnapi registry
SdkHarnessRegistry sdkHarnessRegistry = SdkHarnessRegistries.emptySdkHarnessRegistry();
StreamingDataflowWorker worker = StreamingDataflowWorker.fromDataflowWorkerHarnessOptions(options, sdkHarnessRegistry);
// Use the MetricsLogger container which is used by BigQueryIO to periodically log process-wide
// metrics.
MetricsEnvironment.setProcessWideContainer(new MetricsLogger(null));
JvmInitializers.runBeforeProcessing(options);
worker.startStatusPages();
worker.start();
}
Aggregations