xiongpan828 opened a new pull request, #13556:
URL: https://github.com/apache/apisix/pull/13556

   ### Description
   
   This PR adds support for injecting user-defined custom attributes into 
OpenTelemetry spans. Currently, the OpenTelemetry plugin only allows a fixed 
set of attributes. With this change, users can configure an 
`additional_custom_attributes` map (key-value pairs with string values) in the 
plugin configuration. These attributes are then merged into the span's 
attribute list using the existing `inject_attributes` helper.
   
   The main changes are in `apisix/plugins/opentelemetry.lua`:
   
   - Added schema definition for `additional_custom_attributes` as an object 
with string values.
   - In the span creation logic, if `conf.additional_custom_attributes` is 
present, the keys are collected and passed to `inject_attributes` to populate 
the span attributes.
   
   This enhancement allows users to attach arbitrary metadata (e.g., user ID, 
region, version) to traces without modifying the plugin code.
   
   #### Which issue(s) this PR fixes:
   Fixes # (no existing issue; this is a feature enhancement)
   
   ### 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]

Reply via email to