Repository navigation
rgw/notification: add rgw notification specific debug log subsystem - #56008
Conversation
db07f93 to
c6ddda9
Compare
There was a problem hiding this comment.
please avoid using the plus operator for string formatting, as there will be a new temporary std::string for each operation.
consider:
std::string::append()std::stringstreamwith<<operator- or the
fmtlibrary similar tostd::format(would suggest that)
c6ddda9 to
696cb0e
Compare
There was a problem hiding this comment.
nit: since this was made for dout, consider using a stream output operator to avoid allocating the temporary std::string
std::ostream& operator<<(std::ostream& out, const event_entry_t& e) {
return out << "endpoint: '" << e.push_endpoint
<< "', bucket_owner: '" << e.event.bucket_ownerIdentity
<< "', bucket: '" << e.event.bucket_name
<< "', object: '" << e.event.object_key
<< "', event: '" << e.event.eventName << "'";
}There was a problem hiding this comment.
I think that's discretely more costly than fmt?
There was a problem hiding this comment.
all of these arguments appear to be strings, so operator<< is just copying each of them directly into the streambuf
while fmt may be better optimized for formatting things like ints/floats, i don't see what advantage it offers here that would outweigh the cost of memory allocation
if we wanted the end result in a std::string that we'd have to allocate anyway, then the fmt version is surely better than formatting with a stringstream
but because we're streaming this result like << get_event_detail_str(event_entry) <<, the use of fmt here seems like an anti-pattern
There was a problem hiding this comment.
there might be a way to get fmt::format_to() to copy directly to our streambuf too? that could be the best of both worlds
There was a problem hiding this comment.
@cbodley, overloaded the operator<< for struct event_entry_t
decorate the events with event details while logging. Signed-off-by: kchheda3 <[email protected]>
696cb0e to
4299679
Compare
Add new log subsystem for rgw notification.
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard cephadmjenkins test apijenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume toxjenkins test windowsjenkins test rook e2e