Filename | /opt/flows/lib/lib/perl5/Search/Elasticsearch/Cxn/HTTPTiny.pm |
Statements | Executed 35 statements in 725µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 10.1ms | 11.3ms | BEGIN@8 | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 20µs | 103µs | _build_handle | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 16µs | 326µs | BEGIN@3 | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 9µs | 194µs | BEGIN@9 | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 7µs | 44µs | __ANON__[:3] | Search::Elasticsearch::Cxn::HTTPTiny::
1 | 1 | 1 | 2µs | 2µs | CORE:qr (opcode) | Search::Elasticsearch::Cxn::HTTPTiny::
0 | 0 | 0 | 0s | 0s | error_from_text | Search::Elasticsearch::Cxn::HTTPTiny::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Search::Elasticsearch::Cxn::HTTPTiny; | ||||
2 | 1 | 400ns | $Search::Elasticsearch::Cxn::HTTPTiny::VERSION = '2.02'; | ||
3 | 4 | 61µs | 3 | 672µs | # spent 44µs (7+37) within Search::Elasticsearch::Cxn::HTTPTiny::__ANON__[/opt/flows/lib/lib/perl5/Search/Elasticsearch/Cxn/HTTPTiny.pm:3] which was called:
# once (7µs+37µs) by import::into at line 34 of Import/Into.pm
# spent 326µs (16+309) within Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@3 which was called:
# once (16µs+309µs) by Module::Runtime::require_module at line 3 # spent 326µs making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@3
# spent 309µs making 1 call to Moo::import
# spent 37µs making 1 call to strictures::import |
4 | 1 | 1µs | 1 | 13.3ms | with 'Search::Elasticsearch::Role::Cxn::HTTP', # spent 13.3ms making 1 call to Moo::with |
5 | 'Search::Elasticsearch::Role::Cxn', | ||||
6 | 'Search::Elasticsearch::Role::Is_Sync'; | ||||
7 | |||||
8 | 3 | 158µs | 2 | 11.3ms | # spent 11.3ms (10.1+1.24) within Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@8 which was called:
# once (10.1ms+1.24ms) by Module::Runtime::require_module at line 8 # spent 11.3ms making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@8
# spent 14µs making 1 call to UNIVERSAL::VERSION |
9 | 2 | 391µs | 2 | 379µs | # spent 194µs (9+185) within Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@9 which was called:
# once (9µs+185µs) by Module::Runtime::require_module at line 9 # spent 194µs making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::BEGIN@9
# spent 185µs making 1 call to namespace::clean::import |
10 | |||||
11 | 1 | 6µs | 1 | 2µs | my $Cxn_Error = qr/ Connection.(?:timed.out|re(?:set|fused)) # spent 2µs making 1 call to Search::Elasticsearch::Cxn::HTTPTiny::CORE:qr |
12 | | connect:.timeout | ||||
13 | | Host.is.down | ||||
14 | | No.route.to.host | ||||
15 | | temporarily.unavailable | ||||
16 | /x; | ||||
17 | |||||
18 | #=================================== | ||||
19 | sub perform_request { | ||||
20 | #=================================== | ||||
21 | 2 | 800ns | my ( $self, $params ) = @_; | ||
22 | 2 | 4µs | 2 | 271µs | my $uri = $self->build_uri($params); # spent 271µs making 2 calls to Search::Elasticsearch::Role::Cxn::HTTP::build_uri, avg 136µs/call |
23 | 2 | 2µs | my $method = $params->{method}; | ||
24 | |||||
25 | 2 | 400ns | my %args; | ||
26 | 2 | 1µs | if ( defined $params->{data} ) { | ||
27 | $args{content} = $params->{data}; | ||||
28 | $args{headers}{'Content-Type'} = $params->{mime_type}; | ||||
29 | } | ||||
30 | |||||
31 | 2 | 6µs | 2 | 169µs | my $handle = $self->handle; # spent 169µs making 2 calls to Search::Elasticsearch::Cxn::HTTPTiny::handle, avg 85µs/call |
32 | 2 | 14µs | 3 | 54µs | $handle->timeout( $params->{timeout} || $self->request_timeout ); # spent 53µs making 2 calls to HTTP::Tiny::timeout, avg 26µs/call
# spent 2µs making 1 call to Search::Elasticsearch::Role::Cxn::request_timeout |
33 | |||||
34 | 2 | 11µs | 4 | 4.39ms | my $response = $handle->request( $method, "$uri", \%args ); # spent 4.39ms making 2 calls to HTTP::Tiny::request, avg 2.19ms/call
# spent 4µs making 2 calls to URI::__ANON__[URI.pm:24], avg 2µs/call |
35 | |||||
36 | 2 | 28µs | 2 | 86µs | return $self->process_response( # spent 86µs making 2 calls to Search::Elasticsearch::Cxn::HTTPTiny::process_response, avg 43µs/call |
37 | $params, # request | ||||
38 | $response->{status}, # code | ||||
39 | $response->{reason}, # msg | ||||
40 | $response->{content}, # body | ||||
41 | $response->{headers} # headers | ||||
42 | ); | ||||
43 | } | ||||
44 | |||||
45 | #=================================== | ||||
46 | sub error_from_text { | ||||
47 | #=================================== | ||||
48 | local $_ = $_[2]; | ||||
49 | return | ||||
50 | /[Tt]imed out/ ? 'Timeout' | ||||
51 | : /Unexpected end of stream/ ? 'ContentLength' | ||||
52 | : /SSL connection failed/ ? 'SSL' | ||||
53 | : /$Cxn_Error/ ? 'Cxn' | ||||
54 | : 'Request'; | ||||
55 | } | ||||
56 | |||||
57 | #=================================== | ||||
58 | # spent 103µs (20+83) within Search::Elasticsearch::Cxn::HTTPTiny::_build_handle which was called:
# once (20µs+83µs) by Search::Elasticsearch::Role::Cxn::HTTP::handle at line 13 of (eval 71)[Sub/Quote.pm:5] | ||||
59 | #=================================== | ||||
60 | 1 | 200ns | my $self = shift; | ||
61 | 1 | 6µs | 1 | 700ns | my %args = ( default_headers => $self->default_headers ); # spent 700ns making 1 call to Search::Elasticsearch::Role::Cxn::HTTP::default_headers |
62 | 1 | 5µs | 1 | 600ns | if ( $self->is_https && $self->has_ssl_options ) { # spent 600ns making 1 call to Search::Elasticsearch::Role::Cxn::HTTP::is_https |
63 | $args{SSL_options} = $self->ssl_options; | ||||
64 | if ( $args{SSL_options}{SSL_verify_mode} ) { | ||||
65 | $args{verify_ssl} = 1; | ||||
66 | } | ||||
67 | } | ||||
68 | |||||
69 | 1 | 12µs | 2 | 82µs | return HTTP::Tiny->new( %args, %{ $self->handle_args } ); # spent 81µs making 1 call to HTTP::Tiny::new
# spent 800ns making 1 call to Search::Elasticsearch::Role::Cxn::handle_args |
70 | } | ||||
71 | |||||
72 | 1 | 5µs | 1; | ||
73 | |||||
74 | # ABSTRACT: A Cxn implementation which uses HTTP::Tiny | ||||
75 | |||||
76 | 1 | 11µs | 1 | 254µs | __END__ # spent 254µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[/opt/flows/lib/lib/perl5/B/Hooks/EndOfScope/XS.pm:17] |
# spent 2µs within Search::Elasticsearch::Cxn::HTTPTiny::CORE:qr which was called:
# once (2µs+0s) by Module::Runtime::require_module at line 11 |