Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package perl-Metrics-Any for openSUSE:Factory checked in at 2022-10-15 16:37:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Metrics-Any (Old) and /work/SRC/openSUSE:Factory/.perl-Metrics-Any.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Metrics-Any" Sat Oct 15 16:37:53 2022 rev:3 rq:1011021 version:0.08 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Metrics-Any/perl-Metrics-Any.changes 2021-07-26 17:38:28.106067294 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Metrics-Any.new.2275/perl-Metrics-Any.changes 2022-10-15 16:40:41.150618902 +0200 @@ -1,0 +2,11 @@ +Wed Oct 12 03:06:35 UTC 2022 - Tina M??ller <timueller+p...@suse.de> + +- updated to 0.08 + see /usr/share/doc/packages/perl-Metrics-Any/Changes + + 0.08 2022-10-11 + [CHANGES] + * Optionally allow the test adapter to store full values for + distributions + +------------------------------------------------------------------- Old: ---- Metrics-Any-0.07.tar.gz New: ---- Metrics-Any-0.08.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Metrics-Any.spec ++++++ --- /var/tmp/diff_new_pack.8xiF75/_old 2022-10-15 16:40:41.522619796 +0200 +++ /var/tmp/diff_new_pack.8xiF75/_new 2022-10-15 16:40:41.526619805 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Metrics-Any # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,10 +18,10 @@ %define cpan_name Metrics-Any Name: perl-Metrics-Any -Version: 0.07 +Version: 0.08 Release: 0 -Summary: Abstract collection of monitoring metrics License: Artistic-1.0 OR GPL-1.0-or-later +Summary: Abstract collection of monitoring metrics URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/P/PE/PEVANS/%{cpan_name}-%{version}.tar.gz Source1: cpanspec.yml ++++++ Metrics-Any-0.07.tar.gz -> Metrics-Any-0.08.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/Changes new/Metrics-Any-0.08/Changes --- old/Metrics-Any-0.07/Changes 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/Changes 2022-10-11 16:43:36.000000000 +0200 @@ -1,5 +1,10 @@ Revision history for Metrics-Any +0.08 2022-10-11 + [CHANGES] + * Optionally allow the test adapter to store full values for + distributions + 0.07 2021-07-21 [CHANGES] * Added METRICS_ANY_DISABLE environment variable (RT137911) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/LICENSE new/Metrics-Any-0.08/LICENSE --- old/Metrics-Any-0.07/LICENSE 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/LICENSE 2022-10-11 16:43:36.000000000 +0200 @@ -1,4 +1,4 @@ -This software is copyright (c) 2021 by Paul Evans <leon...@leonerd.org.uk>. +This software is copyright (c) 2022 by Paul Evans <leon...@leonerd.org.uk>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2021 by Paul Evans <leon...@leonerd.org.uk>. +This software is Copyright (c) 2022 by Paul Evans <leon...@leonerd.org.uk>. This is free software, licensed under: @@ -272,7 +272,7 @@ --- The Artistic License 1.0 --- -This software is Copyright (c) 2021 by Paul Evans <leon...@leonerd.org.uk>. +This software is Copyright (c) 2022 by Paul Evans <leon...@leonerd.org.uk>. This is free software, licensed under: @@ -292,21 +292,21 @@ - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through - textual modification. + textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright - Holder. + Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for - the package. + the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the - computing community at large as a market that must bear the fee.) + computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they - received it. + received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you @@ -373,7 +373,7 @@ 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF -MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/MANIFEST new/Metrics-Any-0.08/MANIFEST --- old/Metrics-Any-0.07/MANIFEST 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/MANIFEST 2022-10-11 16:43:36.000000000 +0200 @@ -9,11 +9,7 @@ lib/Metrics/Any/Adapter/Test.pm lib/Metrics/Any/AdapterBase/Stored.pm lib/Metrics/Any/Collector.pm -LICENSE MANIFEST This list of files -META.json -META.yml -README t/00use.t t/01collector.t t/02adapter-early.t @@ -28,3 +24,7 @@ t/21nonstrict.t t/22disable-package.t t/99pod.t +README +LICENSE +META.yml +META.json diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/META.json new/Metrics-Any-0.08/META.json --- old/Metrics-Any-0.07/META.json 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/META.json 2022-10-11 16:43:36.000000000 +0200 @@ -35,39 +35,39 @@ "provides" : { "Metrics::Any" : { "file" : "lib/Metrics/Any.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::Adapter" : { "file" : "lib/Metrics/Any/Adapter.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::Adapter::File" : { "file" : "lib/Metrics/Any/Adapter/File.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::Adapter::Null" : { "file" : "lib/Metrics/Any/Adapter/Null.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::Adapter::Stderr" : { "file" : "lib/Metrics/Any/Adapter/Stderr.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::Adapter::Tee" : { "file" : "lib/Metrics/Any/Adapter/Tee.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::Adapter::Test" : { "file" : "lib/Metrics/Any/Adapter/Test.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::AdapterBase::Stored" : { "file" : "lib/Metrics/Any/AdapterBase/Stored.pm", - "version" : "0.07" + "version" : "0.08" }, "Metrics::Any::Collector" : { "file" : "lib/Metrics/Any/Collector.pm", - "version" : "0.07" + "version" : "0.08" } }, "release_status" : "stable", @@ -76,6 +76,6 @@ "http://dev.perl.org/licenses/" ] }, - "version" : "0.07", - "x_serialization_backend" : "JSON::PP version 4.05" + "version" : "0.08", + "x_serialization_backend" : "JSON::PP version 4.06" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/META.yml new/Metrics-Any-0.08/META.yml --- old/Metrics-Any-0.07/META.yml 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/META.yml 2022-10-11 16:43:36.000000000 +0200 @@ -17,35 +17,35 @@ provides: Metrics::Any: file: lib/Metrics/Any.pm - version: '0.07' + version: '0.08' Metrics::Any::Adapter: file: lib/Metrics/Any/Adapter.pm - version: '0.07' + version: '0.08' Metrics::Any::Adapter::File: file: lib/Metrics/Any/Adapter/File.pm - version: '0.07' + version: '0.08' Metrics::Any::Adapter::Null: file: lib/Metrics/Any/Adapter/Null.pm - version: '0.07' + version: '0.08' Metrics::Any::Adapter::Stderr: file: lib/Metrics/Any/Adapter/Stderr.pm - version: '0.07' + version: '0.08' Metrics::Any::Adapter::Tee: file: lib/Metrics/Any/Adapter/Tee.pm - version: '0.07' + version: '0.08' Metrics::Any::Adapter::Test: file: lib/Metrics/Any/Adapter/Test.pm - version: '0.07' + version: '0.08' Metrics::Any::AdapterBase::Stored: file: lib/Metrics/Any/AdapterBase/Stored.pm - version: '0.07' + version: '0.08' Metrics::Any::Collector: file: lib/Metrics/Any/Collector.pm - version: '0.07' + version: '0.08' requires: List::Util: '1.29' perl: '5.014' resources: license: http://dev.perl.org/licenses/ -version: '0.07' +version: '0.08' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/File.pm new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/File.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/File.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/File.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020 -- leon...@leonerd.org.uk -package Metrics::Any::Adapter::File 0.07; +package Metrics::Any::Adapter::File 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Null.pm new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Null.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Null.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Null.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020 -- leon...@leonerd.org.uk -package Metrics::Any::Adapter::Null 0.07; +package Metrics::Any::Adapter::Null 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Stderr.pm new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Stderr.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Stderr.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Stderr.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020 -- leon...@leonerd.org.uk -package Metrics::Any::Adapter::Stderr 0.07; +package Metrics::Any::Adapter::Stderr 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Tee.pm new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Tee.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Tee.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Tee.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020 -- leon...@leonerd.org.uk -package Metrics::Any::Adapter::Tee 0.07; +package Metrics::Any::Adapter::Tee 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Test.pm new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Test.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/Adapter/Test.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/Adapter/Test.pm 2022-10-11 16:43:36.000000000 +0200 @@ -1,9 +1,9 @@ # You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # -# (C) Paul Evans, 2020 -- leon...@leonerd.org.uk +# (C) Paul Evans, 2020-2022 -- leon...@leonerd.org.uk -package Metrics::Any::Adapter::Test 0.07; +package Metrics::Any::Adapter::Test 0.08; use v5.14; use warnings; @@ -12,6 +12,7 @@ use Carp; use List::Util 1.29 qw( pairs ); +use Scalar::Util qw( reftype ); =head1 NAME @@ -39,7 +40,9 @@ access to them by the L</metrics> method. This is useful to use in a unit test to check that the code under test reports the correct metrics. -This adapter supports timer metrics by storing the count and total duration. +This adapter supports timer metrics by storing as distributions. By default, +distributions store only a summary, giving the count and total duration. If +required, the full values can be stored by setting L</use_full_distributions>. For predictable output of timer metrics in unit tests, a unit test may wish to use the L</override_timer_duration> method. @@ -54,7 +57,11 @@ return $singleton //= $class->SUPER::new( @_ ); } +# We're a singleton instance, so we can just store state in file-scoped +# lexicals + my $timer_duration; +my $use_full_distributions; =head1 METHODS @@ -80,6 +87,37 @@ =cut +=head2 use_full_distributions + + Metrics::Any::Adapter::Test->use_full_distributions; # enables the option + + Metrics::Any::Adapter::Test->use_full_distributions( $enable ); + +I<Since version 0.08.> + +If enabled, this option stores the full value of every reported observation +into distributions, rathr than just the count-and-total summary. + +Full value distributions will be formatted as a sequence of lines containing +the count of observations at that particular value, in square brackets, +followed by the summary count. + + name[v1] = c1 + name[v2] = c2 + ... + name_count = c + +In order not to be too sensitive to numerical rounding errors, values are +stored to only 3 decimal places. + +=cut + +sub use_full_distributions +{ + shift; + ( $use_full_distributions ) = @_ ? @_ : ( 1 ); +} + use constant { DIST_COUNT => 0, DIST_TOTAL => 1, @@ -90,9 +128,16 @@ shift; my ( $storage, $amount ) = @_; - $storage //= [ 0, 0 ]; - $storage->[DIST_COUNT] += 1; - $storage->[DIST_TOTAL] += $amount; + if( $use_full_distributions ) { + $storage //= {}; + + $storage->{ sprintf "%.3f", $amount }++; + } + else { + $storage //= [ 0, 0 ]; + $storage->[DIST_COUNT] += 1; + $storage->[DIST_TOTAL] += $amount; + } return $storage; } @@ -115,8 +160,22 @@ push @ret, "$name = $value"; } elsif( $type eq "distribution" or $type eq "timer" ) { - push @ret, "${name}_count = " . $value->[DIST_COUNT]; - push @ret, "${name}_total = " . $value->[DIST_TOTAL]; + if( reftype $value eq "HASH" ) { + my $total = 0; + foreach my $k ( sort { $a <=> $b } keys %$value ) { + my $v = $value->{$k}; + # Trim trailing zeroes for neatness + $k =~ s/\.0+$/./; $k =~ s/\.$//; + + push @ret, "$name\[$k] = $v"; + $total += $v; + } + push @ret, "${name}_count = $total"; + } + else { + push @ret, "${name}_count = " . $value->[DIST_COUNT]; + push @ret, "${name}_total = " . $value->[DIST_TOTAL]; + } } else { warn "Unsure how to handle metric of type $type\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/Adapter.pm new/Metrics-Any-0.08/lib/Metrics/Any/Adapter.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/Adapter.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/Adapter.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020 -- leon...@leonerd.org.uk -package Metrics::Any::Adapter 0.07; +package Metrics::Any::Adapter 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/AdapterBase/Stored.pm new/Metrics-Any-0.08/lib/Metrics/Any/AdapterBase/Stored.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/AdapterBase/Stored.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/AdapterBase/Stored.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020 -- leon...@leonerd.org.uk -package Metrics::Any::AdapterBase::Stored 0.07; +package Metrics::Any::AdapterBase::Stored 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any/Collector.pm new/Metrics-Any-0.08/lib/Metrics/Any/Collector.pm --- old/Metrics-Any-0.07/lib/Metrics/Any/Collector.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any/Collector.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020 -- leon...@leonerd.org.uk -package Metrics::Any::Collector 0.07; +package Metrics::Any::Collector 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/lib/Metrics/Any.pm new/Metrics-Any-0.08/lib/Metrics/Any.pm --- old/Metrics-Any-0.07/lib/Metrics/Any.pm 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/lib/Metrics/Any.pm 2022-10-11 16:43:36.000000000 +0200 @@ -3,7 +3,7 @@ # # (C) Paul Evans, 2020-2021 -- leon...@leonerd.org.uk -package Metrics::Any 0.07; +package Metrics::Any 0.08; use v5.14; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Metrics-Any-0.07/t/14adapter-test.t new/Metrics-Any-0.08/t/14adapter-test.t --- old/Metrics-Any-0.07/t/14adapter-test.t 2021-07-21 18:31:42.000000000 +0200 +++ new/Metrics-Any-0.08/t/14adapter-test.t 2022-10-11 16:43:36.000000000 +0200 @@ -126,6 +126,27 @@ ); } +# full distributions +{ + Metrics::Any::Adapter::Test->clear; + + Metrics::Any::Adapter::Test->use_full_distributions; + + $metrics->make_distribution( fulldist => name => "the_full_distribution" ); + + $metrics->report_distribution( fulldist => 1 ); + $metrics->report_distribution( fulldist => 2 ); + $metrics->report_distribution( fulldist => 3 ); + + is( Metrics::Any::Adapter::Test->metrics, + "the_full_distribution[1] = 1\n" . + "the_full_distribution[2] = 1\n" . + "the_full_distribution[3] = 1\n" . + "the_full_distribution_count = 3\n", + 'Metrics::Any::Adapter::Test->metrics after ->report_distribution on full distribution' + ); +} + ok( $metrics, '$metrics is still true at EOF' ); done_testing;