@@ -83,34 +83,36 @@ func (fp *FilePlugin) Info() *bus.Info {
8383
8484// nolint: cyclop, revive
8585func (fp * FilePlugin ) Process (ctx context.Context , msg * bus.Message ) {
86+ ctxWithMetadata := fp .config .NewContextWithLabels (ctx )
87+
8688 if logger .ServerType (ctx ) == "" {
87- ctx = context .WithValue (
88- ctx ,
89+ ctxWithMetadata = context .WithValue (
90+ ctxWithMetadata ,
8991 logger .ServerTypeContextKey , slog .Any (logger .ServerTypeKey , fp .serverType .String ()),
9092 )
9193 }
9294
93- if logger .ServerType (ctx ) == fp .serverType .String () {
95+ if logger .ServerType (ctxWithMetadata ) == fp .serverType .String () {
9496 switch msg .Topic {
9597 case bus .ConnectionResetTopic :
96- fp .handleConnectionReset (ctx , msg )
98+ fp .handleConnectionReset (ctxWithMetadata , msg )
9799 case bus .ConnectionCreatedTopic :
98- slog .DebugContext (ctx , "File plugin received connection created message" )
100+ slog .DebugContext (ctxWithMetadata , "File plugin received connection created message" )
99101 fp .fileManagerService .SetIsConnected (true )
100102 case bus .NginxConfigUpdateTopic :
101- fp .handleNginxConfigUpdate (ctx , msg )
103+ fp .handleNginxConfigUpdate (ctxWithMetadata , msg )
102104 case bus .ConfigUploadRequestTopic :
103- fp .handleConfigUploadRequest (ctx , msg )
105+ fp .handleConfigUploadRequest (ctxWithMetadata , msg )
104106 case bus .ConfigApplyRequestTopic :
105- fp .handleConfigApplyRequest (ctx , msg )
107+ fp .handleConfigApplyRequest (ctxWithMetadata , msg )
106108 case bus .ConfigApplyCompleteTopic :
107- fp .handleConfigApplyComplete (ctx , msg )
109+ fp .handleConfigApplyComplete (ctxWithMetadata , msg )
108110 case bus .ConfigApplySuccessfulTopic :
109- fp .handleConfigApplySuccess (ctx , msg )
111+ fp .handleConfigApplySuccess (ctxWithMetadata , msg )
110112 case bus .ConfigApplyFailedTopic :
111- fp .handleConfigApplyFailedRequest (ctx , msg )
113+ fp .handleConfigApplyFailedRequest (ctxWithMetadata , msg )
112114 default :
113- slog .DebugContext (ctx , "File plugin received unknown topic" , "topic" , msg .Topic )
115+ slog .DebugContext (ctxWithMetadata , "File plugin received unknown topic" , "topic" , msg .Topic )
114116 }
115117 }
116118}
0 commit comments