This commit is contained in:
Vladislav Kunetskiy
2026-11-05 20:21:39 +03:00
parent edc2a405ee
commit 71fbb4b321
129 changed files with 10027 additions and 170 deletions
+10
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"regexp"
"time"
"github.com/google/uuid"
@@ -120,9 +121,18 @@ func (m JobMessage) Validate() error {
return errors.New("created_at is required")
}
if m.Traceparent != "" && !traceparentPattern.MatchString(m.Traceparent) {
return errors.New("traceparent does not match W3C format")
}
if len(m.Tracestate) > 512 {
return errors.New("tracestate is too long")
}
return nil
}
var traceparentPattern = regexp.MustCompile(`^00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$`)
func (m JobMessage) MarshalPayload() ([]byte, error) {
return json.Marshal(m)
}