lab7: BROKER_URL из окружения, Redis operator для регрессии ACL, исправления тестов, no-new-privileges tempo-init; перенос исправлений lab6
This commit is contained in:
@@ -83,7 +83,7 @@ func Load() Config {
|
||||
S3SecretKey: readSecretFile("S3_SECRET_ACCESS_KEY_FILE"),
|
||||
MaxUploadBytes: int64(getInt("MAX_UPLOAD_BYTES", 10*1024*1024)),
|
||||
MaxImagePixels: int64(getInt("MAX_IMAGE_PIXELS", 40_000_000)),
|
||||
BrokerURL: readSecretFile("BROKER_URL_FILE"),
|
||||
BrokerURL: firstNonEmpty(getEnv("BROKER_URL", ""), readSecretFile("BROKER_URL_FILE")), // lab7: amqps без пароля (EXTERNAL)
|
||||
PipelineVersion: max(1, getInt("PIPELINE_VERSION", 1)),
|
||||
JobMaxAttempts: max(1, getInt("JOB_MAX_ATTEMPTS", 5)),
|
||||
JobTimeout: time.Duration(max(5, getInt("JOB_TIMEOUT_SECONDS", 60))) * time.Second,
|
||||
@@ -174,3 +174,12 @@ func parseDuration(s string) time.Duration {
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func firstNonEmpty(v ...string) string {
|
||||
for _, x := range v {
|
||||
if x != "" {
|
||||
return x
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -79,6 +79,10 @@ func Telemetry(next http.Handler) http.Handler {
|
||||
attribute.String("request_id", httputil.RequestIDFrom(r.Context())),
|
||||
))
|
||||
defer span.End()
|
||||
if sc := span.SpanContext(); sc.IsSampled() {
|
||||
// W3C Trace Context Level 2: клиент (и тест) получает ID трассы своего запроса.
|
||||
w.Header().Set("traceresponse", "00-"+sc.TraceID().String()+"-"+sc.SpanID().String()+"-01")
|
||||
}
|
||||
methodAttr := attribute.String("http.request.method", r.Method)
|
||||
inflight.Add(ctx, 1, metric.WithAttributes(methodAttr))
|
||||
defer inflight.Add(ctx, -1, metric.WithAttributes(methodAttr))
|
||||
|
||||
Reference in New Issue
Block a user