From 07a613b6a648e71e1627f866a9b53875ef0e9a7c Mon Sep 17 00:00:00 2001
From: OZGCloud <ozgcloud@mgm-tp.com>
Date: Thu, 24 Oct 2024 11:51:44 +0200
Subject: [PATCH] OZG-6668 OZG-7019 add client name to grpc calls

---
 internal/server/grpc_router.go | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/internal/server/grpc_router.go b/internal/server/grpc_router.go
index 09559ce..359f0c8 100644
--- a/internal/server/grpc_router.go
+++ b/internal/server/grpc_router.go
@@ -40,6 +40,9 @@ import (
 	"net"
 )
 
+const keyClientName = "CLIENT_NAME-bin"
+const clientName = "FachstellenServer"
+
 type collaborationRouter struct {
 	pb.UnimplementedCollaborationServiceServer
 }
@@ -57,6 +60,7 @@ func (s *collaborationRouter) FindVorgang(ctx context.Context, in *pb.GrpcFindVo
 }
 
 func (s *collaborationRouter) handleRequest(ctx context.Context, handler func(pb.CollaborationServiceClient, context.Context) (interface{}, error)) (interface{}, error) {
+	ctx = metadata.AppendToOutgoingContext(ctx, keyClientName, clientName)
 	md, ok := metadata.FromIncomingContext(ctx)
 	if !ok {
 		return nil, status.Error(codes.InvalidArgument, "unable to retrieve metadata")
-- 
GitLab