There's a request to standardize that a collection's <database.collection> string representation are logged with the attribute key "namespace". Additionally, it's often useful to have the associated UUID. While it's unlikely we can completely codify that a mistake never happens, the following helpers would go a long way by making it easier to log the right thing than the wrong thing:
Instead of being forced to type, e.g:
LOGV2(0, "Dropping collection", "namespace"_attr = collection->ns(), "uuid"_attr = collection->uuid());
The following example API (not the mandated solution) would be easier and safer:
LOGV2(0, "Dropping collection", Attr(collection));
Additionally, some methods don't have collection objects, but `Namespace` objects. Having those transformed (without the UUID component) would also be beneficial.
Note there are some more complicated, but uncommon scenarios that may not be worth covering. Such as log lines for renaming collections that can include source/target and temporary collections. The suggested guidance for those cases is to log sourceNamespace and targetNamespace. Having that possible would be a win, but not a requirement.
- related to
-
SERVER-57680 Use namespace instead of nss for naming log attributes
- Closed