Compare commits
No commits in common. "808d24e92bcaab8a2dbe77c746855023d86ccc16" and "dec503fda3982838ff8cc2b19d6db91ec55df80e" have entirely different histories.
808d24e92b
...
dec503fda3
|
@ -34,8 +34,6 @@ spec:
|
||||||
value: '10000000'
|
value: '10000000'
|
||||||
- name: ENABLE_SENSISION
|
- name: ENABLE_SENSISION
|
||||||
value: 't'
|
value: 't'
|
||||||
- name: warpscript.extension.logEvent
|
|
||||||
value: io.warp10.script.ext.logging.LoggingWarpScriptExtension
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 300m
|
cpu: 300m
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
'name' 'utapi/createSnapshot'
|
'name' 'utapi/createSnapshot'
|
||||||
'desc'
|
'desc'
|
||||||
|
@ -41,54 +40,15 @@
|
||||||
'utapi.checkpoint' 'checkpoint_class' STORE
|
'utapi.checkpoint' 'checkpoint_class' STORE
|
||||||
'utapi.repair.correction' 'correction_class' STORE
|
'utapi.repair.correction' 'correction_class' STORE
|
||||||
|
|
||||||
// will read the key `max_snapshot_size@utapi/createSnapshot` from warp 10 config
|
|
||||||
'max_snapshot_size' 'P6H' MACROCONFIGDEFAULT DURATION 'max_snapshot_size' STORE
|
|
||||||
|
|
||||||
// Fetch latest master snapshot
|
// Fetch latest master snapshot
|
||||||
$read_token $master_snapshot_class $filterLabels $endTimestamp @utapi/fetchFirstRecordBefore
|
$read_token $master_snapshot_class $filterLabels $endTimestamp @utapi/fetchFirstRecordBefore
|
||||||
|
|
||||||
|
|
||||||
FIRSTTICK
|
FIRSTTICK
|
||||||
// If we found a snapshot, increment its timestamp so we start at the tick immediatly after
|
// If we found a snapshot, increment its timestamp so we start at the tick immediatly after
|
||||||
<% DUP 0 > %>
|
<% DUP 0 > %>
|
||||||
<% 1 + %> IFT
|
<% 1 + %> IFT
|
||||||
'masterSnapshotTimestamp' STORE // Grab our ending timestamp from the last master snapshot (0 if no snapshots)
|
'masterSnapshotTimestamp' STORE // Grab our ending timestamp from the last master snapshot (0 if no snapshots)
|
||||||
|
|
||||||
// If snapshot is longer than 6 hours change endTimestamp to be masterSnapshotTimestamp + 6 hours
|
|
||||||
<% $endTimestamp $masterSnapshotTimestamp - $max_snapshot_size > %>
|
|
||||||
<%
|
|
||||||
// If there are no preceding snapshots
|
|
||||||
<% $masterSnapshotTimestamp 0 == %>
|
|
||||||
<%
|
|
||||||
// Find the oldest checkpoint
|
|
||||||
// 'No previous snapshots found, detecting start of checkpoints.' LOGMSG
|
|
||||||
$auth_info ->JSON
|
|
||||||
{ 'class' $checkpoint_class 'labels' $filterLabels } ->JSON
|
|
||||||
@utapi/findOldestRecord 'oldestTimestamp' STORE
|
|
||||||
// If no checkpoints are found
|
|
||||||
<% $oldestTimestamp -1 == %>
|
|
||||||
<%
|
|
||||||
// 'No checkpoints found. Looking for corrections' LOGMSG
|
|
||||||
$auth_info ->JSON
|
|
||||||
{ 'class' $correction_class 'labels' $filterLabels } ->JSON
|
|
||||||
@utapi/findOldestRecord 'oldestTimestamp' STORE
|
|
||||||
<% $oldestTimestamp -1 == %>
|
|
||||||
<%
|
|
||||||
// 'No corrections or checkpoints found. Nothing to snapshot' LOGMSG
|
|
||||||
STOP
|
|
||||||
%> IFT
|
|
||||||
%> IFT
|
|
||||||
<% $oldestTimestamp $max_snapshot_size + $endTimestamp < %>
|
|
||||||
<%
|
|
||||||
$oldestTimestamp $max_snapshot_size + 'endTimestamp' STORE
|
|
||||||
%> IFT
|
|
||||||
%>
|
|
||||||
<%
|
|
||||||
$masterSnapshotTimestamp $max_snapshot_size + 'endTimestamp' STORE
|
|
||||||
%> IFTE
|
|
||||||
// 'Oversize snapshot detected using ' $endTimestamp TOSTRING + ' as end' + LOGMSG
|
|
||||||
%> IFT
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"node"
|
"node"
|
||||||
".app"
|
".app"
|
||||||
|
@ -131,8 +91,6 @@
|
||||||
$endTimestamp
|
$endTimestamp
|
||||||
@utapi/fetchFirstRecordBefore
|
@utapi/fetchFirstRecordBefore
|
||||||
VALUES 0 GET @utapi/decodeRecord 'record' STORE
|
VALUES 0 GET @utapi/decodeRecord 'record' STORE
|
||||||
<% $record 'ops' GET ISNULL %>
|
|
||||||
<% $record {} 'ops' PUT DROP %> IFT
|
|
||||||
$fieldSnapshots $record $value PUT DROP
|
$fieldSnapshots $record $value PUT DROP
|
||||||
%> FOREACH
|
%> FOREACH
|
||||||
$previousSnapshots $fieldSnapshots $field PUT DROP
|
$previousSnapshots $fieldSnapshots $field PUT DROP
|
||||||
|
@ -205,6 +163,9 @@
|
||||||
$labelSnapshots $created $labelValue PUT DROP
|
$labelSnapshots $created $labelValue PUT DROP
|
||||||
%> FOREACH
|
%> FOREACH
|
||||||
|
|
||||||
|
// $createdSnapshots ->JSON LOGMSG
|
||||||
|
|
||||||
|
// $endTimestamp TOSTRING LOGMSG
|
||||||
// Fetch all checkpoints since last master snapshot til passed time
|
// Fetch all checkpoints since last master snapshot til passed time
|
||||||
{
|
{
|
||||||
'token' $read_token
|
'token' $read_token
|
||||||
|
@ -275,6 +236,7 @@
|
||||||
$labelSnapshots $created $labelValue PUT DROP
|
$labelSnapshots $created $labelValue PUT DROP
|
||||||
%> FOREACH
|
%> FOREACH
|
||||||
|
|
||||||
|
// $createdSnapshots ->JSON LOGMSG
|
||||||
0 'snapshots' STORE
|
0 'snapshots' STORE
|
||||||
// For each of our indexed fields
|
// For each of our indexed fields
|
||||||
$createdSnapshots KEYLIST
|
$createdSnapshots KEYLIST
|
||||||
|
|
Loading…
Reference in New Issue