janiussyafiq commented on code in PR #13146:
URL: https://github.com/apache/apisix/pull/13146#discussion_r3042826008


##########
t/plugin/opentelemetry.t:
##########
@@ -434,3 +434,59 @@ HEAD /specific_status
 tail -n 1 ci/pod/otelcol-contrib/data-otlp.json
 --- response_body eval
 qr/.*\/specific_status.*/
+
+
+
+=== TEST 20: set additional_attributes with numeric nginx variables
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local code, body = t('/apisix/admin/routes/1',
+                ngx.HTTP_PUT,
+                [[{
+                    "name": "route_name",
+                    "plugins": {
+                        "opentelemetry": {
+                            "sampler": {
+                                "name": "always_on"
+                            },
+                            "additional_attributes": [
+                                "request_time",
+                                "upstream_response_time",
+                                "bytes_sent"
+                            ]
+                        }
+                    },
+                    "uri": "/opentracing",
+                    "service_id": "1"
+                }]]
+            )
+
+            if code >= 300 then
+                ngx.status = code
+            end
+            ngx.say(body)
+        }
+    }
+--- request
+GET /t
+
+
+
+=== TEST 21: trigger opentelemetry, numeric nginx variables must not cause 
encode error
+--- request
+GET /opentracing
+--- wait: 2
+--- response_body
+opentracing
+--- no_error_log
+bad argument #2 to 'encode'

Review Comment:
   good catch! fixed



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