Class MetricFileGenerator

  • All Implemented Interfaces:
    Processor<MetricEvent>

    public final class MetricFileGenerator
    extends FileProcessor<MetricEvent>
    A Processor for MetricEvents to write them into files. By default this supports maximum FileProcessor.BATCH_SIZE metrics. If number of metrics go beyond that limit, the newest metrics will override the previous ones in the file, because the file name is going to be the same for both write operations.
    • Constructor Detail

      • MetricFileGenerator

        public MetricFileGenerator​(java.lang.String label,
                                   org.openstreetmap.atlas.generator.tools.spark.utilities.SparkFileHelper fileHelper,
                                   java.lang.String outputFolder)
        Default constructor
        Parameters:
        label - label for the metric file
        fileHelper - SparkFileHelper for I/O operations
        outputFolder - output folder path to write files to
    • Method Detail

      • process

        public void process​(MetricEvent event)
        Description copied from interface: Processor
        Method to process Event. If your method can process multiple events simultaneously, then mark your method with @AllowConcurrentEvents annotation.Please make sure to add @Subscribe annotation to the method that is implementing this method.
        Parameters:
        event - Event to process
      • process

        public void process​(ShutdownEvent event)
        Description copied from interface: Processor
        Method to process ShutdownEvent. This method will be called only once.
        Please make sure to add @Subscribe annotation to the method that is implementing this method.
        Parameters:
        event - ShutdownEvent to process
      • getFilename

        protected java.lang.String getFilename()
        Overrides:
        getFilename in class FileProcessor<MetricEvent>
        Returns:
        the name of the file to be used in #write() method to write files