janiussyafiq commented on code in PR #13232:
URL: https://github.com/apache/apisix/pull/13232#discussion_r3182897173
##########
t/plugin/opentelemetry6.t:
##########
@@ -248,3 +241,56 @@ opentracing
end
}
}
+
+
+
+=== TEST 7: clear file
+--- exec
+echo '' > ci/pod/otelcol-contrib/data-otlp.json
+--- response_body eval
+qr//
+
+
+
+=== TEST 8: trigger two concurrent HTTP/2 requests on the same TLS connection
+--- init_by_lua_block
+ require "resty.core"
+ apisix = require("apisix")
+ core = require("apisix.core")
+ apisix.http_init()
+
+ local utils = require("apisix.core.utils")
+ utils.dns_parse = function (domain)
+ if domain == "test1.com" then
+ return {address = "127.0.0.2"}
+ end
+ error("unknown domain: " .. domain)
+ end
+--- exec
+curl -sk --http2 --parallel --resolve "test.com:1994:127.0.0.1"
https://test.com:1994/opentracing https://test.com:1994/opentracing
Review Comment:
fixed
##########
t/lib/test_otel.lua:
##########
@@ -132,4 +132,50 @@ function _M.verify_tree(filepath, expected_tree)
end
+function _M.verify_isolated_traces(filepath, root_name, count)
+ local spans_by_id, err = parse_spans(filepath)
+ if not spans_by_id then
+ return false, err
+ end
+
+ local traces = {}
+ for _, span in pairs(spans_by_id) do
+ if not traces[span.traceId] then
+ traces[span.traceId] = {}
+ end
+ table.insert(traces[span.traceId], span.name)
+ end
+
+ local matching = {}
+ for trace_id, names in pairs(traces) do
+ for _, name in ipairs(names) do
+ if name == root_name then
+ table.insert(matching, { id = trace_id, names = names })
+ break
+ end
+ end
+ end
+
+ if #matching ~= count then
+ return false, string.format(
+ "expected %d traces with span '%s', got %d",
+ count, root_name, #matching)
+ end
+
+ for _, trace in ipairs(matching) do
+ local seen = {}
+ for _, name in ipairs(trace.names) do
+ if seen[name] then
+ return false, string.format(
+ "trace %s has duplicate span '%s': cross-stream
contamination detected",
+ trace.id, name)
+ end
+ seen[name] = true
+ end
+ end
Review Comment:
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]