fleashiro commented on issue #9614: URL: https://github.com/apache/apisix/issues/9614#issuecomment-1663238766
@Sn0rt Sorry for delayed response. To enhance this plugin, my main goal is to integrate the collector configuration directly into the plugin's attributes. Currently, the collector can only be configured using YAML, as explained in the [opentelemetry documentation](https://apisix.apache.org/docs/apisix/plugins/opentelemetry/#configuring-the-collector). To implement this feature: 1. Add the collector fields to the plugins's schema 2. Modify the create_tracer_obj (found at [opentelemetry.lua](https://github.com/apache/apisix/blob/master/apisix/plugins/opentelemetry.lua#L232C28-L232C28)) Function: If the conf.collector fields are available, use the values provided by the user; otherwise, fall back to default yaml values. ``` local function create_tracer_obj(conf) -- Set default values local default_address = plugin_info.collector.address local default_timeout = plugin_info.collector.request_timeout local default_headers = plugin_info.collector.request_headers -- Override defaults with values from the conf table if available local address = conf.collector and conf.collector.address or default_address local request_timeout = conf.collector and conf.collector.request_timeout or default_timeout local request_headers = conf.collector and conf.collector.request_headers or default_headers -- create exporter local exporter = otlp_exporter_new(exporter_client_new(address, request_timeout, request_headers)) -- Rest of the function code ... ``` 3. Add test cases -- 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]
