Skip to content

Commit

Permalink
remove stats as otherwise fastly config is a pita
Browse files Browse the repository at this point in the history
  • Loading branch information
ranguard committed Nov 18, 2016
1 parent 8b7497d commit 7e1c3dc
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 132 deletions.
50 changes: 2 additions & 48 deletions lib/MetaCPAN/Web/Controller/About.pm
Expand Up @@ -63,54 +63,8 @@ sub metadata : Local : Args(0) {
sub stats : Local : Args(0) {
my ( $self, $c ) = @_;

$c->add_surrogate_key('STATS');

# Only want a day for this, so they get refreshed
$c->cdn_max_age('1d');

$c->stash( template => 'about/stats.html' );

# See if user has the fastly credentials
if ( my $fastly = $c->_net_fastly() ) {

my @interested_fields = qw(hit_ratio bandwidth requests);

my $fastly_services = $c->config->{fastly}->{service};

my %all_stats;
foreach my $service ( @{$fastly_services} ) {

next unless $service->{display_on_stats_page};

my $stats_from_fastly = $fastly->stats(
service => $service->{id},
by => 'day',
);

my %site_stats;

# build [ { time => $time, y => $value }, {} ]
map {
my $data = $_;
my $time = $data->{start_time};
map {
push @{ $site_stats{$_} },
{ time => $time, y => $data->{$_} };
$site_stats{totals}->{$_} += $data->{$_};
} @interested_fields;

} @{$stats_from_fastly};

$site_stats{totals}->{bandwidth} = Format::Human::Bytes->base10(
$site_stats{totals}->{bandwidth} );

$all_stats{ $service->{name} } = \%site_stats;
}

$c->stash->{fastly_stats} = \%all_stats;

}

# Sorry PITA to maintain
$c->res->redirect( '/about/', 301 );
}

__PACKAGE__->meta->make_immutable;
Expand Down
80 changes: 0 additions & 80 deletions root/about/stats.html

This file was deleted.

3 changes: 0 additions & 3 deletions root/inc/about-bar.html
Expand Up @@ -28,8 +28,5 @@
<li<% IF req.action == 'about/metadata' %> class="active"<% END %>>
<a href="/about/metadata">Distribution Metadata</a>
</li>
<li<% IF req.action == 'about/stats' %> class="active"<% END %>>
<a href="/about/stats">Network Stats</a>
</li>
</ul>
</div>
2 changes: 1 addition & 1 deletion t/html.t
Expand Up @@ -12,7 +12,7 @@ my %skip = map { $_ => 1 } (
'root/inc/dependencies-graph.html', 'root/author.html',
'root/mirrors.html', 'root/source.html',
'root/wrapper.html', 'root/about/contributors.html',
'root/inc/favorite.html', 'root/about/stats.html',
'root/inc/favorite.html',
);

my $rule = Path::Iterator::Rule->new;
Expand Down

0 comments on commit 7e1c3dc

Please sign in to comment.