Aryan Gupta
07/08/2025, 4:22 PMAttributes
can be used to pass custom data throughout the request lifecycle. When using the OkHttpEngine
, I'm looking for a way to map these Ktor Attributes
to OkHttp Tags
.
As the current OkHttpEngine
implementation within KTOR doesn't seem to bridge this , how can I achieve this mapping?Aleksei Tirman [JB]
07/09/2025, 9:19 AMAryan Gupta
07/09/2025, 3:18 PMMap<String, Any>
as a custom analytics container to a Ktor request. This map might store:
• DNS lookup time
• TLS handshake duration
• Connection establishment time
• Or even application-level metadata
At any point, whether inside a Ktor plugin or OkHttp interceptor or in the okhttp event listener callbacks , we should be able to:
1. Add or update values like "dnsLatency" -> 1.2s"
2. Access this map through request.tag()
in OkHttp
This bridge between Ktor Attributes
and OkHttp Tags
allows developers to attach analytics or other contextual metadata to a request and access it across different layers (Ktor and OkHttp). This is especially useful for observability, debugging, and fine-grained request monitoring.
Also in current okhttp engine implementation , HttpRequestData have attributes only mapping this to okhttp tag is missingAryan Gupta
07/09/2025, 3:18 PMAleksei Tirman [JB]
07/11/2025, 8:35 AMAryan Gupta
07/11/2025, 2:45 PMAryan Gupta
07/11/2025, 3:18 PM