File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 4
4
"context"
5
5
"encoding/json"
6
6
7
+ "github.com/DefangLabs/defang/src/pkg"
7
8
"github.com/DefangLabs/defang/src/pkg/term"
8
9
"github.com/bufbuild/connect-go"
9
10
)
@@ -16,6 +17,10 @@ type grpcLogger struct {
16
17
17
18
func (g grpcLogger ) WrapUnary (next connect.UnaryFunc ) connect.UnaryFunc {
18
19
return func (ctx context.Context , req connect.AnyRequest ) (connect.AnyResponse , error ) {
20
+ // Add a request ID to the context
21
+ requestId := pkg .RandomID ()
22
+ req .Header ().Add ("X-Request-Id" , requestId )
23
+
19
24
// Get the request type name
20
25
reqType := req .Spec ().Procedure
21
26
@@ -30,7 +35,7 @@ func (g grpcLogger) WrapUnary(next connect.UnaryFunc) connect.UnaryFunc {
30
35
payload = append (payload [:maxPayloadLength ], []byte ("…" )... )
31
36
}
32
37
33
- term .Debug (g .prefix , reqType , string (payload ))
38
+ term .Debug (g .prefix , requestId , reqType , string (payload ))
34
39
return next (ctx , req )
35
40
}
36
41
}
You can’t perform that action at this time.
0 commit comments