CallId

A plugin that allows you to trace client requests end-to-end by using unique request IDs or call IDs. Typically, working with a call ID in the Ktor client might look as follows:

  1. First, you need to obtain a call ID for a specific request in one of the following ways:

    • A calling scope may already have a call ID in its coroutine context.

    • Otherwise, if a scope comes without a call ID, you can generate it.

  2. The plugin will add a call ID to the coroutine context for this call. Usually, it's done in the specific header, such as HttpHeaders.XRequestId.

The default behavior of this plugin is to take a call ID from the coroutine context and add it to the HttpHeaders.XRequestId. See CallIdConfig if you want to change it.

You can learn more from CallId.