IndexedEvent
An IndexedEvent uses an Index to specify a timerange over which the event occurs and maps that to a data object representing some measurement or metric during that time range.
You can supply the index as a string or as an Index object.
Example Indexes are:
- 1d-1565 is the entire duration of the 1565th day since the UNIX epoch
- 2014-03 is the entire duration of march in 2014
The range, as expressed by the Index, is provided by the convenience method
range()
, which returns a TimeRange instance. Alternatively the begin
and end times represented by the Index can be found with begin()
and end()
respectively.
The data is also specified during construction, and is generally expected to
be an object or an Immutable.Map. If an object is provided it will be stored
internally as an ImmutableMap. If the data provided is some other type then
it will be equivalent to supplying an object of {value: data}
. Data may be
undefined.
The get the data out of an IndexedEvent instance use data()
. It will return
an Immutable.Map.
Constructor Summary
Public Constructor | ||
public |
constructor(index: *, data: *, utc: *) The creation of an IndexedEvent is done by combining two parts: |
Method Summary
Public Methods | ||
public |
begin(): Data The begin time of this Event |
|
public |
data(): Immutable.Map Access the event data |
|
public |
end(): Data The end time of this Event |
|
public |
Get specific data out of the Event |
|
public |
Returns the Index associated with the data in this Event |
|
public |
The TimeRange of this data |
|
public |
The TimeRange of this data, in Local time, as a string. |
|
public |
The TimeRange of this data, in UTC, as a string. |
|
public |
timestamp(): Data Alias for the begin() time. |
|
public |
toJSON(): * |
|
public |
toString(): * |
Public Constructors
public constructor(index: *, data: *, utc: *) source
The creation of an IndexedEvent is done by combining two parts: the Index and the data.
To construct you specify an Index, along with the data.
The index may be an Index, or a string.
To specify the data you can supply either:
- a Javascript object containing key values pairs
- an Immutable.Map, or
- a simple type such as an integer. In the case of the simple type
this is a shorthand for supplying {"value": v}.
Params:
Name | Type | Attribute | Description |
index | * | ||
data | * | ||
utc | * |
Public Methods
public get(key: string): Object source
Get specific data out of the Event
Params:
Name | Type | Attribute | Description |
key | string | Key to lookup, or "value" if not specified. |
public timerangeAsLocalString(): string source
The TimeRange of this data, in Local time, as a string.
public timestamp(): Data source
Alias for the begin() time.
Return:
Data | Time representing this Event |