Filename | /opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Transport.pm |
Statements | Executed 29 statements in 505µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 21µs | 88µs | BUILD | Search::Elasticsearch::Role::Transport::
1 | 1 | 1 | 16µs | 338µs | BEGIN@3 | Search::Elasticsearch::Role::Transport::
1 | 1 | 1 | 10µs | 52µs | BEGIN@7 | Search::Elasticsearch::Role::Transport::
1 | 1 | 1 | 9µs | 213µs | BEGIN@8 | Search::Elasticsearch::Role::Transport::
1 | 1 | 1 | 9µs | 258µs | BEGIN@9 | Search::Elasticsearch::Role::Transport::
1 | 1 | 1 | 6µs | 42µs | __ANON__[:3] | Search::Elasticsearch::Role::Transport::
1 | 1 | 1 | 6µs | 14µs | tidy_request | Search::Elasticsearch::Role::Transport::
2 | 2 | 2 | 2µs | 2µs | cxn_pool (xsub) | Search::Elasticsearch::Role::Transport::
1 | 1 | 1 | 500ns | 500ns | logger (xsub) | Search::Elasticsearch::Role::Transport::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Search::Elasticsearch::Role::Transport; | ||||
2 | 1 | 400ns | $Search::Elasticsearch::Role::Transport::VERSION = '2.02'; | ||
3 | 4 | 60µs | 3 | 696µs | # spent 338µs (16+322) within Search::Elasticsearch::Role::Transport::BEGIN@3 which was called:
# once (16µs+322µs) by Module::Runtime::require_module at line 3
# spent 42µs (6+36) within Search::Elasticsearch::Role::Transport::__ANON__[/opt/flows/lib/lib/perl5/Search/Elasticsearch/Role/Transport.pm:3] which was called:
# once (6µs+36µs) by import::into at line 34 of Import/Into.pm # spent 338µs making 1 call to Search::Elasticsearch::Role::Transport::BEGIN@3
# spent 322µs making 1 call to Moo::Role::import
# spent 36µs making 1 call to strictures::import |
4 | |||||
5 | 1 | 2µs | 1 | 9µs | requires qw(perform_request); # spent 9µs making 1 call to Moo::Role::requires |
6 | |||||
7 | 2 | 35µs | 2 | 94µs | # spent 52µs (10+42) within Search::Elasticsearch::Role::Transport::BEGIN@7 which was called:
# once (10µs+42µs) by Module::Runtime::require_module at line 7 # spent 52µs making 1 call to Search::Elasticsearch::Role::Transport::BEGIN@7
# spent 42µs making 1 call to Exporter::import |
8 | 2 | 37µs | 2 | 417µs | # spent 213µs (9+204) within Search::Elasticsearch::Role::Transport::BEGIN@8 which was called:
# once (9µs+204µs) by Module::Runtime::require_module at line 8 # spent 213µs making 1 call to Search::Elasticsearch::Role::Transport::BEGIN@8
# spent 204µs making 1 call to Sub::Exporter::__ANON__[/opt/flows/lib/lib/perl5/Sub/Exporter.pm:337] |
9 | 2 | 316µs | 2 | 508µs | # spent 258µs (9+250) within Search::Elasticsearch::Role::Transport::BEGIN@9 which was called:
# once (9µs+250µs) by Module::Runtime::require_module at line 9 # spent 258µs making 1 call to Search::Elasticsearch::Role::Transport::BEGIN@9
# spent 250µs making 1 call to namespace::clean::import |
10 | |||||
11 | 1 | 1µs | 1 | 142µs | has 'serializer' => ( is => 'ro', required => 1 ); # spent 142µs making 1 call to Moo::Role::has |
12 | 1 | 1µs | 1 | 115µs | has 'logger' => ( is => 'ro', required => 1 ); # spent 115µs making 1 call to Moo::Role::has |
13 | 1 | 1µs | 1 | 111µs | has 'send_get_body_as' => ( is => 'ro', default => 'GET' ); # spent 111µs making 1 call to Moo::Role::has |
14 | 1 | 1µs | 1 | 109µs | has 'cxn_pool' => ( is => 'ro', required => 1 ); # spent 109µs making 1 call to Moo::Role::has |
15 | |||||
16 | #=================================== | ||||
17 | # spent 88µs (21+67) within Search::Elasticsearch::Role::Transport::BUILD which was called:
# once (21µs+67µs) by Search::Elasticsearch::Transport::new at line 55 of (eval 96)[Sub/Quote.pm:5] | ||||
18 | #=================================== | ||||
19 | 1 | 200ns | my $self = shift; | ||
20 | 1 | 7µs | 1 | 700ns | my $pool = $self->cxn_pool; # spent 700ns making 1 call to Search::Elasticsearch::Role::Transport::cxn_pool |
21 | 1 | 2µs | 1 | 46µs | is_compat( 'cxn_pool', $self, $pool ); # spent 46µs making 1 call to Search::Elasticsearch::Util::is_compat |
22 | 1 | 10µs | 3 | 20µs | is_compat( 'cxn', $self, $pool->cxn_factory->cxn_class ); # spent 19µs making 1 call to Search::Elasticsearch::Util::is_compat
# spent 900ns making 1 call to Search::Elasticsearch::Role::CxnPool::cxn_factory
# spent 600ns making 1 call to Search::Elasticsearch::Cxn::Factory::cxn_class |
23 | 1 | 3µs | return $self; | ||
24 | } | ||||
25 | |||||
26 | #=================================== | ||||
27 | # spent 14µs (6+7) within Search::Elasticsearch::Role::Transport::tidy_request which was called:
# once (6µs+7µs) by Search::Elasticsearch::Transport::perform_request at line 18 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Transport.pm | ||||
28 | #=================================== | ||||
29 | 1 | 2µs | 1 | 7µs | my ( $self, $params ) = parse_params(@_); # spent 7µs making 1 call to Search::Elasticsearch::Util::parse_params |
30 | 1 | 500ns | $params->{method} ||= 'GET'; | ||
31 | 1 | 100ns | $params->{path} ||= '/'; | ||
32 | 1 | 200ns | $params->{qs} ||= {}; | ||
33 | 1 | 100ns | $params->{ignore} ||= []; | ||
34 | 1 | 200ns | my $body = $params->{body}; | ||
35 | 1 | 3µs | return $params unless defined $body; | ||
36 | |||||
37 | $params->{serialize} ||= 'std'; | ||||
38 | $params->{data} | ||||
39 | = $params->{serialize} eq 'std' | ||||
40 | ? $self->serializer->encode($body) | ||||
41 | : $self->serializer->encode_bulk($body); | ||||
42 | |||||
43 | if ( $params->{method} eq 'GET' ) { | ||||
44 | my $send_as = $self->send_get_body_as; | ||||
45 | if ( $send_as eq 'POST' ) { | ||||
46 | $params->{method} = 'POST'; | ||||
47 | } | ||||
48 | elsif ( $send_as eq 'source' ) { | ||||
49 | $params->{qs}{source} = delete $params->{data}; | ||||
50 | delete $params->{body}; | ||||
51 | } | ||||
52 | } | ||||
53 | |||||
54 | $params->{mime_type} ||= $self->serializer->mime_type; | ||||
55 | return $params; | ||||
56 | |||||
57 | } | ||||
58 | |||||
59 | 1 | 9µs | 1; | ||
60 | |||||
61 | #ABSTRACT: Transport role providing interface between the client class and the Elasticsearch cluster | ||||
62 | |||||
63 | 1 | 14µs | 1 | 458µs | __END__ # spent 458µ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::Role::Transport::cxn_pool which was called 2 times, avg 750ns/call:
# once (800ns+0s) by Search::Elasticsearch::Transport::perform_request at line 19 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Transport.pm
# once (700ns+0s) by Search::Elasticsearch::Role::Transport::BUILD at line 20 | |||||
# spent 500ns within Search::Elasticsearch::Role::Transport::logger which was called:
# once (500ns+0s) by Search::Elasticsearch::Transport::perform_request at line 20 of /opt/flows/lib/lib/perl5/Search/Elasticsearch/Transport.pm |