cvas22 opened a new pull request, #14228: URL: https://github.com/apache/apisix/pull/14228
### Description loki-logger only lets you set labels, so there's no good place for high-cardinality fields like request IDs or client IPs. This adds an optional `structured_metadata` map that gets sent as Loki structured metadata (the third element of each value in the push payload). Values resolve variables the same way `log_labels` does, per request. If a value comes out empty, like a missing header, I skip that key instead of sending an empty string. When nothing is configured or every key is empty, the line is sent as `[ts, line]` like before, so older Loki versions aren't affected. The CI Loki is 2.8, which doesn't accept structured metadata, so the new tests point the plugin at a small mock push endpoint and check the payload it gets. I couldn't run Test::Nginx locally, so I'm relying on CI for those. #### Which issue(s) this PR fixes: Fixes #13451 ### 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 - [x] I have added tests corresponding to this change - [x] I have updated the documentation to reflect this change - [x] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) 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]
