lab6: OpenTelemetry (traces, metrics, logs), Collector, Prometheus, Loki, Tempo, Grafana; перенос trace context через outbox и AMQP

This commit is contained in:
2026-11-12 12:10:30 +03:00
parent 470d9d6f1e
commit 010739d9fa
118 changed files with 15009 additions and 3 deletions
+23
View File
@@ -0,0 +1,23 @@
package service
import (
"crypto/rand"
"fmt"
"time"
)
func newID() string {
var b [16]byte
if _, err := rand.Read(b[:]); err != nil {
panic(fmt.Sprintf("crypto/rand failed: %v", err))
}
b[6] = (b[6] & 0x0f) | 0x40
b[8] = (b[8] & 0x3f) | 0x80
return fmt.Sprintf("%x-%x-%x-%x-%x", b[0:4], b[4:6], b[6:8], b[8:10], b[10:16])
}
// nowUTC возвращает время UTC с точностью до секунд.
// PostgreSQL и Python-клиент тестов ожидают формат без наносекунд.
func nowUTC() time.Time {
return time.Now().UTC().Truncate(time.Second)
}