We have created an attribute like this: ```val raw...
# ktor
j
We have created an attribute like this:
Copy code
val rawRouteAttribute = AttributeKey<String>("rawRouteAttribute")
environment.monitor.subscribe(Routing.RoutingCallStarted) { call ->
    call.attributes.put(rawRouteAttribute, call.route.parent.toString())
}
and then retrieving it back in the
CallLogging
plugin. But when looking at java flight recording, we can see that in our call logging plugin we get a few
java.lang.IllegalStateException
exceptions and with the message of
No instance for key AttributeKey: rawRouteAttribute
. I'm wondering in what cases does ktor use the
CallLogging
plugin but not fire a
RoutingCallStarted
event?
a
Ktor fires the
RoutingCallStarted
event only when one of the routes is resolved. So you might get the
IllegalStateException
when the server responds with an implicit 404 status code.
👍 1
j
Makes sense. So basically internet bots spamming random urls 😛