Skip to content

rgw/notification: add rgw notification specific debug log subsystem - #56008

Merged
cbodley merged 1 commit into
ceph:mainfrom
kchheda3:wip-notification-subsys
Mar 21, 2024
Merged

cbodley merged 1 commit into
ceph:mainfrom
kchheda3:wip-notification-subsys

Conversation

@kchheda3

@kchheda3 kchheda3 commented Mar 6, 2024 •

Copy link
Copy Markdown
Contributor

Add new log subsystem for rgw notification.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@kchheda3 kchheda3 changed the title wip-notification-subsys rgw/notification: add rgw notification specific debug log subsystem Mar 6, 2024
@kchheda3 kchheda3 self-assigned this Mar 6, 2024
@kchheda3
kchheda3 requested a review from yuvalif March 6, 2024 23:16
@kchheda3
kchheda3 force-pushed the wip-notification-subsys branch from db07f93 to c6ddda9 Compare March 6, 2024 23:18
@kchheda3
kchheda3 marked this pull request as ready for review March 6, 2024 23:19
@kchheda3
kchheda3 requested review from a team as code owners March 6, 2024 23:19
Comment thread src/rgw/driver/rados/rgw_notify.cc Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::stringstream with << operator
  • or the fmt library similar to std::format (would suggest that)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@kchheda3
kchheda3 force-pushed the wip-notification-subsys branch from c6ddda9 to 696cb0e Compare March 12, 2024 17:07
@kchheda3
kchheda3 requested a review from yuvalif March 12, 2024 17:07
Comment thread src/rgw/driver/rados/rgw_notify.cc Outdated
Comment on lines 106 to 114

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 << "'";
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's discretely more costly than fmt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbodley, overloaded the operator<< for struct event_entry_t

decorate the events with event details while logging.

Signed-off-by: kchheda3 <[email protected]>
@kchheda3
kchheda3 force-pushed the wip-notification-subsys branch from 696cb0e to 4299679 Compare March 19, 2024 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants