MONGOC_CLIENT_SET_APM_CALLBACKS(3)

✨ MONGOC_CLIENT_SET_APM_CALLBACKS ✨

okay bestie, so this is a libmongoc page and it's literally all about hooking your callbacks into the Application Performance Monitoring event stream πŸ‘‘

πŸ’« SYNOPSIS πŸ’«

bool
mongoc_client_set_apm_callbacks (mongoc_client_t *client,
                                 mongoc_apm_callbacks_t *callbacks,
                                 void *context);

🌸 DESCRIPTION 🌸

So basically you're registering a whole little set of callbacks so you can receive Application Performance Monitoring events β€” the vibe check of your database traffic, ykwim? πŸ’…

Here's the part that eats: the callbacks are copied by the client, so you can safely destroy them yourself after this API call finishes. No cap, your mongoc_apm_callbacks_t is not on the hook for anything after that. 🫢

But the context? That's a different story. If you pass a context, it is the application's responsibility to ensure context remains valid for the lifetime of the client. So like... don't free it, don't let it go out of scope, just keep it alive, bestie 😭 It's giving main character energy but with a long-term commitment.

πŸŽ€ PARAMETERS πŸŽ€

  • client β€” a mongoc_client_t. The client in question, your icon, your fave.
  • callbacks β€” optional mongoc_apm_callbacks_t. ✨ Pass NULL to clear all callbacks. ✨ Yes, NULL is the "nvm, forget everything I said" option and honestly we respect it.
  • context β€” optional pointer to include with each event notification. Optional, but if you bring it, you're keeping it 🧚

⭐ RETURNS ⭐

Returns true on success. Slay πŸ’–

If any arguments are invalid, returns false and logs an error. So if you get false, it's not you being dramatic, something's genuinely wrong πŸ™ˆ

fr fr, check your arguments before you blame the library.

πŸ‘€ SEE ALSO πŸ‘€

  • Introduction to Application Performance Monitoring

πŸ¦‹ AUTHOR πŸ¦‹

MongoDB, Inc β€” the icon, the legend, the whole team 🌈

2009-present, MongoDB, Inc.


and that's the whole page, bestie!! πŸ“ no skips, no notes. this one's from libmongoc version 2.5.6, dated Oct 09, 2025, brought to you by MongoDB, Inc. β€” mwah πŸ’‹ periodt. πŸ”₯

πŸ“¦ where this page comes from