This commit is contained in:
Vladislav Kunetskiy
2026-11-05 20:33:31 +03:00
parent edc2a405ee
commit b303db2d62
194 changed files with 10047 additions and 3831 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)
}