ZEST-192 Remove Yammer Metrics extension
Project: http://git-wip-us.apache.org/repos/asf/zest-java/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-java/commit/72d5ca86 Tree: http://git-wip-us.apache.org/repos/asf/zest-java/tree/72d5ca86 Diff: http://git-wip-us.apache.org/repos/asf/zest-java/diff/72d5ca86 Branch: refs/heads/develop Commit: 72d5ca869efe369e7c0fe3595f5989d80f12ba18 Parents: 8453ce3 Author: Paul Merlin <[email protected]> Authored: Mon Nov 7 14:57:22 2016 +0100 Committer: Paul Merlin <[email protected]> Committed: Mon Nov 7 14:57:22 2016 +0100 ---------------------------------------------------------------------- extensions/metrics-yammer/build.gradle | 35 ---- extensions/metrics-yammer/dev-status.xml | 39 ---- .../metrics-yammer/src/docs/metrics-yammer.txt | 32 ---- .../zest/metrics/yammer/YammerCounter.java | 60 ------ .../apache/zest/metrics/yammer/YammerGauge.java | 41 ----- .../zest/metrics/yammer/YammerHealthCheck.java | 67 ------- .../zest/metrics/yammer/YammerHistogram.java | 41 ----- .../apache/zest/metrics/yammer/YammerMeter.java | 47 ----- .../metrics/yammer/YammerMetricsAssembler.java | 102 ----------- .../zest/metrics/yammer/YammerMetricsMixin.java | 183 ------------------- .../metrics/yammer/YammerMetricsProvider.java | 50 ----- .../apache/zest/metrics/yammer/YammerTimer.java | 50 ----- .../org/apache/zest/metrics/yammer/package.html | 24 --- .../metrics/yammer/NoMetricsInstalledTest.java | 102 ----------- .../apache/zest/metrics/yammer/YammerTest.java | 102 ----------- libraries.gradle | 2 - libraries/metrics/build.gradle | 1 - .../metrics/YammerTimingCaptureTest.java | 76 -------- manual/src/docs/userguide/extensions.txt | 4 - settings.gradle | 1 - 20 files changed, 1059 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/build.gradle ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/build.gradle b/extensions/metrics-yammer/build.gradle deleted file mode 100644 index cec6199..0000000 --- a/extensions/metrics-yammer/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -description = "Apache Zest⢠Metrics Extension" - -jar { manifest { name = "Apache Zest⢠Extension - Metrics" }} - -dependencies { - - compile project(":org.apache.zest.core:org.apache.zest.core.bootstrap") - compile libraries.yammer_metrics - - testCompile project( ":org.apache.zest.core:org.apache.zest.core.testsupport" ) - - testRuntime project( ":org.apache.zest.core:org.apache.zest.core.runtime" ) - testRuntime libraries.logback - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/dev-status.xml ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/dev-status.xml b/extensions/metrics-yammer/dev-status.xml deleted file mode 100644 index a8caa69..0000000 --- a/extensions/metrics-yammer/dev-status.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - ~ - --> - -<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1 - http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> - <status> - <!--none,early,beta,stable,mature--> - <codebase>stable</codebase> - - <!-- none, brief, good, complete --> - <documentation>none</documentation> - - <!-- none, some, good, complete --> - <unittests>some</unittests> - </status> - <licenses> - <license>ALv2</license> - </licenses> -</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/docs/metrics-yammer.txt ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/docs/metrics-yammer.txt b/extensions/metrics-yammer/src/docs/metrics-yammer.txt deleted file mode 100644 index 621a9c4..0000000 --- a/extensions/metrics-yammer/src/docs/metrics-yammer.txt +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////////////////////// - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. -/////////////////////////////////////////////////////////////// - -[[extension-metrics-yammer, Yammer Metrics]] -= Yammer Metrics = - -[devstatus] --------------- -source=extensions/metrics-yammer/dev-status.xml --------------- - -Yammer Metrics - -NOTE: This Extension has no documentation yet. Learn how to contribute in <<community-docs>>. - -include::../../build/docs/buildinfo/artifact.txt[] http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerCounter.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerCounter.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerCounter.java deleted file mode 100644 index 81f1059..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerCounter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.core.Counter; -import org.apache.zest.api.metrics.MetricsCounter; - -public class YammerCounter - implements MetricsCounter -{ - private Counter counter; - - public YammerCounter( Counter counter ) - { - - this.counter = counter; - } - - @Override - public void increment() - { - counter.inc(); - } - - @Override - public void increment( int steps ) - { - counter.inc( steps ); - } - - @Override - public void decrement() - { - counter.dec(); - } - - @Override - public void decrement( int steps ) - { - counter.dec( steps ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerGauge.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerGauge.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerGauge.java deleted file mode 100644 index 22b432f..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerGauge.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.core.Gauge; -import org.apache.zest.api.metrics.MetricsGauge; - -public class YammerGauge<T> - implements MetricsGauge<T> -{ - private Gauge<T> gauge; - - public YammerGauge( Gauge<T> gauge ) - { - this.gauge = gauge; - } - - @Override - public T value() - { - return gauge.value(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHealthCheck.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHealthCheck.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHealthCheck.java deleted file mode 100644 index 7c272af..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHealthCheck.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.HealthChecks; -import com.yammer.metrics.core.HealthCheck; -import org.apache.zest.api.metrics.MetricsHealthCheck; - -public class YammerHealthCheck - implements MetricsHealthCheck -{ - private MetricsHealthCheck check; - - public YammerHealthCheck( String name, final MetricsHealthCheck check ) - { - this.check = check; - HealthChecks.register( new HealthCheck( name ) - { - @Override - protected Result check() - throws Exception - { - MetricsHealthCheck.Result result = check.check(); - String message = result.getMessage(); - if( result.isHealthy() ) - { - if( message != null ) - { - return Result.healthy( message ); - } - return Result.healthy(); - } - Throwable exception = result.getException(); - if( exception != null ) - { - return Result.unhealthy( exception ); - } - return Result.unhealthy( message ); - } - } ); - } - - @Override - public Result check() - throws Exception - { - return check.check(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHistogram.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHistogram.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHistogram.java deleted file mode 100644 index 73ab399..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerHistogram.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.core.Histogram; -import org.apache.zest.api.metrics.MetricsHistogram; - -public class YammerHistogram - implements MetricsHistogram -{ - private Histogram histogram; - - public YammerHistogram( Histogram histogram ) - { - this.histogram = histogram; - } - - @Override - public void update( long newValue ) - { - histogram.update( newValue ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMeter.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMeter.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMeter.java deleted file mode 100644 index d1244b0..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMeter.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.core.Meter; -import org.apache.zest.api.metrics.MetricsMeter; - -public class YammerMeter - implements MetricsMeter -{ - private Meter meter; - - public YammerMeter( Meter meter ) - { - this.meter = meter; - } - - @Override - public void mark() - { - meter.mark(); - } - - @Override - public void mark( int numberOfEvents ) - { - meter.mark( numberOfEvents ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsAssembler.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsAssembler.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsAssembler.java deleted file mode 100644 index 5b32b5d..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsAssembler.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.Metrics; -import com.yammer.metrics.reporting.AbstractPollingReporter; -import com.yammer.metrics.reporting.ConsoleReporter; -import com.yammer.metrics.reporting.CsvReporter; -import java.io.File; -import java.io.PrintStream; -import java.util.concurrent.TimeUnit; -import org.apache.zest.bootstrap.Assemblers; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.bootstrap.ServiceDeclaration; - -public class YammerMetricsAssembler - extends Assemblers.VisibilityIdentity<YammerMetricsAssembler> -{ - - private AbstractPollingReporter reporter; - - /** - * Default constructor only creates a Yammer JMXReporter - */ - public YammerMetricsAssembler() - { - } - - /** - * Creates a ConsoleReporter and sends the output to the given PrintStream. - * - * @param out The PrintStream to receive the output. - * @param period The reporting interval. - * @param timeunit The TimeUnit for the reporting interval. - */ - public YammerMetricsAssembler( PrintStream out, long period, TimeUnit timeunit ) - { - reporter = new ConsoleReporter( out ); - try - { - reporter.start( period, timeunit ); - } - catch( RuntimeException e ) - { - e.printStackTrace(); - throw e; - } - } - - /** - * Creates a CSV reporter and writes the result to the given directory - * - * @param outDirectory The directory to write the result to. - * @param period The reporting interval. - * @param timeunit The TimeUnit for the reporting interval. - */ - public YammerMetricsAssembler( File outDirectory, long period, TimeUnit timeunit ) - { - reporter = new CsvReporter( Metrics.defaultRegistry(), outDirectory ); - reporter.start( period, timeunit ); - } - - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - ServiceDeclaration service = module.services(YammerMetricsProvider.class) - .instantiateOnStartup() - .visibleIn(visibility()); - if( hasIdentity() ) - { - service.identifiedBy( identity() ); - } - } - - /** - * Closing any Reporter that has been started. - */ - public void shutdown() - { - reporter.shutdown(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsMixin.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsMixin.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsMixin.java deleted file mode 100644 index 302a443..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsMixin.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.Metrics; -import com.yammer.metrics.core.Counter; -import com.yammer.metrics.core.Gauge; -import com.yammer.metrics.core.MetricName; -import java.util.concurrent.TimeUnit; -import java.util.stream.Stream; -import org.apache.zest.api.injection.scope.Structure; -import org.apache.zest.api.metrics.Metric; -import org.apache.zest.api.metrics.MetricsCounter; -import org.apache.zest.api.metrics.MetricsCounterFactory; -import org.apache.zest.api.metrics.MetricsGauge; -import org.apache.zest.api.metrics.MetricsGaugeFactory; -import org.apache.zest.api.metrics.MetricsHealthCheck; -import org.apache.zest.api.metrics.MetricsHealthCheckFactory; -import org.apache.zest.api.metrics.MetricsHistogram; -import org.apache.zest.api.metrics.MetricsHistogramFactory; -import org.apache.zest.api.metrics.MetricsMeter; -import org.apache.zest.api.metrics.MetricsMeterFactory; -import org.apache.zest.api.metrics.MetricsTimer; -import org.apache.zest.api.metrics.MetricsTimerFactory; -import org.apache.zest.api.structure.Application; -import org.apache.zest.spi.metrics.MetricsProviderAdapter; - -public class YammerMetricsMixin extends MetricsProviderAdapter - implements YammerMetricsProvider -{ - @Structure - private Application app; - - @Override - protected MetricsTimerFactory createMetricsTimerFactory() - { - return new MetricsTimerFactory() - { - @Override - public MetricsTimer createTimer( String name ) - { - return new YammerTimer( Metrics.newTimer( new MetricName( "", "", name ), TimeUnit.MILLISECONDS, TimeUnit.SECONDS ) ); - } - - @Override - public Stream<Metric> registered() - { - return Stream.empty(); - } - }; - } - - @Override - protected MetricsMeterFactory createMetricsMeterFactory() - { - return new MetricsMeterFactory() - { - @Override - public MetricsMeter createMeter( String name ) - { - return new YammerMeter( Metrics.newMeter( new MetricName( "" , "", name ), "", TimeUnit.MILLISECONDS ) ); - } - - @Override - public Stream<Metric> registered() - { - return Stream.empty(); - } - }; - } - - @Override - protected MetricsHistogramFactory createMetricsHistogramFactory() - { - return new MetricsHistogramFactory() - { - @Override - public MetricsHistogram createHistogram( String name ) - { - return new YammerHistogram( Metrics.newHistogram( new MetricName( "", "", name ) ) ); - } - - @Override - public Stream<Metric> registered() - { - return Stream.empty(); - } - }; - } - - @Override - protected MetricsHealthCheckFactory createMetricsHealthCheckFactory() - { - return new MetricsHealthCheckFactory() - { - @Override - public MetricsHealthCheck registerHealthCheck( String name, MetricsHealthCheck check ) - { - return new YammerHealthCheck( name, check ); - } - - @Override - public Stream<Metric> registered() - { - return Stream.empty(); - } - }; - } - - @Override - protected MetricsGaugeFactory createMetricsGaugeFactory() - { - return new MetricsGaugeFactory() - { - @Override - public <T> MetricsGauge<T> registerGauge( String name, final MetricsGauge<T> gauge ) - { - Gauge<T> yammer = Metrics.newGauge( new MetricName( "", "", name ), new Gauge<T>() - { - - @Override - public T value() - { - return gauge.value(); - } - } ); - return new YammerGauge<>( yammer ); - } - - @Override - public Stream<Metric> registered() - { - return Stream.empty(); - } - }; - } - - @Override - protected MetricsCounterFactory createMetricsCounterFactory() - { - return new MetricsCounterFactory() - { - @Override - public MetricsCounter createCounter( String name ) - { - Counter counter = Metrics.newCounter( new MetricName( "", "", name ) ); - return new YammerCounter( counter ); - } - - @Override - public Stream<Metric> registered() - { - return Stream.empty(); - } - }; - } - - @Override - public void shutdownMetrics() - throws Exception - { - Metrics.shutdown(); - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsProvider.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsProvider.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsProvider.java deleted file mode 100644 index 980c4e8..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerMetricsProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.metrics.yammer; - -import org.apache.zest.api.activation.ActivatorAdapter; -import org.apache.zest.api.activation.Activators; -import org.apache.zest.api.metrics.MetricsProvider; -import org.apache.zest.api.mixin.Mixins; -import org.apache.zest.api.service.ServiceReference; - -@Mixins( YammerMetricsMixin.class ) -@Activators( YammerMetricsProvider.Activator.class ) -public interface YammerMetricsProvider - extends MetricsProvider -{ - - void shutdownMetrics() - throws Exception; - - class Activator - extends ActivatorAdapter<ServiceReference<YammerMetricsProvider>> - { - - @Override - public void beforePassivation( ServiceReference<YammerMetricsProvider> passivating ) - throws Exception - { - passivating.get().shutdownMetrics(); - } - - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerTimer.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerTimer.java b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerTimer.java deleted file mode 100644 index 590cf4d..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/YammerTimer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.core.Timer; -import com.yammer.metrics.core.TimerContext; -import org.apache.zest.api.metrics.MetricsTimer; - -public class YammerTimer - implements MetricsTimer -{ - private Timer timer; - - public YammerTimer( Timer timer ) - { - this.timer = timer; - } - - @Override - public Context start() - { - final TimerContext context = timer.time(); - return new Context() - { - @Override - public void stop() - { - context.stop(); - } - }; - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/package.html ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/package.html b/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/package.html deleted file mode 100644 index 0fcc725..0000000 --- a/extensions/metrics-yammer/src/main/java/org/apache/zest/metrics/yammer/package.html +++ /dev/null @@ -1,24 +0,0 @@ -<!-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, software - ~ distributed under the License is distributed on an "AS IS" BASIS, - ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ~ See the License for the specific language governing permissions and - ~ limitations under the License. - ~ - ~ - --> -<html> - <body> - <h2>Yamer Metrics.</h2> - </body> -</html> http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java b/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java deleted file mode 100644 index 0aa0f96..0000000 --- a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/NoMetricsInstalledTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.Metrics; -import com.yammer.metrics.core.MetricPredicate; -import com.yammer.metrics.reporting.ConsoleReporter; -import java.util.concurrent.TimeUnit; -import org.apache.zest.api.identity.HasIdentity; -import org.apache.zest.api.identity.StringIdentity; -import org.junit.Test; -import org.apache.zest.api.common.Optional; -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.property.Property; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractZestTest; -import org.apache.zest.test.EntityTestAssembler; - -public class NoMetricsInstalledTest extends AbstractZestTest -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.entities( Person.class ); - new EntityTestAssembler().assemble( module ); - } - - @Test - public void givenMetricsEnabledZestWhenManyEntityChangesExpectCounterToBeOneOrZeroAndChangeRateHigh() - throws UnitOfWorkCompletionException - { - ConsoleReporter reporter = new ConsoleReporter( Metrics.defaultRegistry(), System.out, MetricPredicate.ALL ); - reporter.start( 100, TimeUnit.MILLISECONDS ); - for( int i=0; i < 20000; i++ ) - { - createEntity(i); - } - for( int i=0; i < 20000; i++ ) - { - readEntity( i ); - } - } - - private void readEntity( int id ) - { - UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - try - { - Person p = uow.get( Person.class, new StringIdentity( "" + id ) ); - } - finally - { - if( uow.isOpen()) - uow.discard(); - } - } - - private void createEntity( int id ) - throws UnitOfWorkCompletionException - { - UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - try - { - uow.newEntity( Person.class, new StringIdentity( "" + id ) ); - uow.complete(); - } - finally - { - if( uow.isOpen()) - uow.discard(); - } - } - - public interface Person extends EntityComposite - { - @Optional - Property<String> name(); - - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java ---------------------------------------------------------------------- diff --git a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java b/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java deleted file mode 100644 index 06ea2b4..0000000 --- a/extensions/metrics-yammer/src/test/java/org/apache/zest/metrics/yammer/YammerTest.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ - -package org.apache.zest.metrics.yammer; - -import com.yammer.metrics.Metrics; -import com.yammer.metrics.core.MetricPredicate; -import com.yammer.metrics.reporting.ConsoleReporter; -import java.util.concurrent.TimeUnit; -import org.apache.zest.api.identity.StringIdentity; -import org.junit.Test; -import org.apache.zest.api.common.Optional; -import org.apache.zest.api.entity.EntityComposite; -import org.apache.zest.api.property.Property; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.api.unitofwork.UnitOfWorkCompletionException; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.test.AbstractZestTest; -import org.apache.zest.test.EntityTestAssembler; - -public class YammerTest extends AbstractZestTest -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.entities( Person.class ); - new EntityTestAssembler().assemble( module ); - new YammerMetricsAssembler().assemble( module ); - } - - @Test - public void givenMetricsEnabledZestWhenManyEntityChangesExpectCounterToBeOneOrZeroAndChangeRateHigh() - throws UnitOfWorkCompletionException - { - ConsoleReporter reporter = new ConsoleReporter( Metrics.defaultRegistry(), System.out, MetricPredicate.ALL ); - reporter.start( 100, TimeUnit.MILLISECONDS ); - for( int i=0; i < 20000; i++ ) - { - createEntity(i); - } - for( int i=0; i < 20000; i++ ) - { - readEntity( i ); - } - } - - private void readEntity( int id ) - { - UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - try - { - Person p = uow.get( Person.class, new StringIdentity( "" + id ) ); - } - finally - { - if( uow.isOpen()) - uow.discard(); - } - } - - private void createEntity( int id ) - throws UnitOfWorkCompletionException - { - UnitOfWork uow = unitOfWorkFactory.newUnitOfWork(); - try - { - uow.newEntity( Person.class, new StringIdentity( "" + id ) ); - uow.complete(); - } - finally - { - if( uow.isOpen()) - uow.discard(); - } - } - - public interface Person extends EntityComposite - { - @Optional - Property<String> name(); - - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/libraries.gradle ---------------------------------------------------------------------- diff --git a/libraries.gradle b/libraries.gradle index 59086b0..fc7d8b8 100644 --- a/libraries.gradle +++ b/libraries.gradle @@ -70,7 +70,6 @@ def spymemcachedVersion = '2.12.1' def sqliteVersion = '3.14.2.1' def velocityVersion = '1.7' def woodstoxVersion = '4.4.1' -def yammerMetricsVersion = '2.2.0' // 3.x exists, relocated to io.dropwizard def antVersion = '1.9.7' def awaitilityVersion = '2.0.0' @@ -212,7 +211,6 @@ rootProject.ext { bonecp: "com.jolbox:bonecp:$bonecpVersion", liquibase: "org.liquibase:liquibase-core:$liquibaseVersion", sked: "org.codeartisans:sked:$skedVersion", - yammer_metrics: "com.yammer.metrics:metrics-core:$yammerMetricsVersion", pdfbox: "org.apache.pdfbox:pdfbox:$pdfboxVersion", prefuse: "de.sciss:prefuse-core:$prefuseVersion", spymemcached: "net.spy:spymemcached:$spymemcachedVersion", http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/libraries/metrics/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/metrics/build.gradle b/libraries/metrics/build.gradle index 24823c3..f5c9cec 100644 --- a/libraries/metrics/build.gradle +++ b/libraries/metrics/build.gradle @@ -26,7 +26,6 @@ dependencies { compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap")) testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport")) - testCompile(project(":org.apache.zest.extensions:org.apache.zest.extension.metrics-yammer")) testCompile(project(":org.apache.zest.extensions:org.apache.zest.extension.metrics-codahale")) testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime")) http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/libraries/metrics/src/test/java/org/apache/zest/library/metrics/YammerTimingCaptureTest.java ---------------------------------------------------------------------- diff --git a/libraries/metrics/src/test/java/org/apache/zest/library/metrics/YammerTimingCaptureTest.java b/libraries/metrics/src/test/java/org/apache/zest/library/metrics/YammerTimingCaptureTest.java deleted file mode 100644 index 7f1b711..0000000 --- a/libraries/metrics/src/test/java/org/apache/zest/library/metrics/YammerTimingCaptureTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * - */ -package org.apache.zest.library.metrics; - -import com.yammer.metrics.Metrics; -import com.yammer.metrics.core.MetricName; -import com.yammer.metrics.core.MetricsRegistry; -import org.apache.zest.bootstrap.Assembler; -import org.apache.zest.bootstrap.Assemblers; -import org.apache.zest.metrics.yammer.YammerMetricsAssembler; -import org.apache.zest.test.metrics.MetricValuesProvider; - -import java.lang.reflect.Field; -import java.util.Collection; -import java.util.Map; - -import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static java.util.stream.Collectors.toList; - -public class YammerTimingCaptureTest extends AbstractTimingCaptureTest -{ - @Override - protected Assemblers.Visible<? extends Assembler> metricsAssembler() - { - return new YammerMetricsAssembler(); - } - - @Override - protected MetricValuesProvider metricValuesProvider() - { - MetricsRegistry metricsRegistry = Metrics.defaultRegistry(); - return new MetricValuesProvider() - { - @Override - public Collection<String> registeredMetricNames() - { - return metricsRegistry.allMetrics().keySet().stream().map( MetricName::getName ).collect( toList() ); - } - - @Override - public long timerCount( String timerName ) - { - MetricName metricName = new MetricName( "", "", timerName ); - return metricsRegistry.newTimer( metricName, MILLISECONDS, MILLISECONDS ).count(); - } - }; - } - - @Override - public void tearDown() - throws Exception - { - Field metrics = MetricsRegistry.class.getDeclaredField( "metrics" ); - metrics.setAccessible( true ); - Map m = (Map) metrics.get( Metrics.defaultRegistry() ); - m.clear(); - super.tearDown(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/manual/src/docs/userguide/extensions.txt ---------------------------------------------------------------------- diff --git a/manual/src/docs/userguide/extensions.txt b/manual/src/docs/userguide/extensions.txt index ce7d495..f59fb61 100644 --- a/manual/src/docs/userguide/extensions.txt +++ b/manual/src/docs/userguide/extensions.txt @@ -133,10 +133,6 @@ include::../../../../extensions/metrics-codahale/src/docs/metrics-codahale.txt[] :leveloffset: 2 -include::../../../../extensions/metrics-yammer/src/docs/metrics-yammer.txt[] - -:leveloffset: 2 - include::../../../../extensions/migration/src/docs/migration.txt[] :leveloffset: 2 http://git-wip-us.apache.org/repos/asf/zest-java/blob/72d5ca86/settings.gradle ---------------------------------------------------------------------- diff --git a/settings.gradle b/settings.gradle index 73b3a37..0086623 100644 --- a/settings.gradle +++ b/settings.gradle @@ -74,7 +74,6 @@ include 'core:functional', 'extensions:indexing-solr', 'extensions:indexing-sql', 'extensions:metrics-codahale', - 'extensions:metrics-yammer', 'extensions:migration', 'extensions:reindexer', 'extensions:valueserialization-orgjson',
