Litote / kmongo

[deprecated] KMongo - a Kotlin toolkit for Mongo
https://litote.org/kmongo/
Apache License 2.0
781 stars 74 forks source link

Add client metadata for KMongo #369

Closed jyemin closed 2 years ago

jyemin commented 2 years ago

Currently, applications using KMongo will report the Java driver in client metadata in server logs, e.g.

{... "msg":"client metadata","attr":{"remote":"127.0.0.1:58064","client":"conn17","doc":{"driver":{"name":"mongo-java-driver|sync","version":"4.7.1"},"os":{"type":"Darwin","name":"Mac OS X","architecture":"x86_64","version":"12.5.1"},"platform":"Java/Oracle Corporation/17+35-LTS-2724"}}}

With a small change to KMongo, it will report as

{... "msg":"client metadata","attr":{"remote":"127.0.0.1:58064","client":"conn17","doc":{"driver":{"name":"mongo-java-driver|sync|kmongo","version":"4.7.1"},"os":{"type":"Darwin","name":"Mac OS X","architecture":"x86_64","version":"12.5.1"},"platform":"Java/Oracle Corporation/17+35-LTS-2724|Kotlin/1.7.10"}}}

which could be beneficial for users trying to track which connections come from which applications.