| 1 | package Punk::Observe::Store; | ||||||||||
| 2 | |||||||||||
| 3 | 44 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 44 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 44 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | # WAL::seal and Exec::run are called BY NAME from the XS, so they have to be | ||||||||||
| 8 | # loaded even though nothing in this file mentions them. | ||||||||||
| 9 | 44 | ▶ | use Punk::Observe (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 44 | ▶ | use Punk::Observe::WAL (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 44 | ▶ | use Punk::Observe::Exec (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 44 | our $VERSION = $Punk::Observe::VERSION; | |||||||||
| 14 | |||||||||||
| 15 | 44 | ▶ | use constant { KIND_METRIC => 1, KIND_LOG => 2, KIND_SPAN => 3 }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 44 | my %KIND_NAME = (KIND_METRIC, 'metric', KIND_LOG, 'log', KIND_SPAN, 'span'); | |||||||||
| 18 | |||||||||||
| 19 | 44 | my %SOURCE_KIND = ( | |||||||||
| 20 | metric => KIND_METRIC, | ||||||||||
| 21 | log => KIND_LOG, | ||||||||||
| 22 | trace => KIND_SPAN, | ||||||||||
| 23 | spans => KIND_SPAN, | ||||||||||
| 24 | ); | ||||||||||
| 25 | |||||||||||
| 26 | # THE SAME ANSWER, WITH THE SETTLED PART NOT RECOMPUTED. | ||||||||||
| 27 | # | ||||||||||
| 28 | # One name the renderer can call whether or not a cache was configured, so the | ||||||||||
| 29 | # decision lives here rather than in every caller: with a cache and a bucketed | ||||||||||
| 30 | # query this splits the window and reuses the chunks that have settled; with | ||||||||||
| 31 | # neither it is `query`. See Punk::Observe::Cache for why concatenating | ||||||||||
| 32 | # chunks is exact rather than approximate. | ||||||||||
| 33 | 71 | ▶ | sub cached_query { | ||||||||
|
Subroutine
cached_query: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 34 | 71 | my ($self, $q, %opt) = @_; | |||||||||
| 35 | 71 | ▶ | return $self->query($q, %opt) unless $self->{cache}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 36 | 6 | require Punk::Observe::Cache; | |||||||||
| 37 | 6 | return Punk::Observe::Cache::query($self, $q, %opt, cache => $self->{cache}); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 44 | 1; | |||||||||
| 41 | |||||||||||
| 42 | __END__ | ||||||||||