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 Ktor might look as follows:

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

    • A reverse proxy (such as Nginx) or cloud provider (such as Heroku) might add a call ID in a specific header, for example, X-Request-Id. In this case, Ktor allows you to retrieve a call ID.

    • Otherwise, if a request comes without a call ID, you can generate it on the Ktor server.

  2. Next, Ktor verifies a retrieved/generated call ID using a predefined dictionary. You can also provide your own condition to verify a call ID.

  3. Finally, you can send a call ID to the client in a specific header, for example, X-Request-Id.

You can learn more from CallId.