Hi all,

I am writing this email to open the discussion for improving user experience 
for plugin execution order adjustment. Specifically, either merge / abstract 
phases for plugin execution on the engineering side; or simply add phases to 
plugin docs.

## Current State

Currently for users to understand plugin execution order and how to adjust 
execution priority, they need to understand APISIX phases, which were derived 
from OpenResty phases. This is because plugin priority of execution can only be 
adjusted WITHIN a given phase.

Logics in rewrite will always be executed before logics in access, which means 
even if plugin A (with logics in access phase) has a higher priority than 
plugin B (with logics in rewrite phase), plugin B will be executed first.

## Issue

Issue is the understanding cost.

For a user to understand how to adjust priorities, they need to understand:

- APISIX phases (rewrite and access) and their ordering in execution; and
- what phase(s) a plugin has methods in

## Solutions

For the first point, there has been an improvement to the documentation.

For the second point, no solution yet. Users still need to dig into the plugin 
source code themselves to see the specific phases involved with a plugin. 
Plugin doc does not document what phases are involved for the plugin.

Two potentials resolutions to tackle this:

- Improve on the engineering side to abstract away from phases completely.

- Add what phase(s) the plugin involves on each and one of the plugin doc.

IMHO, phases on plugin docs might complicate the concept. it is the quickest 
fix, however.

Alternatively, we explain phases to users every time they ask about plugin 
execution priority (i.e. 
https://github.com/apache/apisix/issues/9433#issuecomment-1539923862).

Interested to see what everybody thinks, if we should prioritize, and how we 
want to proceed.

Thanks,
Traky Deng

Reply via email to