feat: include X-WOPI-SessionId header in the logs and tracing

This commit is contained in:
Juan Pablo Villafáñez
2024-08-06 13:36:25 +02:00
parent 083a2e1484
commit eb40aa0460
2 changed files with 2 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ func CollaborationTracingMiddleware(next http.Handler) http.Handler {
wopiUser := wopiContext.User.GetId()
attrs := []attribute.KeyValue{
attribute.String("ocis.wopi.sessionid", r.Header.Get("X-WOPI-SessionId")),
attribute.String("ocis.wopi.method", wopiMethod),
attribute.String("ocis.wopi.resource.id.storage", wopiFile.GetResourceId().GetStorageId()),
attribute.String("ocis.wopi.resource.id.opaque", wopiFile.GetResourceId().GetOpaqueId()),

View File

@@ -90,6 +90,7 @@ func WopiContextAuthMiddleware(cfg *config.Config, next http.Handler) http.Handl
// although some headers might not be sent depending on the client.
logger := zerolog.Ctx(ctx)
ctx = logger.With().
Str("WopiSessionId", r.Header.Get("X-WOPI-SessionId")).
Str("WopiOverride", r.Header.Get("X-WOPI-Override")).
Str("WopiProof", r.Header.Get("X-WOPI-Proof")).
Str("WopiProofOld", r.Header.Get("X-WOPI-ProofOld")).