@certik/skynet 0.8.11 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.14
4
+
5
+ - Switched monitor to send to opsgenie only
6
+
7
+ ## 0.8.13
8
+
9
+ - Added `inline.error` function to `log` library
10
+
11
+ ## 0.8.12
12
+
13
+ - Added `log` library to print one line log
14
+
3
15
  ## 0.8.11
4
16
 
5
17
  - Improved `updateRecordByKeys` in `dynamodb` library to support fields deletion
package/examples/indexer CHANGED
@@ -36,7 +36,12 @@ async function check({ protocol, state, verbose }) {
36
36
 
37
37
  const app = indexer({
38
38
  name: "LibSkynetExampleIndexer",
39
- selector: { protocol: { type: "string", description: "which chain to index" } },
39
+ selector: {
40
+ protocol: {
41
+ type: "string",
42
+ description: "which chain to index"
43
+ }
44
+ },
40
45
 
41
46
  build: {
42
47
  func: build,
package/log.js ADDED
@@ -0,0 +1,25 @@
1
+ function getLine(params) {
2
+ let line = `${new Date().toISOString()}\t`;
3
+
4
+ // Convert to string and filter out newline to tabs (AWS Athena)
5
+ for (let i = 0, l = params.length; i < l; i++) {
6
+ // Certain objects don't get converted
7
+ // Note using JSON.stringfy may be too slow for large objects
8
+ line += `${params[i]} `.replace(/\n/gm, "\t");
9
+ }
10
+
11
+ return line.trim();
12
+ }
13
+
14
+ const inline = {
15
+ log: function (...args) {
16
+ console.log(getLine(args));
17
+ },
18
+ error: function (...args) {
19
+ console.error(getLine(args));
20
+ },
21
+ };
22
+
23
+ module.exports = {
24
+ inline,
25
+ };
package/monitor.js CHANGED
@@ -178,65 +178,7 @@ ${
178
178
  if (result.length > 0) {
179
179
  console.log("Found Errors", result);
180
180
 
181
- if (slackChannel && production) {
182
- // TODO: deduplicate
183
- await postMessage(
184
- slackChannel,
185
- {
186
- text: `${jobName} Monitor Errors: ${result.map((m) => m.message || m).join("\n")}`,
187
- blocks: [
188
- {
189
- type: "header",
190
- text: {
191
- type: "plain_text",
192
- text: `${jobName} Monitor Errors`,
193
- emoji: true,
194
- },
195
- },
196
- {
197
- type: "divider",
198
- },
199
- ...sortErrors(result)
200
- .map((m) => {
201
- return [
202
- {
203
- type: "context",
204
- elements: [
205
- {
206
- type: "plain_text",
207
- text: `${LEVEL_EMOJI[m.type || ERROR_LEVEL.CRITICAL]} ${m.type || ERROR_LEVEL.CRITICAL}`,
208
- },
209
- ],
210
- },
211
- {
212
- type: "section",
213
- text: {
214
- type: "mrkdwn",
215
- text: m.message || m,
216
- },
217
- },
218
- ];
219
- })
220
- .flat(),
221
- {
222
- type: "actions",
223
- elements: [
224
- {
225
- type: "button",
226
- text: {
227
- type: "plain_text",
228
- text: "View Details",
229
- },
230
- value: "view_details",
231
- url: `${await getNomadAddr(production)}/ui/jobs/${jobName}`,
232
- },
233
- ],
234
- },
235
- ],
236
- },
237
- verbose
238
- );
239
-
181
+ if (production) {
240
182
  // Also alert on opsgenie (func prevents duplicate alerts)
241
183
  await postGenieMessage(
242
184
  `${jobName} Monitor Errors: ${result.map((m) => m.message || m).join("\n")}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@certik/skynet",
3
- "version": "0.8.11",
3
+ "version": "0.8.14",
4
4
  "description": "Skynet Shared JS library",
5
5
  "main": "index.js",
6
6
  "author": "CertiK Engineering",