/
types.go
113 lines (92 loc) · 3.2 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package metrics
import "time"
// NextEnum could be the state ended, transitioned or retried.
type NextEnum int
const (
// NextEnd the state has ended.
NextEnd NextEnum = iota // State has ended
// NextTransition the state has transitioned.
NextTransition // State transitioned
// NextRetry the state has retried.
NextRetry // State retried
)
// NextEnums an array of all the NextEnum.
var NextEnums = []NextEnum{
NextEnd, NextTransition, NextRetry,
}
// InvokerEnum the enum for what invoked the workflow.
type InvokerEnum int
const (
// InvokerUnknown if the invoker is unknown.
InvokerUnknown InvokerEnum = iota
)
// InvokerEnumLabels an array of all the InvokerEnum.
var InvokerEnumLabels = map[InvokerEnum]string{
InvokerUnknown: "unknown",
}
// InsertRecordArgs ..
type InsertRecordArgs struct {
Namespace string
Workflow string
Instance string
State string
WorkflowMilliSeconds int64
IsolateMilliSeconds int64
ErrorCode string
Invoker string
Next NextEnum
Transition string
}
// GetMetricsArgs ..
type GetMetricsArgs struct {
Namespace string
Workflow string
Since time.Time
}
// Dataset ..
type Dataset struct {
TotalInstancesRun int32 `json:"totalInstancesRun"`
TotalInstanceMilliSeconds int32 `json:"totalInstanceMilliseconds"`
SuccessfulExecutions int32 `json:"successfulExecutions"`
FailedExecutions int32 `json:"failedExecutions"`
ErrorCodes map[string]int32 `json:"errorCodes"`
ErrorCodesRepresentation map[string]float32 `json:"errorCodesRepresentation"`
SampleSize int32 `json:"sampleSize"`
MeanInstanceMilliSeconds int32 `json:"avgInstanceMilliseconds"`
SuccessRate float32 `json:"successRate"`
FailureRate float32 `json:"failureRate"`
States []StateData `json:"states" toml:"states"`
}
// StateData ..
type StateData struct {
Name string `json:"name"`
Invokers map[string]int32 `json:"invokers"`
InvokersRepresentation map[string]float32
TotalExecutions int32 `json:"totalExecutions"`
TotalMilliSeconds int32 `json:"totalMilliseconds"`
TotalSuccesses int32 `json:"totalSuccesses"`
TotalFailures int32 `json:"totalFailures"`
UnhandledErrors map[string]int32 `json:"unhandledErrors"`
UnhandledErrorsRepresentation map[string]float32 `json:"unhandledErrorsRepresentation"`
TotalRetries int32 `json:"totalRetries"`
Outcomes struct {
EndStates struct {
Success int32 `json:"success"`
Failure int32 `json:"failure"`
} `json:"endStates"`
Transitions map[string]int32 `json:"transitions"`
} `json:"outcomes"`
MeanExecutionsPerInstance int32 `json:"avgExecutionsPerInstance"`
MeanMilliSecondsPerInstance int32 `json:"avgSecondsPerInstance"`
SuccessRate float32 `json:"successRate"`
FailureRate float32 `json:"failureRate"`
MeanRetries float32 `json:"avgRetries"`
MeanOutcomes struct {
EndStates struct {
Success float32 `json:"success"`
Failure float32 `json:"failure"`
} `json:"endStates"`
Transitions map[string]float32 `json:"transitions"`
} `json:"avgOutcomes"`
totalUnhandledErrors int32
}