feat: publish standalone worker
Separate worker packaging and service lifecycle from the control plane.
Этот коммит содержится в:
39
checks/cudp/result.go
Обычный файл
39
checks/cudp/result.go
Обычный файл
@@ -0,0 +1,39 @@
|
||||
package cudp
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"rsgit.ru/rsmon/rsmon/app/models"
|
||||
"rsgit.ru/rsmon/rsmon/internal/checkresult"
|
||||
)
|
||||
|
||||
// Result is the outcome of a single UDP check. It embeds
|
||||
// checkresult.CheckResult and adds the resolved address so logs /
|
||||
// metrics can show what was probed.
|
||||
type Result struct {
|
||||
checkresult.CheckResult
|
||||
RemoteAddr string
|
||||
}
|
||||
|
||||
// InfluxFields reports the dial+probe duration in milliseconds — same
|
||||
// convention as chttp / cping / ctcp.
|
||||
func (r *Result) InfluxFields() map[string]interface{} {
|
||||
ret := make(map[string]interface{}, 0)
|
||||
ret["took"] = int64(r.Duration / time.Millisecond)
|
||||
return ret
|
||||
}
|
||||
|
||||
// InfluxTags returns the standard set of tags used by chttp / cping /
|
||||
// ctcp. The "state" tag is the final Result.State set by Perform().
|
||||
func (r *Result) InfluxTags(c models.Check) map[string]string { //nolint:gocritic // hugeParam: accepted for interface compatibility
|
||||
ret := make(map[string]string, 0)
|
||||
ret["check"] = strconv.FormatInt(c.ID, 10)
|
||||
ret["state"] = r.State
|
||||
if r.Error != nil {
|
||||
ret["error"] = r.Error.Error()
|
||||
}
|
||||
ret["warnings"] = strings.Join(r.Warnings, ",")
|
||||
return ret
|
||||
}
|
||||
Ссылка в новой задаче
Block a user