fix: small improvements
This commit is contained in:
parent
45e37dfda7
commit
3d172545d1
4 changed files with 102 additions and 160 deletions
|
|
@ -170,23 +170,23 @@ $t->try_run('no OTEL module')->plan(65);
|
|||
###############################################################################
|
||||
|
||||
#do requests
|
||||
my $t_off_resp = http_get('/trace-off');
|
||||
my $t_off_resp = http1_get('/trace-off');
|
||||
|
||||
#batch0 (10 requests)
|
||||
my $tp_resp = http_get_traceparent('/trace-on');
|
||||
my $t_resp = http_get_ssl('/trace-on');
|
||||
my $tp_resp = http1_get('/trace-on', trace_headers => 1);
|
||||
my $t_resp = http1_get('/trace-on', ssl => 1);
|
||||
|
||||
my $t_resp_ignore = http_get('/context-ignore');
|
||||
my $tp_resp_ignore = http_get_traceparent('/context-ignore');
|
||||
my $t_resp_extract = http_get('/context-extract');
|
||||
my $tp_resp_extract = http_get_traceparent('/context-extract');
|
||||
my $t_resp_inject = http_get('/context-inject');
|
||||
my $tp_resp_inject = http_get_traceparent('/context-inject');
|
||||
my $t_resp_propagate = http_get('/context-propagate');
|
||||
my $tp_resp_propagate = http_get_traceparent('/context-propagate');
|
||||
my $t_resp_ignore = http1_get('/context-ignore');
|
||||
my $tp_resp_ignore = http1_get('/context-ignore', trace_headers => 1);
|
||||
my $t_resp_extract = http1_get('/context-extract');
|
||||
my $tp_resp_extract = http1_get('/context-extract', trace_headers => 1);
|
||||
my $t_resp_inject = http1_get('/context-inject');
|
||||
my $tp_resp_inject = http1_get('/context-inject', trace_headers => 1);
|
||||
my $t_resp_propagate = http1_get('/context-propagate');
|
||||
my $tp_resp_propagate = http1_get('/context-propagate', trace_headers => 1);
|
||||
|
||||
#batch1 (5 reqeusts)
|
||||
http_get('/trace-on') for (1..5);
|
||||
http1_get('/trace-on') for (1..5);
|
||||
|
||||
#waiting batch1 is sent to collector for 1s
|
||||
select undef, undef, undef, 1;
|
||||
|
|
@ -263,7 +263,7 @@ is(get_attr("http.scheme", "stringValue", $$spans[1]), 'https',
|
|||
'http.scheme metric - trace on (https)');
|
||||
is(get_attr("http.flavor", "stringValue", $$spans[1]), '1.0',
|
||||
'http.flavor metric - trace on (https)');
|
||||
isnt(get_attr("http.user_agent", "stringValue", $$spans[1]), 'nginx-tests',
|
||||
is(get_attr("http.user_agent", "stringValue", $$spans[1]), 'nginx-tests',
|
||||
'http.user_agent metric - trace on (https)');
|
||||
is(get_attr("http.request_content_length", "intValue", $$spans[1]), 0,
|
||||
'http.request_content_length metric - trace on (https)');
|
||||
|
|
@ -362,25 +362,23 @@ like($tp_resp_propagate,
|
|||
|
||||
###############################################################################
|
||||
|
||||
sub http_get_traceparent {
|
||||
my ($path) = @_;
|
||||
sub http1_get {
|
||||
my ($path, %extra) = @_;
|
||||
|
||||
return http(<<EOF);
|
||||
my $s = $extra{ssl} ? get_ssl_socket(8081) : undef;
|
||||
|
||||
my $r = <<EOF;
|
||||
GET $path HTTP/1.0
|
||||
Host: localhost
|
||||
User-agent: nginx-tests
|
||||
EOF
|
||||
|
||||
$r .= <<EOF if $extra{trace_headers};
|
||||
Traceparent: 00-0af7651916cd43dd8448eb211c80319c-b9c7c989f97918e1-01
|
||||
Tracestate: congo=ucfJifl5GOE,rojo=00f067aa0ba902b7
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
sub http_get_ssl {
|
||||
my ($path) = @_;
|
||||
|
||||
my $s = get_ssl_socket(8081) or return;
|
||||
|
||||
return http_get($path, socket => $s);
|
||||
return http($r . "\n", socket => $s);
|
||||
}
|
||||
|
||||
sub get_ssl_socket {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue