Class SlidingWindow<T>
java.lang.Object
org.apache.dubbo.metrics.aggregate.SlidingWindow<T>
- Type Parameters:
T- Value type for window statistics.
- Direct Known Subclasses:
TimeWindowAggregator.SnapshotSlidingWindow
SlidingWindow adopts sliding window algorithm for statistics.
A window contains paneCount panes,
intervalInMs = paneCount * paneIntervalInMs
-
Method Summary
Modifier and TypeMethodDescriptionGet the pane at the current timestamp.currentPane(long timeMillis) Get the pane at the specified timestamp in milliseconds.longGet total interval of the sliding window in milliseconds.longGet pane interval of the sliding window in milliseconds.getPaneValue(long timeMillis) Get statistic value from pane at the specified timestamp.booleanisPaneDeprecated(long timeMillis, Pane<T> pane) Checks if the specified pane is deprecated at the specified timestamp.booleanisPaneDeprecated(Pane<T> pane) Checks if the specified pane is deprecated at the current timestamp.list()Get valid pane list for entire sliding window at the current time.list(long timeMillis) Get valid pane list for entire sliding window at the specified time.abstract TnewEmptyValue(long timeMillis) Create a new statistic value for pane.values()Get aggregated value list for entire sliding window at the current time.values(long timeMillis) Get aggregated value list for entire sliding window at the specified time.
-
Method Details
-
currentPane
Get the pane at the current timestamp.- Returns:
- the pane at current timestamp.
-
currentPane
Get the pane at the specified timestamp in milliseconds.- Parameters:
timeMillis- a timestamp in milliseconds.- Returns:
- the pane at the specified timestamp if the time is valid; null if time is invalid.
-
getPaneValue
Get statistic value from pane at the specified timestamp.- Parameters:
timeMillis- the specified timestamp in milliseconds.- Returns:
- the statistic value if pane at the specified timestamp is up-to-date; otherwise null.
-
newEmptyValue
Create a new statistic value for pane.- Parameters:
timeMillis- the specified timestamp in milliseconds.- Returns:
- new empty statistic value.
-
isPaneDeprecated
Checks if the specified pane is deprecated at the current timestamp.- Parameters:
pane- the specified pane.- Returns:
- true if the pane is deprecated; otherwise false.
-
isPaneDeprecated
Checks if the specified pane is deprecated at the specified timestamp.- Parameters:
timeMillis- the specified time.pane- the specified pane.- Returns:
- true if the pane is deprecated; otherwise false.
-
list
Get valid pane list for entire sliding window at the current time. The list will only contain "valid" panes.- Returns:
- valid pane list for entire sliding window.
-
list
Get valid pane list for entire sliding window at the specified time. The list will only contain "valid" panes.- Parameters:
timeMillis- the specified time.- Returns:
- valid pane list for entire sliding window.
-
values
Get aggregated value list for entire sliding window at the current time. The list will only contain value from "valid" panes.- Returns:
- aggregated value list for entire sliding window.
-
values
Get aggregated value list for entire sliding window at the specified time. The list will only contain value from "valid" panes.- Returns:
- aggregated value list for entire sliding window.
-
getIntervalInMs
public long getIntervalInMs()Get total interval of the sliding window in milliseconds.- Returns:
- the total interval in milliseconds.
-
getPaneIntervalInMs
public long getPaneIntervalInMs()Get pane interval of the sliding window in milliseconds.- Returns:
- the interval of a pane in milliseconds.
-