Skip to content

Commit

Permalink
hive: cast ModuleID to string
Browse files Browse the repository at this point in the history
The pkg/metrics logging hook explicitly wants a string, not a newtype of
string, hence it complained the type of the subsys field for
module-decorated logrus loggers with unformatted loglines like:

Failed to fire hook: type of the 'subsystem' log entry field is not string but cell.ModuleID

Fixes: 2311f3d (treewide: rebase on cilium/hive)

Reported-by: Joe Stringer <joe@cilium.io>
Signed-off-by: David Bimmler <david.bimmler@isovalent.com>
  • Loading branch information
bimmlerd authored and joestringer committed May 7, 2024
1 parent eb2a6a2 commit 2928947
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/hive/hive.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func New(cells ...cell.Cell) *Hive {
// Scope logging and health by module ID.
moduleDecorators := []cell.ModuleDecorator{
func(log logrus.FieldLogger, mid cell.ModuleID) logrus.FieldLogger {
return log.WithField(logfields.LogSubsys, mid)
return log.WithField(logfields.LogSubsys, string(mid))
},
func(hp healthTypes.Provider, fmid cell.FullModuleID) cell.Health {
return hp.ForModule(fmid)
Expand Down

0 comments on commit 2928947

Please sign in to comment.