mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-25 00:58:07 +00:00
feat: triggers fixes, examples, states, migrations
This commit is contained in:
parent
cfc5668c48
commit
51200fab4a
21 changed files with 359 additions and 262 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/jmoiron/sqlx"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"github.com/pkg/errors"
|
||||
migrate "github.com/rubenv/sql-migrate"
|
||||
)
|
||||
|
||||
|
@ -26,7 +27,7 @@ func ConnectToDatabase(logger *slog.Logger, path string) (*sqlx.DB, error) {
|
|||
}
|
||||
n, err := migrate.Exec(db.DB, "sqlite3", migrations, migrate.Up)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, errors.Wrap(err, "failed to run migrations")
|
||||
}
|
||||
logger.Info("Applied migrations", "number", n)
|
||||
|
||||
|
|
|
@ -48,10 +48,26 @@ type OAuth2State struct {
|
|||
type CheckStatus string
|
||||
|
||||
const (
|
||||
CheckSuccess CheckStatus = "SUCCESS"
|
||||
CheckFailure CheckStatus = "FAILURE"
|
||||
CheckError CheckStatus = "ERROR"
|
||||
CheckUnknown CheckStatus = "UNKNOWN"
|
||||
CheckStatusSuccess CheckStatus = "SUCCESS"
|
||||
CheckStatusFailure CheckStatus = "FAILURE"
|
||||
CheckStatusError CheckStatus = "ERROR"
|
||||
CheckStatusUnknown CheckStatus = "UNKNOWN"
|
||||
)
|
||||
|
||||
type CheckState string
|
||||
|
||||
const (
|
||||
CheckStateActive CheckState = "ACTIVE"
|
||||
CheckStatePaused CheckState = "PAUSED"
|
||||
CheckStateUnknown CheckState = "UNKNOWN"
|
||||
)
|
||||
|
||||
type CheckVisibility string
|
||||
|
||||
const (
|
||||
CheckVisibilityPublic CheckVisibility = "PUBLIC"
|
||||
CheckVisibilityPrivate CheckVisibility = "PRIVATE"
|
||||
CheckVisibilityUnknown CheckVisibility = "UNKNOWN"
|
||||
)
|
||||
|
||||
type Check struct {
|
||||
|
@ -61,6 +77,7 @@ type Check struct {
|
|||
Id string `db:"id"`
|
||||
Name string `db:"name"`
|
||||
Group string `db:"group"`
|
||||
Visibility CheckVisibility `db:"visibility"`
|
||||
|
||||
Schedule string `db:"schedule"`
|
||||
Script string `db:"script"`
|
||||
|
@ -102,10 +119,26 @@ type WorkerGroupWithChecks struct {
|
|||
type TriggerStatus string
|
||||
|
||||
const (
|
||||
TriggerSuccess TriggerStatus = "SUCCESS"
|
||||
TriggerFailure TriggerStatus = "FAILURE"
|
||||
TriggerError TriggerStatus = "ERROR"
|
||||
TriggerUnknown TriggerStatus = "UNKNOWN"
|
||||
TriggerStatusSuccess TriggerStatus = "SUCCESS"
|
||||
TriggerStatusFailure TriggerStatus = "FAILURE"
|
||||
TriggerStatusError TriggerStatus = "ERROR"
|
||||
TriggerStatusUnknown TriggerStatus = "UNKNOWN"
|
||||
)
|
||||
|
||||
type TriggerState string
|
||||
|
||||
const (
|
||||
TriggerStateActive TriggerState = "ACTIVE"
|
||||
TriggerStatePaused TriggerState = "PAUSED"
|
||||
TriggerStateUnknown TriggerState = "UNKNOWN"
|
||||
)
|
||||
|
||||
type TriggerVisibility string
|
||||
|
||||
const (
|
||||
TriggerVisibilityPublic TriggerVisibility = "PUBLIC"
|
||||
TriggerVisibilityPrivate TriggerVisibility = "PRIVATE"
|
||||
TriggerVisibilityUnknown TriggerVisibility = "UNKNOWN"
|
||||
)
|
||||
|
||||
type Trigger struct {
|
||||
|
@ -115,7 +148,6 @@ type Trigger struct {
|
|||
Id string `db:"id"`
|
||||
Name string `db:"name"`
|
||||
Script string `db:"script"`
|
||||
Status TriggerStatus `db:"status"`
|
||||
}
|
||||
|
||||
type TriggerHistory struct {
|
||||
|
|
|
@ -9,10 +9,12 @@ CREATE TABLE oauth2_states (
|
|||
CREATE TABLE checks (
|
||||
id TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
"group" TEXT NOT NULL DEFAULT 'default',
|
||||
"group" TEXT NOT NULL,
|
||||
schedule TEXT NOT NULL,
|
||||
script TEXT NOT NULL,
|
||||
|
||||
visibility TEXT NOT NULL,
|
||||
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ')),
|
||||
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ')),
|
||||
|
||||
|
@ -21,9 +23,11 @@ CREATE TABLE checks (
|
|||
) STRICT;
|
||||
|
||||
|
||||
--CREATE TRIGGER checks_updated_timestamp AFTER UPDATE ON checks BEGIN
|
||||
-- update checks set updated_at = strftime('%Y-%m-%dT%H:%M:%fZ') where id = new.id;
|
||||
--END;
|
||||
-- +migrate StatementBegin
|
||||
CREATE TRIGGER checks_updated_timestamp AFTER UPDATE ON checks BEGIN
|
||||
UPDATE checks SET updated_at = strftime('%Y-%m-%dT%H:%M:%fZ') WHERE id = NEW.id;
|
||||
END;
|
||||
-- +migrate StatementEnd
|
||||
|
||||
CREATE TABLE worker_groups (
|
||||
id TEXT NOT NULL,
|
||||
|
@ -36,9 +40,11 @@ CREATE TABLE worker_groups (
|
|||
CONSTRAINT unique_worker_groups_name UNIQUE (name)
|
||||
) STRICT;
|
||||
|
||||
--CREATE TRIGGER worker_groups_updated_timestamp AFTER UPDATE ON worker_groups BEGIN
|
||||
-- update worker_groups set updated_at = strftime('%Y-%m-%dT%H:%M:%fZ') where id = new.id;
|
||||
--END;
|
||||
-- +migrate StatementBegin
|
||||
CREATE TRIGGER worker_groups_updated_timestamp AFTER UPDATE ON worker_groups BEGIN
|
||||
UPDATE worker_groups SET updated_at = strftime('%Y-%m-%dT%H:%M:%fZ') WHERE id = NEW.id;
|
||||
END;
|
||||
-- +migrate StatementEnd
|
||||
|
||||
CREATE TABLE check_worker_groups (
|
||||
worker_group_id TEXT NOT NULL,
|
||||
|
@ -67,7 +73,6 @@ CREATE TABLE triggers (
|
|||
id TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
script TEXT NOT NULL,
|
||||
status TEXT NOT NULL,
|
||||
|
||||
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ')),
|
||||
updated_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ')),
|
||||
|
@ -76,6 +81,13 @@ CREATE TABLE triggers (
|
|||
CONSTRAINT unique_triggers_name UNIQUE (name)
|
||||
) STRICT;
|
||||
|
||||
|
||||
-- +migrate StatementBegin
|
||||
CREATE TRIGGER triggers_updated_timestamp AFTER UPDATE ON triggers BEGIN
|
||||
UPDATE triggers SET updated_at = strftime('%Y-%m-%dT%H:%M:%fZ') WHERE id = NEW.id;
|
||||
END;
|
||||
-- +migrate StatementEnd
|
||||
|
||||
CREATE TABLE trigger_histories (
|
||||
trigger_id TEXT NOT NULL,
|
||||
|
||||
|
@ -92,7 +104,10 @@ CREATE TABLE trigger_histories (
|
|||
DROP TABLE oauth2_states;
|
||||
DROP TABLE check_worker_groups;
|
||||
DROP TABLE worker_groups;
|
||||
DROP TRIGGER worker_groups_updated_timestamp;
|
||||
DROP TABLE check_histories;
|
||||
DROP TABLE checks;
|
||||
DROP TRIGGER checks_updated_timestamp;
|
||||
DROP TABLE triggers;
|
||||
DROP TABLE trigger_histories;
|
||||
DROP TRIGGER triggers_updated_timestamp;
|
||||
|
|
25
go.mod
25
go.mod
|
@ -22,6 +22,7 @@ require (
|
|||
go.temporal.io/server v1.22.4
|
||||
golang.org/x/exp v0.0.0-20231127185646-65229373498e
|
||||
golang.org/x/oauth2 v0.17.0
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
||||
replace go.temporal.io/server => github.com/temporalio/temporal v1.23.0-rc2.0.20240207154935-68882596be5d
|
||||
|
@ -33,19 +34,14 @@ require (
|
|||
cloud.google.com/go/iam v1.1.5 // indirect
|
||||
cloud.google.com/go/storage v1.36.0 // indirect
|
||||
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
|
||||
github.com/Masterminds/goutils v1.1.1 // indirect
|
||||
github.com/Masterminds/semver/v3 v3.2.0 // indirect
|
||||
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
|
||||
github.com/PuerkitoBio/goquery v1.8.1 // indirect
|
||||
github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 // indirect
|
||||
github.com/andybalholm/brotli v1.0.6 // indirect
|
||||
github.com/andybalholm/cascadia v1.3.1 // indirect
|
||||
github.com/apache/thrift v0.18.1 // indirect
|
||||
github.com/armon/go-radix v1.0.0 // indirect
|
||||
github.com/aws/aws-sdk-go v1.44.289 // indirect
|
||||
github.com/benbjohnson/clock v1.3.5 // indirect
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bgentry/speakeasy v0.1.0 // indirect
|
||||
github.com/blang/semver/v4 v4.0.0 // indirect
|
||||
github.com/bufbuild/protocompile v0.7.1 // indirect
|
||||
github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c // indirect
|
||||
|
@ -56,7 +52,6 @@ require (
|
|||
github.com/chromedp/sysutil v1.0.0 // indirect
|
||||
github.com/coreos/go-oidc/v3 v3.1.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
|
||||
github.com/denisenkom/go-mssqldb v0.9.0 // indirect
|
||||
github.com/dgraph-io/ristretto v0.1.1 // indirect
|
||||
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
|
@ -70,7 +65,6 @@ require (
|
|||
github.com/fsnotify/fsnotify v1.7.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
|
||||
github.com/go-logfmt/logfmt v0.6.0 // indirect
|
||||
github.com/go-logr/logr v1.3.0 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
|
@ -78,12 +72,9 @@ require (
|
|||
github.com/go-sourcemap/sourcemap v2.1.4-0.20211119122758-180fcef48034+incompatible // indirect
|
||||
github.com/go-sql-driver/mysql v1.7.1 // indirect
|
||||
github.com/gocql/gocql v1.5.2 // indirect
|
||||
github.com/godror/godror v0.40.4 // indirect
|
||||
github.com/godror/knownpb v0.1.1 // indirect
|
||||
github.com/gogo/protobuf v1.3.2 // indirect
|
||||
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
|
||||
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe // indirect
|
||||
github.com/golang/glog v1.1.2 // indirect
|
||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||
github.com/golang/mock v1.7.0-rc.1 // indirect
|
||||
|
@ -106,12 +97,8 @@ require (
|
|||
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
|
||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/hashicorp/hcl v1.0.0 // indirect
|
||||
github.com/huandu/xstrings v1.4.0 // indirect
|
||||
github.com/iancoleman/strcase v0.3.0 // indirect
|
||||
github.com/imdario/mergo v0.3.13 // indirect
|
||||
github.com/jackc/pgpassfile v1.0.0 // indirect
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
|
||||
github.com/jackc/pgx/v5 v5.4.3 // indirect
|
||||
|
@ -127,25 +114,18 @@ require (
|
|||
github.com/mailru/easyjson v0.7.7 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-oci8 v0.1.1 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.14 // indirect
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
|
||||
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa // indirect
|
||||
github.com/mitchellh/cli v1.1.5 // indirect
|
||||
github.com/mitchellh/copystructure v1.2.0 // indirect
|
||||
github.com/mitchellh/mapstructure v1.5.0 // indirect
|
||||
github.com/mitchellh/reflectwalk v1.0.2 // indirect
|
||||
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect
|
||||
github.com/mstoykov/k6-taskqueue-lib v0.1.0 // indirect
|
||||
github.com/ncruces/go-strftime v0.1.9 // indirect
|
||||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
|
||||
github.com/olekukonko/tablewriter v0.0.5 // indirect
|
||||
github.com/olivere/elastic/v7 v7.0.32 // indirect
|
||||
github.com/opentracing/opentracing-go v1.2.0 // indirect
|
||||
github.com/pborman/uuid v1.2.1 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
|
||||
github.com/posener/complete v1.2.3 // indirect
|
||||
github.com/prometheus/client_golang v1.16.0 // indirect
|
||||
github.com/prometheus/client_model v0.4.0 // indirect
|
||||
github.com/prometheus/common v0.44.0 // indirect
|
||||
|
@ -153,13 +133,11 @@ require (
|
|||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
|
||||
github.com/redis/go-redis/v9 v9.0.5 // indirect
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/robfig/cron v1.2.0 // indirect
|
||||
github.com/robfig/cron/v3 v3.0.1 // indirect
|
||||
github.com/sagikazarmark/locafero v0.4.0 // indirect
|
||||
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
|
||||
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect
|
||||
github.com/shopspring/decimal v1.3.1 // indirect
|
||||
github.com/sourcegraph/conc v0.3.0 // indirect
|
||||
github.com/spf13/afero v1.11.0 // indirect
|
||||
github.com/spf13/cast v1.6.0 // indirect
|
||||
|
@ -220,7 +198,6 @@ require (
|
|||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
|
||||
gopkg.in/validator.v2 v2.0.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
lukechampine.com/uint128 v1.3.0 // indirect
|
||||
modernc.org/cc/v3 v3.41.0 // indirect
|
||||
|
|
75
go.sum
75
go.sum
|
@ -16,14 +16,6 @@ github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358/go.mod h1:chxPXzS
|
|||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||
github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo=
|
||||
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
|
||||
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
|
||||
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
|
||||
github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g=
|
||||
github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ=
|
||||
github.com/Masterminds/sprig/v3 v3.2.1/go.mod h1:UoaO7Yp8KlPnJIYWTFkMaqPUYKTfGFPhxNuwnnxkKlk=
|
||||
github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA=
|
||||
github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM=
|
||||
github.com/PuerkitoBio/goquery v1.8.1 h1:uQxhNlArOIdbrH1tr0UXwdVFgDcZDrZVdcpygAcwmWM=
|
||||
github.com/PuerkitoBio/goquery v1.8.1/go.mod h1:Q8ICL1kNUJ2sXGoAhPGUdYDJvgQgHzJsnnd3H7Ho5jQ=
|
||||
github.com/Soontao/goHttpDigestClient v0.0.0-20170320082612-6d28bb1415c5 h1:k+1+doEm31k0rRjCjLnGG3YRkuO9ljaEyS2ajZd6GK8=
|
||||
|
@ -41,9 +33,6 @@ github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEq
|
|||
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
|
||||
github.com/apache/thrift v0.18.1 h1:lNhK/1nqjbwbiOPDBPFJVKxgDEGSepKuTh6OLiXW8kg=
|
||||
github.com/apache/thrift v0.18.1/go.mod h1:rdQn/dCcDKEWjjylUeueum4vQEjG2v8v2PqriUnbr+I=
|
||||
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI=
|
||||
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
|
||||
github.com/aws/aws-sdk-go v1.44.289 h1:5CVEjiHFvdiVlKPBzv0rjG4zH/21W/onT18R5AH/qx0=
|
||||
github.com/aws/aws-sdk-go v1.44.289/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI=
|
||||
github.com/benbjohnson/clock v0.0.0-20160125162948-a620c1cc9866/go.mod h1:UMqtWQTnOe4byzwe7Zhwh8f8s+36uszN51sJrSIZlTE=
|
||||
|
@ -54,8 +43,6 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
|||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
|
||||
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
|
||||
github.com/bitly/go-hostpool v0.0.0-20171023180738-a3a6125de932/go.mod h1:NOuUCSz6Q9T7+igc/hlvDOUdtWKryOrtFyIVABv/p7k=
|
||||
github.com/bitly/go-hostpool v0.1.0 h1:XKmsF6k5el6xHG3WPJ8U0Ku/ye7njX7W81Ng7O2ioR0=
|
||||
github.com/bitly/go-hostpool v0.1.0/go.mod h1:4gOCgp6+NZnVqlKyZ/iBZFTAJKembaVENUpMkpg42fw=
|
||||
|
@ -102,8 +89,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
|
|||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
|
||||
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/denisenkom/go-mssqldb v0.9.0 h1:RSohk2RsiZqLZ0zCjtfn3S4Gp4exhpBWHyQ7D0yGjAk=
|
||||
github.com/denisenkom/go-mssqldb v0.9.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||
github.com/dgraph-io/badger/v4 v4.2.0 h1:kJrlajbXXL9DFTNuhhu9yCx7JJa4qpYWxtE8BzuWsEs=
|
||||
github.com/dgraph-io/badger/v4 v4.2.0/go.mod h1:qfCqhPoWDFJRx1gp5QwwyGo8xk1lbHUxvK9nK0OGAak=
|
||||
github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8=
|
||||
|
@ -136,7 +121,6 @@ github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBF
|
|||
github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE=
|
||||
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw=
|
||||
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM=
|
||||
github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE=
|
||||
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
|
||||
|
@ -161,8 +145,6 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb
|
|||
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
|
||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
|
||||
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
|
||||
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
|
||||
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
|
||||
github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY=
|
||||
github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
|
@ -185,10 +167,6 @@ github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9
|
|||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||
github.com/gocql/gocql v1.5.2 h1:WnKf8xRQImcT/KLaEWG2pjEeryDB7K0qQN9mPs1C58Q=
|
||||
github.com/gocql/gocql v1.5.2/go.mod h1:3gM2c4D3AnkISwBxGnMMsS8Oy4y2lhbPRsH4xnJrHG8=
|
||||
github.com/godror/godror v0.40.4 h1:X1e7hUd02GDaLWKZj40Z7L0CP0W9TrGgmPQZw6+anBg=
|
||||
github.com/godror/godror v0.40.4/go.mod h1:i8YtVTHUJKfFT3wTat4A9UoqScUtZXiYB9Rf3SVARgc=
|
||||
github.com/godror/knownpb v0.1.1 h1:A4J7jdx7jWBhJm18NntafzSC//iZDHkDi1+juwQ5pTI=
|
||||
github.com/godror/knownpb v0.1.1/go.mod h1:4nRFbQo1dDuwKnblRXDxrfCFYeT4hjg3GjMqef58eRE=
|
||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
|
@ -198,8 +176,6 @@ github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOW
|
|||
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
|
||||
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe h1:lXe2qZdvpiX5WZkZR4hgp4KJVfY3nMkvmwbVkpv1rVY=
|
||||
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo=
|
||||
|
@ -254,7 +230,6 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4
|
|||
github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o=
|
||||
github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw=
|
||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
|
@ -288,25 +263,11 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 h1:/c3QmbOGMGTOumP2iT/rCwB7b0Q
|
|||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1/go.mod h1:5SN9VR2LTsRFsrEC6FHgRbTWrTHu6tqPeKxEQv15giM=
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed h1:5upAirOpQc1Q53c0bnx2ufif5kANL7bfZWcc6VJWJd8=
|
||||
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
|
||||
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
||||
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
|
||||
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
|
||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
|
||||
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
|
||||
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
|
||||
github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
|
||||
github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w=
|
||||
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||
github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
|
||||
github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
|
||||
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
|
||||
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
|
||||
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
|
||||
|
@ -364,18 +325,11 @@ github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0V
|
|||
github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
|
||||
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
|
||||
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
|
||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-oci8 v0.1.1 h1:aEUDxNAyDG0tv8CA3TArnDQNyc4EhnWlsfxRgDHABHM=
|
||||
github.com/mattn/go-oci8 v0.1.1/go.mod h1:wjDx6Xm9q7dFtHJvIlrI99JytznLw5wQ4R+9mNXJwGI=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU=
|
||||
github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
|
||||
github.com/mattn/go-sqlite3 v1.14.19 h1:fhGleo2h1p8tVChob4I9HpmVFIAkKGpiukdrgQbWfGI=
|
||||
github.com/mattn/go-sqlite3 v1.14.19/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
|
@ -384,16 +338,8 @@ github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zk
|
|||
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
|
||||
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa h1:lx8ZnNPwjkXSzOROz0cg69RlErRXs+L3eDkggASWKLo=
|
||||
github.com/mccutchen/go-httpbin v1.1.2-0.20190116014521-c5cb2f4802fa/go.mod h1:fhpOYavp5g2K74XDl/ao2y4KvhqVtKlkg1e+0UaQv7I=
|
||||
github.com/mitchellh/cli v1.1.5 h1:OxRIeJXpAMztws/XHlN2vu6imG5Dpq+j61AzAX5fLng=
|
||||
github.com/mitchellh/cli v1.1.5/go.mod h1:v8+iFts2sPIKUV1ltktPXMCC8fumSKFItNcD2cLtRR4=
|
||||
github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw=
|
||||
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
|
||||
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
|
||||
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
|
||||
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
|
||||
github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
|
||||
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
|
||||
|
@ -413,8 +359,6 @@ github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/
|
|||
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec=
|
||||
github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY=
|
||||
github.com/olivere/elastic/v7 v7.0.32 h1:R7CXvbu8Eq+WlsLgxmKVKPox0oOwAE/2T9Si5BnvK6E=
|
||||
github.com/olivere/elastic/v7 v7.0.32/go.mod h1:c7PVmLe3Fxq77PIfY/bZmxY/TAamBhCzZ8xDOE09a9k=
|
||||
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
|
||||
|
@ -435,9 +379,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
|
|||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
|
||||
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
|
||||
github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo=
|
||||
github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
|
||||
github.com/poy/onpar v1.1.2 h1:QaNrNiZx0+Nar5dLgTVp5mXkyoVFIbepjyEoGSnhbAY=
|
||||
github.com/poy/onpar v1.1.2/go.mod h1:6X8FLNoxyr9kkmnlqpK6LSoiOtrO6MICtWwEuWkLjzg=
|
||||
github.com/prashantv/protectmem v0.0.0-20171002184600-e20412882b3a h1:AA9vgIBDjMHPC2McaGPojgV2dcI78ZC0TLNhYCXEKH8=
|
||||
|
@ -472,9 +413,6 @@ github.com/redis/go-redis/v9 v9.0.5 h1:CuQcn5HIEeK7BgElubPP8CGtE0KakrnbBSTLjathl
|
|||
github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
|
||||
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
|
||||
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
|
||||
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
|
||||
|
@ -492,9 +430,6 @@ github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWR
|
|||
github.com/samuel/go-thrift v0.0.0-20190219015601-e8b6b52668fe/go.mod h1:Vrkh1pnjV9Bl8c3P9zH0/D4NlOHWP5d4/hF4YTULaec=
|
||||
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e h1:zWKUYT07mGmVBH+9UgnHXd/ekCK99C8EbDSAt5qsjXE=
|
||||
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e/go.mod h1:Yow6lPLSAXx2ifx470yD/nUe22Dv5vBvxK/UK9UUTVs=
|
||||
github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
|
||||
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
|
||||
github.com/sirupsen/logrus v1.0.2-0.20170726183946-abee6f9b0679/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
||||
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
|
||||
|
@ -505,7 +440,6 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS
|
|||
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
|
||||
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
|
||||
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
|
||||
github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
|
||||
github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
|
||||
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
|
||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||
|
@ -521,7 +455,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
|||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
|
@ -632,14 +565,10 @@ go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
|
|||
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4=
|
||||
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
|
@ -686,7 +615,6 @@ golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qx
|
|||
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
|
||||
golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
|
@ -737,7 +665,6 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc
|
|||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
|
@ -746,7 +673,6 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
|||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
@ -861,7 +787,6 @@ gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
|||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
|
|
@ -1,22 +1,62 @@
|
|||
# Example trigger code
|
||||
trigger: |
|
||||
import kv from 'zdravko/kv';
|
||||
import slack from 'zdravko/notify/slack';
|
||||
import incidents, { severity } from 'zdravko/incidents';
|
||||
|
||||
export default function (monitor, outcome) {
|
||||
// If the outcome is not failure, we can reset the counter.
|
||||
if (outcome.status !== 'FAILURE') {
|
||||
return kv.delete(`${monitor.name}:issues:5min`);
|
||||
// Only execute on this specific targets.
|
||||
export function filter(target) {
|
||||
return target.tags.kind === 'http';
|
||||
}
|
||||
|
||||
const count = kv.get(`${monitor.name}:issues:5min`) || 0;
|
||||
const getMinute = (date) => {
|
||||
return Math.floor(date.getTime() / 1000 / 60);
|
||||
}
|
||||
|
||||
if (count > 5) {
|
||||
slack.notify(`${monitor.name} has had more than 5 issues in the last 5 minutes`);
|
||||
const get5LastMinutes = (date) => {
|
||||
const currentMinute = getMinute(date);
|
||||
return Array.from({ length: 5 }, (_, i) => {
|
||||
const minute = currentMinute - i;
|
||||
if (minute < 0) {
|
||||
return 60 - minute;
|
||||
}
|
||||
return minute;
|
||||
});
|
||||
}
|
||||
|
||||
// This trigger will check if there were more than 5 issues in last
|
||||
// 5 minutes, if so it will create a critical incident.
|
||||
export default function (target, monitor, outcome) {
|
||||
// If the outcome is not failure, we close any potential incidents.
|
||||
if (outcome.status !== 'FAILURE') {
|
||||
incidents.close(target, monitor);
|
||||
return;
|
||||
}
|
||||
|
||||
const date = new Date();
|
||||
|
||||
let total = 0;
|
||||
for (const minute of get5LastMinutes(date)) {
|
||||
const count = kv.get(`${monitor.name}:issues:${minute}`) || 0;
|
||||
total += count;
|
||||
}
|
||||
|
||||
// If there are more than 5 issues in the last 5 minutes, create a critical incident.
|
||||
if (total > 5) {
|
||||
incidents.create(
|
||||
target,
|
||||
monitor,
|
||||
severity.CRITICAL,
|
||||
`More than 5 issues in the last 5 minutes.`,
|
||||
{ special: "tags" }
|
||||
);
|
||||
// Else we would close any potential incidents. If non exist, that's ok.
|
||||
} else {
|
||||
incidents.close(target, monitor);
|
||||
}
|
||||
|
||||
// Increment and set TTL to 5 minutes
|
||||
kv.increment(`${monitor.name}:issues:5min`, count + 1);
|
||||
const minute = getMinute(date);
|
||||
kv.increment(`${monitor.name}:issues:${minute}`, 5 * 60);
|
||||
}
|
||||
|
||||
# Example monitor code
|
||||
|
@ -30,6 +70,12 @@ check: |
|
|||
},
|
||||
};
|
||||
|
||||
export default function () {
|
||||
http.get('https://example.com');
|
||||
// Filter out only HTTP targets.
|
||||
export function filter(target) {
|
||||
return target.tags.kind === "http";
|
||||
};
|
||||
|
||||
// Execute the check on the targets.
|
||||
export default function (target) {
|
||||
http.get(target.url);
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ type IndexData struct {
|
|||
|
||||
type Check struct {
|
||||
Name string
|
||||
Visibility models.CheckVisibility
|
||||
Group string
|
||||
Status models.CheckStatus
|
||||
History *History
|
||||
|
@ -52,7 +53,7 @@ func getHistory(history []*models.CheckHistory, period time.Duration, buckets in
|
|||
|
||||
for i := 0; i < buckets; i++ {
|
||||
dateString := getDateString(time.Now().Add(period * time.Duration(-i)).Truncate(period))
|
||||
historyMap[dateString] = models.CheckUnknown
|
||||
historyMap[dateString] = models.CheckStatusUnknown
|
||||
}
|
||||
|
||||
for _, _history := range history {
|
||||
|
@ -64,12 +65,12 @@ func getHistory(history []*models.CheckHistory, period time.Duration, buckets in
|
|||
}
|
||||
|
||||
numTotal++
|
||||
if _history.Status == models.CheckSuccess {
|
||||
if _history.Status == models.CheckStatusSuccess {
|
||||
numOfSuccess++
|
||||
}
|
||||
|
||||
// skip if it is already set to failure
|
||||
if historyMap[dateString] == models.CheckFailure {
|
||||
if historyMap[dateString] == models.CheckStatusFailure {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -111,7 +112,7 @@ func (h *BaseHandler) Index(c echo.Context) error {
|
|||
timeRange = "90days"
|
||||
}
|
||||
|
||||
overallStatus := models.CheckUnknown
|
||||
overallStatus := models.CheckStatusUnknown
|
||||
statusByGroup := make(map[string]models.CheckStatus)
|
||||
|
||||
checksWithHistory := make([]*Check, len(checks))
|
||||
|
@ -132,25 +133,26 @@ func (h *BaseHandler) Index(c echo.Context) error {
|
|||
}
|
||||
|
||||
if statusByGroup[check.Group] == "" {
|
||||
statusByGroup[check.Group] = models.CheckUnknown
|
||||
statusByGroup[check.Group] = models.CheckStatusUnknown
|
||||
}
|
||||
|
||||
status := historyResult.List[len(historyResult.List)-1]
|
||||
if status.Status == models.CheckSuccess {
|
||||
if overallStatus == models.CheckUnknown {
|
||||
if status.Status == models.CheckStatusSuccess {
|
||||
if overallStatus == models.CheckStatusUnknown {
|
||||
overallStatus = status.Status
|
||||
}
|
||||
if statusByGroup[check.Group] == models.CheckUnknown {
|
||||
if statusByGroup[check.Group] == models.CheckStatusUnknown {
|
||||
statusByGroup[check.Group] = status.Status
|
||||
}
|
||||
}
|
||||
if status.Status != models.CheckSuccess && status.Status != models.CheckUnknown {
|
||||
if status.Status != models.CheckStatusSuccess && status.Status != models.CheckStatusUnknown {
|
||||
overallStatus = status.Status
|
||||
statusByGroup[check.Group] = status.Status
|
||||
}
|
||||
|
||||
checksWithHistory[i] = &Check{
|
||||
Name: check.Name,
|
||||
Visibility: check.Visibility,
|
||||
Group: check.Group,
|
||||
Status: status.Status,
|
||||
History: historyResult,
|
||||
|
|
|
@ -23,14 +23,19 @@ type UpdateTrigger struct {
|
|||
Script string `validate:"required"`
|
||||
}
|
||||
|
||||
type TriggerWithState struct {
|
||||
*models.Trigger
|
||||
State models.TriggerState
|
||||
}
|
||||
|
||||
type SettingsTriggers struct {
|
||||
*Settings
|
||||
Triggers []*models.Trigger
|
||||
Triggers []*TriggerWithState
|
||||
}
|
||||
|
||||
type SettingsTrigger struct {
|
||||
*Settings
|
||||
Trigger *models.Trigger
|
||||
Trigger *TriggerWithState
|
||||
History []*models.TriggerHistory
|
||||
}
|
||||
|
||||
|
@ -46,13 +51,22 @@ func (h *BaseHandler) SettingsTriggersGET(c echo.Context) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
triggersWithState := make([]*TriggerWithState, 0, len(triggers))
|
||||
for _, trigger := range triggers {
|
||||
triggersWithState = append(triggersWithState, &TriggerWithState{
|
||||
Trigger: trigger,
|
||||
State: models.TriggerStateActive,
|
||||
})
|
||||
}
|
||||
|
||||
return c.Render(http.StatusOK, "settings_triggers.tmpl", &SettingsTriggers{
|
||||
Settings: NewSettings(
|
||||
cc.Principal.User,
|
||||
GetPageByTitle(SettingsPages, "Triggers"),
|
||||
[]*components.Page{GetPageByTitle(SettingsPages, "Triggers")},
|
||||
),
|
||||
Triggers: triggers,
|
||||
Triggers: triggersWithState,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -66,6 +80,11 @@ func (h *BaseHandler) SettingsTriggersDescribeGET(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
triggerWithState := &TriggerWithState{
|
||||
Trigger: trigger,
|
||||
State: models.TriggerStateActive,
|
||||
}
|
||||
|
||||
return c.Render(http.StatusOK, "settings_triggers_describe.tmpl", &SettingsTrigger{
|
||||
Settings: NewSettings(
|
||||
cc.Principal.User,
|
||||
|
@ -78,7 +97,7 @@ func (h *BaseHandler) SettingsTriggersDescribeGET(c echo.Context) error {
|
|||
Breadcrumb: trigger.Name,
|
||||
},
|
||||
}),
|
||||
Trigger: trigger,
|
||||
Trigger: triggerWithState,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -101,7 +120,6 @@ func (h *BaseHandler) SettingsTriggersDisableGET(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
trigger.Status = services.TriggerStatusPaused
|
||||
err = services.UpdateTrigger(context.Background(), h.db, trigger)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -118,7 +136,6 @@ func (h *BaseHandler) SettingsTriggersEnableGET(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
trigger.Status = services.TriggerStatusActive
|
||||
err = services.UpdateTrigger(context.Background(), h.db, trigger)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -190,7 +207,6 @@ func (h *BaseHandler) SettingsTriggersCreatePOST(c echo.Context) error {
|
|||
Name: create.Name,
|
||||
Id: triggerId,
|
||||
Script: create.Script,
|
||||
Status: services.TriggerStatusActive,
|
||||
}
|
||||
|
||||
err = services.CreateTrigger(
|
||||
|
|
|
@ -23,6 +23,7 @@ type CreateCheck struct {
|
|||
WorkerGroups string `validate:"required"`
|
||||
Schedule string `validate:"required,cron"`
|
||||
Script string `validate:"required"`
|
||||
Visibility string `validate:"required,oneof=PUBLIC PRIVATE"`
|
||||
}
|
||||
|
||||
type UpdateCheck struct {
|
||||
|
@ -30,22 +31,23 @@ type UpdateCheck struct {
|
|||
WorkerGroups string `validate:"required"`
|
||||
Schedule string `validate:"required,cron"`
|
||||
Script string `validate:"required"`
|
||||
Visibility string `validate:"required,oneof=PUBLIC PRIVATE"`
|
||||
}
|
||||
|
||||
type CheckWithWorkerGroupsAndStatus struct {
|
||||
type CheckWithWorkerGroupsAndState struct {
|
||||
*models.CheckWithWorkerGroups
|
||||
Status services.CheckStatus
|
||||
State models.CheckState
|
||||
}
|
||||
|
||||
type SettingsChecks struct {
|
||||
*Settings
|
||||
Checks map[string][]*CheckWithWorkerGroupsAndStatus
|
||||
Checks map[string][]*CheckWithWorkerGroupsAndState
|
||||
CheckGroups []string
|
||||
}
|
||||
|
||||
type SettingsCheck struct {
|
||||
*Settings
|
||||
Check *CheckWithWorkerGroupsAndStatus
|
||||
Check *CheckWithWorkerGroupsAndState
|
||||
History []*models.CheckHistory
|
||||
}
|
||||
|
||||
|
@ -62,23 +64,23 @@ func (h *BaseHandler) SettingsChecksGET(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
checksWithStatus := make([]*CheckWithWorkerGroupsAndStatus, len(checks))
|
||||
checksWithState := make([]*CheckWithWorkerGroupsAndState, len(checks))
|
||||
for i, check := range checks {
|
||||
status, err := services.GetCheckStatus(context.Background(), h.temporal, check.Id)
|
||||
state, err := services.GetCheckState(context.Background(), h.temporal, check.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
checksWithStatus[i] = &CheckWithWorkerGroupsAndStatus{
|
||||
checksWithState[i] = &CheckWithWorkerGroupsAndState{
|
||||
CheckWithWorkerGroups: check,
|
||||
Status: status,
|
||||
State: state,
|
||||
}
|
||||
}
|
||||
|
||||
checkGroups := []string{}
|
||||
checksByGroup := map[string][]*CheckWithWorkerGroupsAndStatus{}
|
||||
for _, check := range checksWithStatus {
|
||||
checksByGroup := map[string][]*CheckWithWorkerGroupsAndState{}
|
||||
for _, check := range checksWithState {
|
||||
checksByGroup[check.Group] = append(checksByGroup[check.Group], check)
|
||||
if slices.Contains(checkGroups, check.Group) == false {
|
||||
if !slices.Contains(checkGroups, check.Group) {
|
||||
checkGroups = append(checkGroups, check.Group)
|
||||
}
|
||||
}
|
||||
|
@ -104,14 +106,14 @@ func (h *BaseHandler) SettingsChecksDescribeGET(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
status, err := services.GetCheckStatus(context.Background(), h.temporal, check.Id)
|
||||
status, err := services.GetCheckState(context.Background(), h.temporal, check.Id)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
checkWithStatus := &CheckWithWorkerGroupsAndStatus{
|
||||
checkWithStatus := &CheckWithWorkerGroupsAndState{
|
||||
CheckWithWorkerGroups: check,
|
||||
Status: status,
|
||||
State: status,
|
||||
}
|
||||
|
||||
history, err := services.GetCheckHistoryForCheck(context.Background(), h.db, slug)
|
||||
|
@ -165,7 +167,7 @@ func (h *BaseHandler) SettingsChecksDisableGET(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = services.SetCheckStatus(context.Background(), h.temporal, check.Id, services.CheckStatusPaused)
|
||||
err = services.SetCheckState(context.Background(), h.temporal, check.Id, models.CheckStatePaused)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -181,7 +183,7 @@ func (h *BaseHandler) SettingsChecksEnableGET(c echo.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = services.SetCheckStatus(context.Background(), h.temporal, check.Id, services.CheckStatusActive)
|
||||
err = services.SetCheckState(context.Background(), h.temporal, check.Id, models.CheckStateActive)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -198,6 +200,7 @@ func (h *BaseHandler) SettingsChecksDescribePOST(c echo.Context) error {
|
|||
WorkerGroups: strings.ToLower(strings.TrimSpace(c.FormValue("workergroups"))),
|
||||
Schedule: c.FormValue("schedule"),
|
||||
Script: script.EscapeString(c.FormValue("script")),
|
||||
Visibility: c.FormValue("visibility"),
|
||||
}
|
||||
err := validator.New(validator.WithRequiredStructEnabled()).Struct(update)
|
||||
if err != nil {
|
||||
|
@ -211,6 +214,7 @@ func (h *BaseHandler) SettingsChecksDescribePOST(c echo.Context) error {
|
|||
check.Group = update.Group
|
||||
check.Schedule = update.Schedule
|
||||
check.Script = update.Script
|
||||
check.Visibility = models.CheckVisibility(update.Visibility)
|
||||
|
||||
err = services.UpdateCheck(
|
||||
ctx,
|
||||
|
@ -280,6 +284,7 @@ func (h *BaseHandler) SettingsChecksCreatePOST(c echo.Context) error {
|
|||
WorkerGroups: strings.ToLower(strings.TrimSpace(c.FormValue("workergroups"))),
|
||||
Schedule: c.FormValue("schedule"),
|
||||
Script: script.EscapeString(c.FormValue("script")),
|
||||
Visibility: c.FormValue("visibility"),
|
||||
}
|
||||
err := validator.New(validator.WithRequiredStructEnabled()).Struct(create)
|
||||
if err != nil {
|
||||
|
@ -312,6 +317,7 @@ func (h *BaseHandler) SettingsChecksCreatePOST(c echo.Context) error {
|
|||
Id: checkId,
|
||||
Schedule: create.Schedule,
|
||||
Script: create.Script,
|
||||
Visibility: models.CheckVisibility(create.Visibility),
|
||||
}
|
||||
|
||||
err = services.CreateCheck(
|
||||
|
|
|
@ -14,14 +14,6 @@ import (
|
|||
"golang.org/x/exp/maps"
|
||||
)
|
||||
|
||||
type CheckStatus string
|
||||
|
||||
const (
|
||||
CheckStatusUnknown CheckStatus = "UNKNOWN"
|
||||
CheckStatusPaused CheckStatus = "PAUSED"
|
||||
CheckStatusActive CheckStatus = "ACTIVE"
|
||||
)
|
||||
|
||||
func getScheduleId(id string) string {
|
||||
return "check-" + id
|
||||
}
|
||||
|
@ -32,29 +24,29 @@ func CountChecks(ctx context.Context, db *sqlx.DB) (int, error) {
|
|||
return count, err
|
||||
}
|
||||
|
||||
func GetCheckStatus(ctx context.Context, temporal client.Client, id string) (CheckStatus, error) {
|
||||
func GetCheckState(ctx context.Context, temporal client.Client, id string) (models.CheckState, error) {
|
||||
schedule := temporal.ScheduleClient().GetHandle(ctx, getScheduleId(id))
|
||||
|
||||
description, err := schedule.Describe(ctx)
|
||||
if err != nil {
|
||||
return CheckStatusUnknown, err
|
||||
return models.CheckStateUnknown, err
|
||||
}
|
||||
|
||||
if description.Schedule.State.Paused {
|
||||
return CheckStatusPaused, nil
|
||||
return models.CheckStatePaused, nil
|
||||
}
|
||||
|
||||
return CheckStatusActive, nil
|
||||
return models.CheckStateActive, nil
|
||||
}
|
||||
|
||||
func SetCheckStatus(ctx context.Context, temporal client.Client, id string, status CheckStatus) error {
|
||||
func SetCheckState(ctx context.Context, temporal client.Client, id string, state models.CheckState) error {
|
||||
schedule := temporal.ScheduleClient().GetHandle(ctx, getScheduleId(id))
|
||||
|
||||
if status == CheckStatusActive {
|
||||
if state == models.CheckStateActive {
|
||||
return schedule.Unpause(ctx, client.ScheduleUnpauseOptions{Note: "Unpaused by user"})
|
||||
}
|
||||
|
||||
if status == CheckStatusPaused {
|
||||
if state == models.CheckStatePaused {
|
||||
return schedule.Pause(ctx, client.SchedulePauseOptions{Note: "Paused by user"})
|
||||
}
|
||||
|
||||
|
@ -63,7 +55,8 @@ func SetCheckStatus(ctx context.Context, temporal client.Client, id string, stat
|
|||
|
||||
func CreateCheck(ctx context.Context, db *sqlx.DB, check *models.Check) error {
|
||||
_, err := db.NamedExecContext(ctx,
|
||||
`INSERT INTO checks (id, name, "group", script, schedule) VALUES (:id, :name, :group, :script, :schedule)`,
|
||||
`INSERT INTO checks (id, name, visibility, "group", script, schedule)
|
||||
VALUES (:id, :name, :visibility, :group, :script, :schedule)`,
|
||||
check,
|
||||
)
|
||||
return err
|
||||
|
@ -71,7 +64,7 @@ func CreateCheck(ctx context.Context, db *sqlx.DB, check *models.Check) error {
|
|||
|
||||
func UpdateCheck(ctx context.Context, db *sqlx.DB, check *models.Check) error {
|
||||
_, err := db.NamedExecContext(ctx,
|
||||
`UPDATE checks SET "group"=:group, script=:script, schedule=:schedule WHERE id=:id`,
|
||||
`UPDATE checks SET visibility=:visibility, "group"=:group, script=:script, schedule=:schedule WHERE id=:id`,
|
||||
check,
|
||||
)
|
||||
return err
|
||||
|
@ -127,6 +120,7 @@ func GetCheckWithWorkerGroups(ctx context.Context, db *sqlx.DB, id string) (*mod
|
|||
SELECT
|
||||
checks.id,
|
||||
checks.name,
|
||||
checks.visibility,
|
||||
checks."group",
|
||||
checks.script,
|
||||
checks.schedule,
|
||||
|
@ -153,6 +147,7 @@ ORDER BY checks.name
|
|||
err = rows.Scan(
|
||||
&check.Id,
|
||||
&check.Name,
|
||||
&check.Visibility,
|
||||
&check.Group,
|
||||
&check.Script,
|
||||
&check.Schedule,
|
||||
|
@ -185,6 +180,7 @@ func GetChecksWithWorkerGroups(ctx context.Context, db *sqlx.DB) ([]*models.Chec
|
|||
SELECT
|
||||
checks.id,
|
||||
checks.name,
|
||||
checks.visibility,
|
||||
checks."group",
|
||||
checks.script,
|
||||
checks.schedule,
|
||||
|
@ -210,6 +206,7 @@ ORDER BY checks.name
|
|||
err = rows.Scan(
|
||||
&check.Id,
|
||||
&check.Name,
|
||||
&check.Visibility,
|
||||
&check.Group,
|
||||
&check.Script,
|
||||
&check.Schedule,
|
||||
|
|
|
@ -7,12 +7,6 @@ import (
|
|||
"github.com/jmoiron/sqlx"
|
||||
)
|
||||
|
||||
const (
|
||||
TriggerStatusUnknown models.TriggerStatus = "UNKNOWN"
|
||||
TriggerStatusPaused models.TriggerStatus = "PAUSED"
|
||||
TriggerStatusActive models.TriggerStatus = "ACTIVE"
|
||||
)
|
||||
|
||||
func CountTriggers(ctx context.Context, db *sqlx.DB) (int, error) {
|
||||
var count int
|
||||
err := db.GetContext(ctx, &count, "SELECT COUNT(*) FROM triggers")
|
||||
|
@ -21,7 +15,7 @@ func CountTriggers(ctx context.Context, db *sqlx.DB) (int, error) {
|
|||
|
||||
func CreateTrigger(ctx context.Context, db *sqlx.DB, trigger *models.Trigger) error {
|
||||
_, err := db.NamedExecContext(ctx,
|
||||
`INSERT INTO triggers (id, name, status, script) VALUES (:id, :name, :status, :script)`,
|
||||
`INSERT INTO triggers (id, name, script) VALUES (:id, :name, :script)`,
|
||||
trigger,
|
||||
)
|
||||
return err
|
||||
|
@ -29,7 +23,7 @@ func CreateTrigger(ctx context.Context, db *sqlx.DB, trigger *models.Trigger) er
|
|||
|
||||
func UpdateTrigger(ctx context.Context, db *sqlx.DB, trigger *models.Trigger) error {
|
||||
_, err := db.NamedExecContext(ctx,
|
||||
`UPDATE triggers SET script=:script, status=:status WHERE id=:id`,
|
||||
`UPDATE triggers SET script=:script WHERE id=:id`,
|
||||
trigger,
|
||||
)
|
||||
return err
|
||||
|
|
|
@ -32,12 +32,12 @@ func (w *Workflows) CheckWorkflowDefinition(ctx workflow.Context, param CheckWor
|
|||
var checkResult *activities.CheckResult
|
||||
err := workflow.ExecuteActivity(ctx, w.activities.Check, heatlcheckParam).Get(ctx, &checkResult)
|
||||
if err != nil {
|
||||
return models.CheckUnknown, err
|
||||
return models.CheckStatusUnknown, err
|
||||
}
|
||||
|
||||
status := models.CheckFailure
|
||||
status := models.CheckStatusFailure
|
||||
if checkResult.Success {
|
||||
status = models.CheckSuccess
|
||||
status = models.CheckStatusSuccess
|
||||
}
|
||||
|
||||
historyParam := activities.HealtcheckAddToHistoryParam{
|
||||
|
@ -50,9 +50,9 @@ func (w *Workflows) CheckWorkflowDefinition(ctx workflow.Context, param CheckWor
|
|||
var historyResult *activities.CheckAddToHistoryResult
|
||||
err = workflow.ExecuteActivity(ctx, w.activities.CheckAddToHistory, historyParam).Get(ctx, &historyResult)
|
||||
if err != nil {
|
||||
return models.CheckUnknown, err
|
||||
return models.CheckStatusUnknown, err
|
||||
}
|
||||
}
|
||||
|
||||
return models.CheckSuccess, nil
|
||||
return models.CheckStatusSuccess, nil
|
||||
}
|
||||
|
|
|
@ -86,6 +86,7 @@ code {
|
|||
.settings section form {
|
||||
@apply grid gap-4 grid-cols-1 sm:grid-cols-[2fr_1fr];
|
||||
}
|
||||
.settings section form select,
|
||||
.settings section form input {
|
||||
@apply h-min bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5;
|
||||
}
|
||||
|
|
|
@ -602,6 +602,10 @@ video {
|
|||
}
|
||||
}
|
||||
|
||||
.visible {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.absolute {
|
||||
position: absolute;
|
||||
}
|
||||
|
@ -1496,6 +1500,7 @@ code {
|
|||
}
|
||||
}
|
||||
|
||||
.settings section form select,
|
||||
.settings section form input {
|
||||
display: block;
|
||||
height: -moz-min-content;
|
||||
|
@ -1514,6 +1519,7 @@ code {
|
|||
color: rgb(17 24 39 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.settings section form select:focus,
|
||||
.settings section form input:focus {
|
||||
--tw-border-opacity: 1;
|
||||
border-color: rgb(59 130 246 / var(--tw-border-opacity));
|
||||
|
|
|
@ -135,7 +135,28 @@
|
|||
{{ else }}
|
||||
<span class="flex w-3 h-3 bg-gray-200 rounded-full"></span>
|
||||
{{ end }}
|
||||
<h4>{{ .Name }}</h4>
|
||||
<h4>
|
||||
{{ .Name }}
|
||||
{{ if eq .Visibility "PUBLIC" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800"
|
||||
>
|
||||
Public
|
||||
</span>
|
||||
{{ else if eq .Visibility "PRIVATE" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-fuchsia-100 text-fuchsia-800"
|
||||
>
|
||||
Private
|
||||
</span>
|
||||
{{ else }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"
|
||||
>
|
||||
Unknown
|
||||
</span>
|
||||
{{ end }}
|
||||
</h4>
|
||||
</div>
|
||||
<div class="justify-self-end text-sm">
|
||||
{{ printf "%.2f" .History.Uptime }}% uptime
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
<th scope="col">Name</th>
|
||||
<th scope="col">Visibility</th>
|
||||
<th scope="col">Worker Groups</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">State</th>
|
||||
<th scope="col">Schedule</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
|
@ -61,7 +61,7 @@
|
|||
{{ range .CheckGroups }}
|
||||
{{ $currentGroup := . }}
|
||||
<tr class="row-special">
|
||||
<th scope="row">
|
||||
<th scope="rowgroup">
|
||||
{{ . }}
|
||||
</th>
|
||||
<td></td>
|
||||
|
@ -75,21 +75,30 @@
|
|||
{{ if eq $group $currentGroup }}
|
||||
{{ range $checks }}
|
||||
<tr>
|
||||
<th scope="row">└─</th>
|
||||
<th scope="row" aria-hidden="true">└─</th>
|
||||
<th scope="row">
|
||||
{{ .Name }}
|
||||
</th>
|
||||
<td>
|
||||
{{ if eq .Visibility "PUBLIC" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-blue-100 text-blue-800"
|
||||
>
|
||||
Public
|
||||
</span>
|
||||
{{ else if eq .Visibility "PRIVATE" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-fuchsia-100 text-fuchsia-800"
|
||||
>
|
||||
Private
|
||||
</span>
|
||||
{{ else }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"
|
||||
>
|
||||
Unknown
|
||||
</span>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
{{ range .WorkerGroups }}
|
||||
|
@ -101,13 +110,13 @@
|
|||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
{{ if eq .Status "ACTIVE" }}
|
||||
{{ if eq .State "ACTIVE" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"
|
||||
>
|
||||
ACTIVE
|
||||
</span>
|
||||
{{ else if eq .Status "PAUSED" }}
|
||||
{{ else if eq .State "PAUSED" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800"
|
||||
>
|
||||
|
|
|
@ -4,7 +4,17 @@
|
|||
<label for="name">Name</label>
|
||||
<input type="text" name="name" id="name" placeholder="Github.com" />
|
||||
<p>Name of the check can be anything.</p>
|
||||
<label list="existing-groups" for="group">Check Group</label>
|
||||
<label for="visibility">Visibility</label>
|
||||
<select name="visibility" id="visibility" required>
|
||||
<option value="PUBLIC">Public</option>
|
||||
<option value="PRIVATE">Private</option>
|
||||
</select>
|
||||
<p>
|
||||
Visibility determines who can see the check. If set to
|
||||
<code>public</code>, it will be visible to everyone on the homepage.
|
||||
Otherwise it will be only visible to signed in users.
|
||||
</p>
|
||||
<label for="group">Check Group</label>
|
||||
<input
|
||||
type="text"
|
||||
name="group"
|
||||
|
@ -13,9 +23,6 @@
|
|||
value="default"
|
||||
required
|
||||
/>
|
||||
<datalist id="existing-groups">
|
||||
<option value="default"></option>
|
||||
</datalist>
|
||||
<p>
|
||||
Group checks together. This affects how they are presented on the
|
||||
homepage.
|
||||
|
@ -28,9 +35,7 @@
|
|||
placeholder="NA EU"
|
||||
required
|
||||
/>
|
||||
<p>
|
||||
Worker groups are used to distribute the check to specific workers.
|
||||
</p>
|
||||
<p>Worker groups are used to distribute the check to specific workers.</p>
|
||||
<label for="schedule">Schedule</label>
|
||||
<input
|
||||
type="text"
|
||||
|
@ -92,6 +97,7 @@
|
|||
minimap: { enabled: false },
|
||||
codeLens: false,
|
||||
contextmenu: false,
|
||||
scrollBeyondLastLine: false,
|
||||
});
|
||||
|
||||
const divElem = document.getElementById("editor");
|
||||
|
|
|
@ -2,6 +2,26 @@
|
|||
<section class="p-5">
|
||||
<form action="/settings/checks/{{ .Check.Id }}" method="post">
|
||||
<h2>Configuration</h2>
|
||||
<label for="visibility">Visibility</label>
|
||||
<select name="visibility" id="visibility" required>
|
||||
<option
|
||||
{{ if eq .Check.Visibility "PUBLIC" }}selected="selected"{{ end }}
|
||||
value="PUBLIC"
|
||||
>
|
||||
Public
|
||||
</option>
|
||||
<option
|
||||
{{ if eq .Check.Visibility "PRIVATE" }}selected="selected"{{ end }}
|
||||
value="PRIVATE"
|
||||
>
|
||||
Private
|
||||
</option>
|
||||
</select>
|
||||
<p>
|
||||
Visibility determines who can see the check. If set to
|
||||
<code>public</code>, it will be visible to everyone on the homepage.
|
||||
Otherwise it will be only visible to signed in users.
|
||||
</p>
|
||||
<label for="group">Check Group</label>
|
||||
<input
|
||||
type="text"
|
||||
|
@ -22,9 +42,7 @@
|
|||
value="{{ range .Check.WorkerGroups }}{{ . }}{{ end }}"
|
||||
required
|
||||
/>
|
||||
<p>
|
||||
Worker groups are used to distribute the check to specific workers.
|
||||
</p>
|
||||
<p>Worker groups are used to distribute the check to specific workers.</p>
|
||||
<label for="schedule">Schedule</label>
|
||||
<input
|
||||
type="text"
|
||||
|
@ -64,14 +82,14 @@
|
|||
<div class="flex md:flex-row flex-col gap-4 h-min">
|
||||
<section class="p-5 flex-1">
|
||||
<h2 class="mb-2 flex flex-row gap-2">
|
||||
Status
|
||||
{{ if eq .Check.Status "ACTIVE" }}
|
||||
State
|
||||
{{ if eq .Check.State "ACTIVE" }}
|
||||
<span
|
||||
class="self-center h-fit w-fit px-2 text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"
|
||||
>
|
||||
ACTIVE
|
||||
</span>
|
||||
{{ else if eq .Check.Status "PAUSED" }}
|
||||
{{ else if eq .Check.State "PAUSED" }}
|
||||
<span
|
||||
class="self-center h-fit w-fit px-2 text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800"
|
||||
>
|
||||
|
@ -83,13 +101,13 @@
|
|||
Pausing the check will stop it from executing. This can be useful in
|
||||
cases of expected downtime. Or when the check is not needed anymore.
|
||||
</p>
|
||||
{{ if eq .Check.Status "ACTIVE" }}
|
||||
{{ if eq .Check.State "ACTIVE" }}
|
||||
<a
|
||||
class="block text-center py-2.5 px-5 me-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100"
|
||||
href="/settings/checks/{{ .Check.Id }}/disable"
|
||||
>Pause</a
|
||||
>
|
||||
{{ else if eq .Check.Status "PAUSED" }}
|
||||
{{ else if eq .Check.State "PAUSED" }}
|
||||
<a
|
||||
class="block text-center py-2.5 px-5 me-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100"
|
||||
href="/settings/checks/{{ .Check.Id }}/enable"
|
||||
|
@ -182,6 +200,7 @@
|
|||
minimap: { enabled: false },
|
||||
codeLens: false,
|
||||
contextmenu: false,
|
||||
scrollBeyondLastLine: false,
|
||||
});
|
||||
|
||||
const divElem = document.getElementById('editor');
|
||||
|
|
|
@ -48,8 +48,9 @@
|
|||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Action</th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">State</th>
|
||||
<th scope="col">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{{ range .Triggers }}
|
||||
|
@ -58,6 +59,27 @@
|
|||
<th scope="row">
|
||||
{{ .Name }}
|
||||
</th>
|
||||
<td>
|
||||
{{ if eq .State "ACTIVE" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"
|
||||
>
|
||||
ACTIVE
|
||||
</span>
|
||||
{{ else if eq .State "PAUSED" }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800"
|
||||
>
|
||||
PAUSED
|
||||
</span>
|
||||
{{ else }}
|
||||
<span
|
||||
class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-gray-100 text-gray-800"
|
||||
>
|
||||
UNKNOWN
|
||||
</span>
|
||||
{{ end }}
|
||||
</td>
|
||||
<td>
|
||||
<a href="/settings/triggers/{{ .Id }}" class="link">Details</a>
|
||||
</td>
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
class="hidden block w-full h-96 rounded-lg border border-gray-300 overflow-hidden"
|
||||
></div>
|
||||
<p>
|
||||
Script is what determines the status of a service. You can read more
|
||||
about it on
|
||||
<a target="_blank" href="https://k6.io/docs/using-k6/http-requests/"
|
||||
>k6 documentation</a
|
||||
>.
|
||||
The trigger script executes for every matching <code>target</code>'s
|
||||
execution of <code>trigger</code>. The outcome of that
|
||||
<code>trigger</code> is passed to the script as a
|
||||
<code>outcome</code> object. Based on that the trigger script should
|
||||
decide if an incident should either be created or closed.
|
||||
</p>
|
||||
<button type="submit" onclick="save()">Create</button>
|
||||
</form>
|
||||
|
@ -52,6 +52,7 @@
|
|||
minimap: { enabled: false },
|
||||
codeLens: false,
|
||||
contextmenu: false,
|
||||
scrollBeyondLastLine: false,
|
||||
});
|
||||
|
||||
const divElem = document.getElementById("editor");
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
class="block w-full h-96 rounded-lg border border-gray-300 overflow-hidden hidden"
|
||||
></div>
|
||||
<p>
|
||||
Script is what determines the status of a service. You can read more
|
||||
about it on
|
||||
<a target="_blank" href="https://k6.io/docs/using-k6/http-requests/"
|
||||
>k6 documentation</a
|
||||
>.
|
||||
The trigger script executes for every matching <code>target</code>'s
|
||||
execution of <code>trigger</code>. The outcome of that
|
||||
<code>trigger</code> is passed to the script as a
|
||||
<code>outcome</code> object. Based on that the trigger script should
|
||||
decide if an incident should either be created or closed.
|
||||
</p>
|
||||
<button type="submit" onclick="save()">Save</button>
|
||||
</form>
|
||||
|
@ -25,13 +25,13 @@
|
|||
<section class="p-5 flex-1">
|
||||
<h2 class="mb-2 flex flex-row gap-2">
|
||||
Status
|
||||
{{ if eq .Trigger.Status "ACTIVE" }}
|
||||
{{ if eq .Trigger.State "ACTIVE" }}
|
||||
<span
|
||||
class="self-center h-fit w-fit px-2 text-xs leading-5 font-semibold rounded-full bg-green-100 text-green-800"
|
||||
>
|
||||
ACTIVE
|
||||
</span>
|
||||
{{ else if eq .Trigger.Status "PAUSED" }}
|
||||
{{ else if eq .Trigger.State "PAUSED" }}
|
||||
<span
|
||||
class="self-center h-fit w-fit px-2 text-xs leading-5 font-semibold rounded-full bg-yellow-100 text-yellow-800"
|
||||
>
|
||||
|
@ -43,13 +43,13 @@
|
|||
Pausing the trigger will stop it from executing. This can be useful in
|
||||
cases of expected downtime. Or when the trigger is not needed anymore.
|
||||
</p>
|
||||
{{ if eq .Trigger.Status "ACTIVE" }}
|
||||
{{ if eq .Trigger.State "ACTIVE" }}
|
||||
<a
|
||||
class="block text-center py-2.5 px-5 me-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100"
|
||||
href="/settings/triggers/{{ .Trigger.Id }}/disable"
|
||||
>Pause</a
|
||||
>
|
||||
{{ else if eq .Trigger.Status "PAUSED" }}
|
||||
{{ else if eq .Trigger.State "PAUSED" }}
|
||||
<a
|
||||
class="block text-center py-2.5 px-5 me-2 mb-2 text-sm font-medium text-gray-900 focus:outline-none bg-white rounded-lg border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-100"
|
||||
href="/settings/triggers/{{ .Trigger.Id }}/enable"
|
||||
|
@ -134,6 +134,7 @@
|
|||
minimap: { enabled: false },
|
||||
codeLens: false,
|
||||
contextmenu: false,
|
||||
scrollBeyondLastLine: false,
|
||||
});
|
||||
|
||||
const divElem = document.getElementById('editor');
|
||||
|
|
Loading…
Reference in a new issue