shreemaan-abhishek opened a new pull request, #13618: URL: https://github.com/apache/apisix/pull/13618
### Description The `opentelemetry` plugin caches the tracer object per route via `core.lrucache.plugin_ctx`, but passed `nil` as the cache version key in `_M.rewrite`. The tracer bakes in everything sourced from `plugin_metadata` (collector address, `request_timeout`/`request_headers`, `trace_id_source`, sampler, and resource attributes). With a `nil` version key the cache entry is never invalidated, so after an operator updates the `opentelemetry` plugin_metadata at runtime (e.g. points to a new OTLP collector or flips `trace_id_source`), the worker keeps serving the stale cached tracer. Spans keep going to the old endpoint until the per-conf cache entry is evicted or the worker recycles. This passes `metadata.modifiedIndex` as the lrucache version key so the tracer is rebuilt whenever the plugin_metadata changes. `api_ctx.conf_version` (the existing version) only tracks the route/service, not plugin_metadata, so a metadata-only change does not invalidate the entry on its own. Fixes the stale-tracer behavior on plugin_metadata change. ### Checklist - [x] I have explained the need for this PR and the problem it solves - [x] I have explained the changes or the new features added to this PR - [ ] I have added tests corresponding to this change - [x] I have updated the documentation to reflect this change (N/A, behavior-internal) - [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/blob/master/CONTRIBUTING.md#submit-a-proposal) first) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
