Reduce deprecation log noise from DateIntervalWrapper (#52655)
Converts the deprecations to `deprecatedAndMaybeLog` to reduce the number of times we log deprecations, since some of these could be called at a high frequency (due to unconverted queries, aggs, etc)
This commit is contained in:
parent
c610e0893d
commit
3fcf598b92
|
@ -137,7 +137,7 @@ public class DateIntervalWrapper implements ToXContentFragment, Writeable {
|
|||
/** Get the current interval in milliseconds that is set on this builder. */
|
||||
@Deprecated
|
||||
public long interval() {
|
||||
DEPRECATION_LOGGER.deprecated(DEPRECATION_TEXT);
|
||||
DEPRECATION_LOGGER.deprecatedAndMaybeLog("date-interval-getter", DEPRECATION_TEXT);
|
||||
if (intervalType.equals(IntervalTypeEnum.LEGACY_INTERVAL)) {
|
||||
return TimeValue.parseTimeValue(dateHistogramInterval.toString(), "interval").getMillis();
|
||||
}
|
||||
|
@ -158,14 +158,14 @@ public class DateIntervalWrapper implements ToXContentFragment, Writeable {
|
|||
throw new IllegalArgumentException("[interval] must be 1 or greater for aggregation [date_histogram]");
|
||||
}
|
||||
setIntervalType(IntervalTypeEnum.LEGACY_INTERVAL);
|
||||
DEPRECATION_LOGGER.deprecated(DEPRECATION_TEXT);
|
||||
DEPRECATION_LOGGER.deprecatedAndMaybeLog("date-interval-setter", DEPRECATION_TEXT);
|
||||
this.dateHistogramInterval = new DateHistogramInterval(interval + "ms");
|
||||
}
|
||||
|
||||
/** Get the current date interval that is set on this builder. */
|
||||
@Deprecated
|
||||
public DateHistogramInterval dateHistogramInterval() {
|
||||
DEPRECATION_LOGGER.deprecated(DEPRECATION_TEXT);
|
||||
DEPRECATION_LOGGER.deprecatedAndMaybeLog("date-histogram-interval-getter", DEPRECATION_TEXT);
|
||||
if (intervalType.equals(IntervalTypeEnum.LEGACY_DATE_HISTO)) {
|
||||
return dateHistogramInterval;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ public class DateIntervalWrapper implements ToXContentFragment, Writeable {
|
|||
throw new IllegalArgumentException("[dateHistogramInterval] must not be null: [date_histogram]");
|
||||
}
|
||||
setIntervalType(IntervalTypeEnum.LEGACY_DATE_HISTO);
|
||||
DEPRECATION_LOGGER.deprecated(DEPRECATION_TEXT);
|
||||
DEPRECATION_LOGGER.deprecatedAndMaybeLog("date-histogram-interval-setter", DEPRECATION_TEXT);
|
||||
this.dateHistogramInterval = dateHistogramInterval;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue