This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export function people_beforeInsert(item, context) { | |
| item.fullName = `${item.firstName} ${item.lastName}`; | |
| return item; | |
| } | |
| export function people_beforeUpdate(item, context) { | |
| item.fullName = `${item.firstName} ${item.lastName}`; | |
| return item; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cat ./example-raw-json-logs.json | jq -r '.[] | [.app, .time, .msg, .level] | @csv' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cat ./example-raw-json-logs.json | jq -r '.[] | [.app, .time, .msg, .level]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cat ./example-raw-json-logs.json | jq -r '.[] | .app' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "app": "main-app", | |
| "time": "2023-01-02T15:23:00Z", | |
| "msg": "Error doing this thing", | |
| "level": "error" | |
| }, | |
| { | |
| "app": "main-app", | |
| "time": "2023-01-03T15:23:00Z", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"app": "main-app","time": "2023-01-02T15:23:00Z","msg":"Error doing this thing","level":"error"} | |
| {"app": "main-app","time": "2023-01-03T15:23:00Z","msg":"Error doing this thing","level":"error"} | |
| {"app": "secondary-app","time": "2023-01-03T15:23:00Z","msg":"Error doing that thing","level":"error"} | |
| {"app": "main-app","time": "2023-01-04T13:23:00Z","msg":"Different error doing this thing","level":"error"} | |
| {"app": "main-app","time": "2023-01-05T17:23:00Z","msg":"Different error doing this thing","level":"error"} | |
| {"app": "secondary-app","time": "2023-01-05T14:23:00Z","msg":"Another error doing this thing","level":"error"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "time" | |
| "github.com/app-nerds/kit/v6/workticker" | |
| "github.com/sirupsen/logrus" | |
| "go.uber.org/ratelimit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package workticker | |
| import ( | |
| "context" | |
| "errors" | |
| "sync" | |
| "time" | |
| "github.com/sirupsen/logrus" | |
| "go.uber.org/ratelimit" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| go func() { | |
| ticker := time.NewTicker(wp.tickFrequency) | |
| for { | |
| select { | |
| case <-ticker.C: | |
| workItem, err := wp.workConfiguration.Retriever(wp.workConfiguration.Handler) | |
| if err != nil && errors.Is(err, ErrNoWorkToRetrieve) { | |
| continue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| wp.logger.Infof("starting work ticker '%s'...", wp.name) | |
| wg := sync.WaitGroup{} | |
| for i := 0; i < wp.numWorkers; i++ { | |
| wg.Add(1) | |
| go func(workerID int) { | |
| wp.logger.Infof("[%s] starting worker %d", wp.name, workerID) | |
| defer wg.Done() |
NewerOlder