spacewander commented on a change in pull request #5463:
URL: https://github.com/apache/apisix/pull/5463#discussion_r746204195



##########
File path: apisix/plugins/datadog.lua
##########
@@ -144,6 +149,12 @@ function _M.log(conf, ctx)
     entry.balancer_ip = ctx.balancer_ip or ""
     entry.route_name = ctx.route_name or ""
     entry.scheme = ctx.upstream_scheme or ""
+    entry.prefer_name = conf.prefer_name
+    -- capture service name at request response cycle if prefer_name is set.
+    if entry.prefer_name and entry.service_id and entry.service_id ~= "" then
+       local svc = service_fetch(entry.service_id)
+       entry.service_name = svc and svc.value.name or ""

Review comment:
       ```suggestion
          entry.service_id = svc and svc.value.name or ""
   ```
   So there is no need to check the service_name in the report process.
   
   And we can do the same thing with the route, so there is no need to pass the 
prefer_name configuration.




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