summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-08-18 16:13:49 +0300
committerValery Piashchynski <[email protected]>2021-08-18 16:13:49 +0300
commitc35fbff05205330ab8e49f6008fdbd59128cee14 (patch)
treed3eb03e8db7231d97ae4ff1d60a0c5a50db8a6fb /pkg
parent1d092e57afb55a01283b41942ca3ef15a7e4bdef (diff)
Add prometheus metrics for the jobs, update tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/bst/bst.go2
-rw-r--r--pkg/events/jobs_events.go8
-rw-r--r--pkg/state/job/state.go2
-rw-r--r--pkg/worker_handler/errors.go1
-rw-r--r--pkg/worker_handler/errors_windows.go1
5 files changed, 8 insertions, 6 deletions
diff --git a/pkg/bst/bst.go b/pkg/bst/bst.go
index f8426b12..dab9346c 100644
--- a/pkg/bst/bst.go
+++ b/pkg/bst/bst.go
@@ -88,7 +88,7 @@ func (b *BST) Remove(uuid string, topic string) {
b.removeHelper(uuid, topic, nil)
}
-func (b *BST) removeHelper(uuid string, topic string, parent *BST) { //nolint:gocognit
+func (b *BST) removeHelper(uuid string, topic string, parent *BST) {
curr := b
for curr != nil {
if topic < curr.topic { //nolint:gocritic
diff --git a/pkg/events/jobs_events.go b/pkg/events/jobs_events.go
index 300f6748..f65ede67 100644
--- a/pkg/events/jobs_events.go
+++ b/pkg/events/jobs_events.go
@@ -6,7 +6,7 @@ import (
const (
// EventPushOK thrown when new job has been added. JobEvent is passed as context.
- EventPushOK = iota + 12000
+ EventPushOK J = iota + 12000
// EventPushError caused when job can not be registered.
EventPushError
@@ -58,6 +58,8 @@ func (ev J) String() string {
return "EventPipeError"
case EventDriverReady:
return "EventDriverReady"
+ case EventPipePaused:
+ return "EventPipePaused"
}
return UnknownEventType
}
@@ -67,16 +69,12 @@ type JobEvent struct {
Event J
// String is job id.
ID string
-
// Pipeline name
Pipeline string
-
// Associated driver name (amqp, ephemeral, etc)
Driver string
-
// Error for the jobs/pipes errors
Error error
-
// event timings
Start time.Time
Elapsed time.Duration
diff --git a/pkg/state/job/state.go b/pkg/state/job/state.go
index d90118c3..56050084 100644
--- a/pkg/state/job/state.go
+++ b/pkg/state/job/state.go
@@ -14,4 +14,6 @@ type State struct {
Delayed int64
// Reserved jobs which are in the driver but not consumed yet
Reserved int64
+ // Status - 1 Ready, 0 - Paused
+ Ready bool
}
diff --git a/pkg/worker_handler/errors.go b/pkg/worker_handler/errors.go
index 5fa8e64e..c3352a52 100644
--- a/pkg/worker_handler/errors.go
+++ b/pkg/worker_handler/errors.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
package handler
diff --git a/pkg/worker_handler/errors_windows.go b/pkg/worker_handler/errors_windows.go
index 390cc7d1..3c6c2186 100644
--- a/pkg/worker_handler/errors_windows.go
+++ b/pkg/worker_handler/errors_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
package handler