Another question that is bugging me. In `ktor-serv...
# ktor
s
Another question that is bugging me. In
ktor-server-call-logging
https://github.com/ktorio/ktor/blob/main/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/callloging/MDCProvider.kt#L12 Here mdc entries are registered in the plugin registry, but I couldn’t find out where they are extracted again back from the plugin registry to be used (they are however used from the pluginConfig, so I don’t see why these are being registered in pluginRegistry). Is this code redundant or is there any magic that I cant see 😅 ?
s
Ah I see. but eventually, all entries are evaluated for each call and its attributes, i guess ? So If I register my attributes in pluginRegistry, will they be automatically be applied to each
call
instance, thus removing the need to set them up in CallSetup hook ?
Just trying to fish out the relevance of pluginRegistry, and possible usage of it 🙂
a
Could you please describe what problem are you trying to solve with the pluginRegistry?
s
Actually, I don't really have a use case. I wasn't aware about something like pluginRegistry. So I wanted to know more about it. Seems like a good way to register attributes that needs to be provided once and evaluated per call instance. So I wanted to know more about it, the thought process behind it.
a
Generally, the plugin registry is used to store instances of installed plugins.
You can store attributes in the
Application.attributes
if you want to share data for all calls.