mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Use sync.Pool for logger Messages
This reduces allocs and bytes used per log entry significantly as well as some improvement to time per log operation. Each log driver, however, must put messages back in the pool once they are finished with the message. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
parent
054abff3b6
commit
3f4fccb65f
14 changed files with 74 additions and 25 deletions
|
|
@ -336,7 +336,7 @@ func (l *splunkLoggerInline) Log(msg *logger.Message) error {
|
|||
event.Source = msg.Source
|
||||
|
||||
message.Event = &event
|
||||
|
||||
logger.PutMessage(msg)
|
||||
return l.queueMessageAsync(message)
|
||||
}
|
||||
|
||||
|
|
@ -354,7 +354,7 @@ func (l *splunkLoggerJSON) Log(msg *logger.Message) error {
|
|||
event.Source = msg.Source
|
||||
|
||||
message.Event = &event
|
||||
|
||||
logger.PutMessage(msg)
|
||||
return l.queueMessageAsync(message)
|
||||
}
|
||||
|
||||
|
|
@ -362,7 +362,7 @@ func (l *splunkLoggerRaw) Log(msg *logger.Message) error {
|
|||
message := l.createSplunkMessage(msg)
|
||||
|
||||
message.Event = string(append(l.prefix, msg.Line...))
|
||||
|
||||
logger.PutMessage(msg)
|
||||
return l.queueMessageAsync(message)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue