UnoYakshi opened a new issue, #13748:
URL: https://github.com/apache/apisix/issues/13748

   ### Description
   
   # Clarification/Context
   
   I have Tempo+Grafana setup, traces are correctly sent to the OTLP endpoint. 
However, I'd like the "Name" column (in Grafana) to show `http.target` / 
`url.uri` (of span attributes) and not `http.route`. Because, for multiple 
endpoints, I'd get the same "Name", e.g., `/api/admin/*`. But it's currently 
hardcoded in 
[opentelemetry.lua#L417](https://github.com/apache/apisix/blob/master/apisix/plugins/opentelemetry.lua#L417).
   As mentioned 
[here](https://github.com/apache/apisix/issues/11990#issuecomment-2880664833), 
frontend application should own/be the parent span. However, when no there is 
no frontend application, it's not the case. And I'd like to be able to better 
distinguish one request from another.
   
   
   # Suggestion
   
   What if we add another parameter to `opentelemetry` plug-in, 
`span_name_strategy`?
   
   ```json
   {
     "span_name_strategy": "path|target"
   }
   ```
   
   (pseudocode)
   ```lua
   local schema = {
       type = "object",
       properties = {
   
           ...
   
           span_name_strategy = {
               type = "string",
               enum = {"path", "target"},
               default = "path",
           },
   
   # ...
   
   local function resolve_span_name(conf, api_ctx)
       local span_name_strategy = conf.span_name_strategy or "route"
   
       if strategy == "target" then
           return api_ctx.var.uri
       end
   
       return api_ctx.curr_req_matched._path
   end
   
   #...
   
   
   # Closer to line 417...
   local span_name_suffix = resolve_span_name_suffix(plugin_info, 
api_ctx)span_name = span_name .. " " .. span_name_suffix
   ```


-- 
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