diff --git a/metrics-3.1.2-amqp-client35.patch b/metrics-3.1.2-amqp-client35.patch new file mode 100644 index 0000000000000000000000000000000000000000..f5d03f27c5703f79e2ca58820cc220a71b821a82 --- /dev/null +++ b/metrics-3.1.2-amqp-client35.patch @@ -0,0 +1,18 @@ +diff -Nru metrics-3.1.2/metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteRabbitMQ.java metrics-3.1.2.amqp-client/metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteRabbitMQ.java +--- metrics-3.1.2/metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteRabbitMQ.java 2015-04-26 05:55:19.000000000 +0200 ++++ metrics-3.1.2.amqp-client/metrics-graphite/src/main/java/com/codahale/metrics/graphite/GraphiteRabbitMQ.java 2015-06-08 16:23:26.168774589 +0200 +@@ -114,9 +114,11 @@ + if (isConnected()) { + throw new IllegalStateException("Already connected"); + } +- +- connection = connectionFactory.newConnection(); +- channel = connection.createChannel(); ++ try { ++ connection = connectionFactory.newConnection(); ++ channel = connection.createChannel(); ++ } catch (java.util.concurrent.TimeoutException t) { ++ } + } + + @Override diff --git a/metrics-3.1.2-ehcache-core.patch b/metrics-3.1.2-ehcache-core.patch new file mode 100644 index 0000000000000000000000000000000000000000..d54d56e2c615feb19006bdfc967d496c1283be84 --- /dev/null +++ b/metrics-3.1.2-ehcache-core.patch @@ -0,0 +1,194 @@ +diff -Nru metrics-3.1.2/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java metrics-3.1.2.ehcache-core/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java +--- metrics-3.1.2/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java 2015-04-26 05:55:19.000000000 +0200 ++++ metrics-3.1.2.ehcache-core/metrics-ehcache/src/main/java/com/codahale/metrics/ehcache/InstrumentedEhcache.java 2015-07-03 04:02:58.188731651 +0200 +@@ -6,8 +6,9 @@ + import net.sf.ehcache.CacheException; + import net.sf.ehcache.Ehcache; + import net.sf.ehcache.Element; ++import net.sf.ehcache.Statistics; + import net.sf.ehcache.constructs.EhcacheDecoratorAdapter; +-import net.sf.ehcache.statistics.StatisticsGateway; ++import net.sf.ehcache.statistics.LiveCacheStatistics; + + import java.io.Serializable; + +@@ -113,16 +114,18 @@ + * @param cache an {@link Ehcache} instance + * @param registry a {@link MetricRegistry} + * @return an instrumented decorator for {@code cache} +- * @see StatisticsGateway ++ * @see LiveCacheStatistics + */ + public static Ehcache instrument(MetricRegistry registry, final Ehcache cache) { ++ cache.setSampledStatisticsEnabled(true); ++ cache.setStatisticsAccuracy(Statistics.STATISTICS_ACCURACY_NONE); + + final String prefix = name(cache.getClass(), cache.getName()); + registry.register(name(prefix, "hits"), + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().cacheHitCount(); ++ return cache.getStatistics().getCacheHits(); + } + }); + +@@ -130,7 +133,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().localHeapHitCount(); ++ return cache.getStatistics().getInMemoryHits(); + } + }); + +@@ -138,7 +141,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().localOffHeapHitCount(); ++ return cache.getStatistics().getOffHeapHits(); + } + }); + +@@ -146,7 +149,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().localDiskHitCount(); ++ return cache.getStatistics().getOnDiskHits(); + } + }); + +@@ -154,7 +157,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().cacheMissCount(); ++ return cache.getStatistics().getCacheMisses(); + } + }); + +@@ -162,7 +165,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().localHeapMissCount(); ++ return cache.getStatistics().getInMemoryMisses(); + } + }); + +@@ -170,7 +173,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().localOffHeapMissCount(); ++ return cache.getStatistics().getOffHeapMisses(); + } + }); + +@@ -178,7 +181,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().localDiskMissCount(); ++ return cache.getStatistics().getOnDiskMisses(); + } + }); + +@@ -186,7 +189,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().getSize(); ++ return cache.getStatistics().getObjectCount(); + } + }); + +@@ -194,7 +197,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().getLocalHeapSize(); ++ return cache.getStatistics().getMemoryStoreObjectCount(); + } + }); + +@@ -202,7 +205,7 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().getLocalOffHeapSize(); ++ return cache.getStatistics().getOffHeapStoreObjectCount(); + } + }); + +@@ -210,23 +213,23 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().getLocalDiskSize(); ++ return cache.getStatistics().getDiskStoreObjectCount(); + } + }); + + registry.register(name(prefix, "mean-get-time"), +- new Gauge() { ++ new Gauge() { + @Override +- public Double getValue() { +- return cache.getStatistics().cacheGetOperation().latency().average().value(); ++ public Float getValue() { ++ return cache.getStatistics().getAverageGetTime(); + } + }); + + registry.register(name(prefix, "mean-search-time"), +- new Gauge() { ++ new Gauge() { + @Override +- public Double getValue() { +- return cache.getStatistics().cacheSearchOperation().latency().average().value(); ++ public Long getValue() { ++ return cache.getStatistics().getAverageSearchTime(); + } + }); + +@@ -234,15 +237,15 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().cacheEvictionOperation().count().value(); ++ return cache.getStatistics().getEvictionCount(); + } + }); + + registry.register(name(prefix, "searches-per-second"), +- new Gauge() { ++ new Gauge() { + @Override +- public Double getValue() { +- return cache.getStatistics().cacheSearchOperation().rate().value(); ++ public Long getValue() { ++ return cache.getStatistics().getSearchesPerSecond(); + } + }); + +@@ -250,7 +253,16 @@ + new Gauge() { + @Override + public Long getValue() { +- return cache.getStatistics().getWriterQueueLength(); ++ return cache.getStatistics().getWriterQueueSize(); ++ } ++ }); ++ ++ registry.register(name(prefix, "accuracy"), ++ new Gauge() { ++ @Override ++ public String getValue() { ++ return cache.getStatistics() ++ .getStatisticsAccuracyDescription(); + } + }); + diff --git a/metrics.spec b/metrics.spec new file mode 100644 index 0000000000000000000000000000000000000000..3aa7d85bb4601688c5a186c468ddd6f8e31bccd3 --- /dev/null +++ b/metrics.spec @@ -0,0 +1,309 @@ +Name: metrics +Version: 3.1.2 +Release: 1 +Summary: Java library which gives you what your code does in production +License: ASL 2.0 +URL: http://metrics.dropwizard.io +Source0: https://github.com/dropwizard/metrics/archive/v%{version}.tar.gz +Patch0: metrics-3.1.2-amqp-client35.patch +Patch1: metrics-3.1.2-ehcache-core.patch + +BuildRequires: maven-local mvn(ch.qos.logback:logback-classic) +BuildRequires: mvn(com.fasterxml.jackson.core:jackson-databind) mvn(com.google.guava:guava) +BuildRequires: mvn(com.rabbitmq:amqp-client) mvn(com.sun.jersey:jersey-server:1) +BuildRequires: mvn(info.ganglia.gmetric4j:gmetric4j) mvn(javax.servlet:javax.servlet-api) +BuildRequires: mvn(javax.ws.rs:javax.ws.rs-api) mvn(log4j:log4j:1.2.17) +BuildRequires: mvn(net.sf.ehcache:ehcache-core) mvn(org.apache.felix:maven-bundle-plugin) +BuildRequires: mvn(org.apache.httpcomponents:httpasyncclient) +BuildRequires: mvn(org.apache.httpcomponents:httpclient) +BuildRequires: mvn(org.apache.logging.log4j:log4j-api) +BuildRequires: mvn(org.apache.logging.log4j:log4j-core) +BuildRequires: mvn(org.apache.maven.plugins:maven-release-plugin) +BuildRequires: mvn(org.glassfish.jersey.core:jersey-server) mvn(org.jdbi:jdbi) +BuildRequires: mvn(org.openjdk.jmh:jmh-core) mvn(org.openjdk.jmh:jmh-generator-annprocess) +BuildRequires: mvn(org.slf4j:slf4j-api) +%if 0 +BuildRequires: mvn(org.eclipse.jetty:jetty-server:8.1.11.v20130520) +BuildRequires: mvn(org.eclipse.jetty:jetty-client:9.2.2.v20140723) +BuildRequires: mvn(org.eclipse.jetty:jetty-server:9.2.2.v20140723) +BuildRequires: mvn(org.eclipse.jetty:jetty-server:9.0.4.v20130625) +BuildRequires: mvn(org.eclipse.jetty:jetty-client:9.0.4.v20130625) +BuildRequires: mvn(com.sun.jersey.jersey-test-framework:jersey-test-framework-inmemory) +BuildRequires: mvn(org.glassfish.jersey.test-framework.providers:jersey-test-framework-provider-inmemory) +BuildRequires: mvn(junit:junit) mvn(org.assertj:assertj-core:jar:1.6.1) +BuildRequires: mvn(org.eclipse.jetty:jetty-servlet) mvn(org.mockito:mockito-all) +BuildRequires: mvn(org.python:jython-standalone) mvn(org.slf4j:slf4j-simple) +%endif +BuildRequires: python-sphinx /usr/bin/pdflatex +BuildArch: noarch + +%description +Metrics is a Java library which gives you unparalleled insight +into what your code does in production. +Developed by Yammer to instrument their JVM-based back-end services, +Metrics provides a powerful toolkit of ways to measure the behavior +of critical components in your production environment. +With modules for common libraries like Jetty, Logback, Log4j, +Apache HttpClient, Ehcache, JDBI, Jersey and reporting back-ends like +Ganglia and Graphite, Metrics provides you with full-stack visibility. +For more information, please see the documentation. +This package provides the Metrics Core Library. + +%package annotation +Summary: Annotations for Metrics +%description annotation +A dependency-less package of just the +annotations used by other Metrics modules. + +%package benchmarks +Summary: Benchmarks for Metrics +%description benchmarks +A development module for performance benchmarks of +Metrics classes. + +%package ehcache +Summary: Metrics Integration for Ehcache +%description ehcache +An Ehcache wrapper providing Metrics instrumentation of caches. + +%package ganglia +Summary: Ganglia Integration for Metrics +%description ganglia +A reporter for Metrics which announces measurements +to a Ganglia cluster. + +%package graphite +Summary: Graphite Integration for Metrics +%description graphite +A reporter for Metrics which announces measurements +to a Graphite server. + +%package healthchecks +Summary: Metrics Health Checks +%description healthchecks +An addition to Metrics which provides the ability to +run application-specific health checks, allowing you +to check your application's heath in production. + +%package httpasyncclient +Summary: Metrics Integration for Apache HttpAsyncClient +%description httpasyncclient +An Apache HttpAsyncClient wrapper providing Metrics +instrumentation of connection pools, request +durations and rates, and other useful information. + +%package httpclient +Summary: Metrics Integration for Apache HttpClient +%description httpclient +An Apache HttpClient wrapper providing Metrics +instrumentation of connection pools, request +durations and rates, and other useful information. + +%package jdbi +Summary: Metrics Integration for JDBI +%description jdbi +A JDBI wrapper providing Metrics instrumentation of +query durations and rates. + +%package jersey +Summary: Metrics Integration for Jersey 1.x +%description jersey +A set of class providing Metrics integration for Jersey 1.x, +the reference JAX-RS implementation. + +%package jersey2 +Summary: Metrics Integration for Jersey 2.x +%description jersey2 +A set of class providing Metrics integration for Jersey 2.x, +the reference JAX-RS implementation. +%if 0 + +%package jetty +Summary: Metrics Integration for Jetty 8/9 +%description jetty +A set of extensions for Jetty 8/9 which provide instrumentation of +thread pools, connector metrics, and application latency and +utilization. +%endif + +%package json +Summary: Jackson Integration for Metrics +%description json +A set of Jackson modules which provide serializers +for most Metrics classes. + +%package jvm +Summary: JVM Integration for Metrics +%description jvm +A set of classes which allow you to monitor +critical aspects of your Java Virtual Machine +using Metrics. + +%package log4j2 +Summary: Metrics Integration for Log4j 2.x +%description log4j2 +An instrumented appender for Log4j 2.x. + +%package log4j +Summary: Metrics Integration for Log4j +Requires: log4j12 +%description log4j +An instrumented appender for Log4j. + +%package logback +Summary: Metrics Integration for Logback +%description logback +An instrumented appender for Logback. + +%package parent +Summary: Metrics Parent POM +%description parent +This package provides Metrics Parent POM. + +%package servlet +Summary: Metrics Integration for Servlets +%description servlet +An instrumented filter for servlet environments. + +%package servlets +Summary: Metrics Utility Servlets +%description servlets +A set of utility servlets for Metrics, allowing you +to expose valuable information about your production +environment. + +%package javadoc +Summary: Javadoc for %{name} +%description javadoc +This package contains javadoc for %{name}. + +%package doc +Summary: Metrics's user manual +%description doc +This package contains %{name}'s user manual. + +%prep +%setup -q -n %{name}-%{version} +find . -name "*.class" -delete +find . -name "*.jar" -type f -delete +%patch0 -p1 +%patch1 -p1 +%pom_disable_module metrics-jetty8 +%pom_disable_module metrics-jetty9 +%pom_disable_module metrics-jetty9-legacy +%pom_remove_plugin :findbugs-maven-plugin +%pom_remove_plugin :maven-enforcer-plugin +%pom_remove_plugin -r :maven-shade-plugin +%pom_xpath_remove "pom:plugins/pom:plugin[pom:artifactId='maven-javadoc-plugin']/pom:executions" +%pom_remove_plugin :maven-source-plugin +%pom_xpath_set "pom:properties/pom:jersey.version" 1 %{name}-jersey +%pom_add_dep javax.ws.rs:javax.ws.rs-api metrics-jersey2 +sed -i "s|jersey.repackaged.||" \ + metrics-jersey2/src/main/java/com/codahale/metrics/jersey2/InstrumentedResourceMethodApplicationListener.java +%pom_add_dep com.google.guava:guava metrics-jersey2 +%pom_remove_dep -r org.assertj:assertj-core +%if 0 +%mvn_package ":%{name}-jetty8" %{name}-jetty +%mvn_package ":%{name}-jetty9" %{name}-jetty +%mvn_package ":%{name}-jetty9-legacy" %{name}-jetty +%endif +%mvn_alias io.dropwizard.metrics: com.codahale.metrics: + +%build +%mvn_build -s -f +( + cd docs +%if 0 + make %{?_smp_mflags} latexpdf +%endif + make %{?_smp_mflags} singlehtml + make %{?_smp_mflags} man +) + +%install +%mvn_install +mkdir -p %{buildroot}%{_mandir}/man1 +install -pm 644 docs/target/man/%{name}.1 %{buildroot}%{_mandir}/man1/ +rm -rf docs/target/singlehtml/.buildinfo + +%files -f .mfiles-%{name}-core +%doc README.md +%license LICENSE NOTICE + +%files annotation -f .mfiles-%{name}-annotation +%license LICENSE NOTICE + +%files benchmarks -f .mfiles-%{name}-benchmarks +%doc %{name}-benchmarks/README.md +%license LICENSE NOTICE + +%files ehcache -f .mfiles-%{name}-ehcache +%license LICENSE NOTICE + +%files ganglia -f .mfiles-%{name}-ganglia +%license LICENSE NOTICE + +%files graphite -f .mfiles-%{name}-graphite +%license LICENSE NOTICE + +%files healthchecks -f .mfiles-%{name}-healthchecks +%license LICENSE NOTICE + +%files httpasyncclient -f .mfiles-%{name}-httpasyncclient +%license LICENSE NOTICE + +%files httpclient -f .mfiles-%{name}-httpclient +%license LICENSE NOTICE + +%files jdbi -f .mfiles-%{name}-jdbi +%license LICENSE NOTICE + +%files jersey -f .mfiles-%{name}-jersey +%license LICENSE NOTICE + +%files jersey2 -f .mfiles-%{name}-jersey2 +%license LICENSE NOTICE +%if 0 + +%files jetty -f .mfiles-%{name}-jetty +%license LICENSE NOTICE +%endif + +%files json -f .mfiles-%{name}-json +%license LICENSE NOTICE + +%files jvm -f .mfiles-%{name}-jvm +%license LICENSE NOTICE + +%files log4j2 -f .mfiles-%{name}-log4j2 +%license LICENSE NOTICE + +%files log4j -f .mfiles-%{name}-log4j +%license LICENSE NOTICE + +%files logback -f .mfiles-%{name}-logback +%license LICENSE NOTICE + +%files parent -f .mfiles-%{name}-parent +%license LICENSE NOTICE + +%files servlet -f .mfiles-%{name}-servlet +%license LICENSE NOTICE + +%files servlets -f .mfiles-%{name}-servlets +%license LICENSE NOTICE + +%files javadoc -f .mfiles-javadoc +%license LICENSE NOTICE + +%files doc +%{_mandir}/man1/%{name}.* +%license LICENSE NOTICE +%doc docs/target/singlehtml +%if 0 +%doc docs/target/latex/*.pdf +%endif + +%changelog +* Thu Jul 30 2020 maminjie - 3.1.2-1 +- package init diff --git a/metrics.yaml b/metrics.yaml new file mode 100644 index 0000000000000000000000000000000000000000..78878a248bd5cd571e3b9f913b6585b7762fa9d6 --- /dev/null +++ b/metrics.yaml @@ -0,0 +1,4 @@ +version_control: github +src_repo: dropwizard/metrics +tag_prefix: ^v +seperator: "." diff --git a/v3.1.2.tar.gz b/v3.1.2.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..e0595e27ab5deccbd2c4ac686b01b7dac3c3435a Binary files /dev/null and b/v3.1.2.tar.gz differ