Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-5854

Enhance time unit features

    XMLWordPrintableJSON

Details

    Description

      There is some ambiguity with time units (specifically around processor properties). Two features which I think should be added:

      • Currently only whole numbers are parsed correctly. For example, 10 milliseconds and 0.010 seconds are functionally equivalent, but only the former will be parsed. This is due to the regex used in StandardValidators.TIME_PERIOD_VALIDATOR which relies on FormatUtils.TIME_DURATION_REGEX (see below). Decimal amounts should be parsed
      • The enumerated time units are nanoseconds, milliseconds, seconds, minutes, hours, days, weeks. While I don't intend to extend this to "millennia", etc. as every unit including and above months would be ambiguous, microseconds seems like a valid and missing unit

      Definition of FormatUtils.TIME_DURATION_REGEX:

          public static final String TIME_DURATION_REGEX = "(\\d+)\\s*(" + VALID_TIME_UNITS + ")";
          public static final Pattern TIME_DURATION_PATTERN = Pattern.compile(TIME_DURATION_REGEX);
      

      Attachments

        Issue Links

          Activity

            People

              alopresto Andy LoPresto
              alopresto Andy LoPresto
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m