Commit 087aa81
committed
feat: add plugin execution tracing to OpenTelemetry plugin
This commit adds plugin execution tracing capability to the OpenTelemetry plugin,
allowing users to trace individual plugin phases (rewrite, access, header_filter,
body_filter, log) as child spans of the main request trace.
Changes:
- Added trace_plugins configuration option (default: false, opt-in)
- Added plugin_span_kind configuration for observability provider compatibility
- Enhanced plugin execution with OpenTelemetry span creation and finishing
- Added comprehensive request context attributes to plugin spans
- Updated documentation with examples and usage instructions
- Added comprehensive test suite for the new functionality
Features:
- Plugin Phase Tracing: Creates child spans for each plugin phase execution
- Rich Context: Includes HTTP method, URI, hostname, user agent, route info, and service info
- Configurable: Can be enabled/disabled via trace_plugins configuration
- Span Kind Control: Supports internal (default) and server span kinds for observability provider compatibility
- Proper Hierarchy: Plugin spans are correctly nested under main request spans
- Performance: Minimal overhead when disabled (default behavior)
Configuration:
- trace_plugins: boolean (default: false) - Enable/disable plugin tracing
- plugin_span_kind: string (default: 'internal') - Span kind for plugin spans
- 'internal': Standard internal operation (may be excluded from metrics)
- 'server': Server-side operation (typically included in service-level metrics)
This addresses GitHub issue #12510 and provides end-to-end tracing visibility
for APISIX plugin execution phases.1 parent 2c041a3 commit 087aa81
File tree
5 files changed
+797
-4
lines changed- apisix
- plugins
- docs/en/latest/plugins
- t/plugin
5 files changed
+797
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
1169 | 1170 | | |
1170 | 1171 | | |
1171 | 1172 | | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
1172 | 1176 | | |
1173 | 1177 | | |
1174 | 1178 | | |
| |||
1188 | 1192 | | |
1189 | 1193 | | |
1190 | 1194 | | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
1191 | 1200 | | |
1192 | 1201 | | |
1193 | 1202 | | |
1194 | 1203 | | |
1195 | 1204 | | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
1196 | 1215 | | |
1197 | 1216 | | |
1198 | 1217 | | |
| |||
1216 | 1235 | | |
1217 | 1236 | | |
1218 | 1237 | | |
1219 | | - | |
1220 | 1238 | | |
1221 | 1239 | | |
1222 | 1240 | | |
| |||
1226 | 1244 | | |
1227 | 1245 | | |
1228 | 1246 | | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
1229 | 1252 | | |
1230 | 1253 | | |
1231 | 1254 | | |
1232 | | - | |
| 1255 | + | |
| 1256 | + | |
1233 | 1257 | | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
1234 | 1267 | | |
1235 | 1268 | | |
1236 | 1269 | | |
| |||
0 commit comments