diff --git a/settings.gradle b/settings.gradle index 207dd95c6..ccd7a41d0 100755 --- a/settings.gradle +++ b/settings.gradle @@ -7,7 +7,6 @@ include 'spectator-api', 'spectator-ext-log4j2', 'spectator-ext-sandbox', 'spectator-ext-spark', - 'spectator-reg-metrics2', 'spectator-reg-metrics3', 'spectator-reg-servo', 'spectator-reg-tdigest' diff --git a/spectator-reg-metrics2/build.gradle b/spectator-reg-metrics2/build.gradle deleted file mode 100644 index 9a831ae9d..000000000 --- a/spectator-reg-metrics2/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -dependencies { - compile project(':spectator-api') - compile 'com.yammer.metrics:metrics-core:2.2.0' - jmh project(':spectator-api') -} diff --git a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsCounter.java b/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsCounter.java deleted file mode 100644 index 9efe3da1a..000000000 --- a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsCounter.java +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright 2015 Netflix, Inc. - * - * Licensed 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 com.netflix.spectator.metrics2; - -import com.netflix.spectator.api.Clock; -import com.netflix.spectator.api.Counter; -import com.netflix.spectator.api.Id; -import com.netflix.spectator.api.Measurement; - -import java.util.Collections; - -/** Counter implementation for the metrics2 registry. */ -class MetricsCounter implements Counter { - - private final Clock clock; - private final Id id; - private final com.yammer.metrics.core.Meter impl; - - /** Create a new instance. */ - MetricsCounter(Clock clock, Id id, com.yammer.metrics.core.Meter impl) { - this.clock = clock; - this.id = id; - this.impl = impl; - } - - @Override public Id id() { - return id; - } - - @Override public boolean hasExpired() { - return false; - } - - @Override public Iterable measure() { - long now = clock.wallTime(); - long v = impl.count(); - return Collections.singleton(new Measurement(id, now, v)); - } - - @Override public void increment() { - impl.mark(); - } - - @Override public void increment(long amount) { - impl.mark(amount); - } - - @Override public long count() { - return impl.count(); - } -} diff --git a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsDistributionSummary.java b/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsDistributionSummary.java deleted file mode 100644 index 5b2db5820..000000000 --- a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsDistributionSummary.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 2015 Netflix, Inc. - * - * Licensed 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 com.netflix.spectator.metrics2; - -import com.netflix.spectator.api.Clock; -import com.netflix.spectator.api.DistributionSummary; -import com.netflix.spectator.api.Id; -import com.netflix.spectator.api.Measurement; - -import java.util.Collections; - -/** Distribution summary implementation for the metric2 registry. */ -class MetricsDistributionSummary implements DistributionSummary { - - private final Clock clock; - private final Id id; - private final com.yammer.metrics.core.Histogram impl; - - /** Create a new instance. */ - MetricsDistributionSummary(Clock clock, Id id, com.yammer.metrics.core.Histogram impl) { - this.clock = clock; - this.id = id; - this.impl = impl; - } - - @Override public Id id() { - return id; - } - - @Override public boolean hasExpired() { - return false; - } - - @Override public void record(long amount) { - impl.update(amount); - } - - @Override public Iterable measure() { - final long now = clock.wallTime(); - return Collections.singleton(new Measurement(id, now, impl.mean())); - } - - @Override public long count() { - return impl.count(); - } - - @Override public long totalAmount() { - return (long) impl.sum(); - } -} diff --git a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsRegistry.java b/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsRegistry.java deleted file mode 100644 index 82d89501b..000000000 --- a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsRegistry.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Copyright 2015 Netflix, Inc. - * - * Licensed 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 com.netflix.spectator.metrics2; - -import com.netflix.spectator.api.*; -import com.yammer.metrics.Metrics; -import com.yammer.metrics.core.MetricName; - -import java.util.concurrent.TimeUnit; - -/** Registry implementation that maps spectator types to the metrics2 library. */ -public class MetricsRegistry extends AbstractRegistry { - - private final com.yammer.metrics.core.MetricsRegistry impl; - - /** Create a new instance. */ - public MetricsRegistry() { - this(Clock.SYSTEM, Metrics.defaultRegistry()); - } - - /** Create a new instance. */ - public MetricsRegistry(Clock clock, com.yammer.metrics.core.MetricsRegistry impl) { - super(clock); - this.impl = impl; - } - - private MetricName toMetricName(Id id) { - final String name = id.name(); - final int pos = name.lastIndexOf("."); - if (pos != -1) { - final String prefix = name.substring(0, pos); - final String suffix = name.substring(pos + 1); - return new MetricName("spectator", prefix, suffix); - } else { - return new MetricName("spectator", "default", id.name()); - } - } - - @Override protected Counter newCounter(Id id) { - final MetricName name = toMetricName(id); - return new MetricsCounter(clock(), id, impl.newMeter(name, "calls", TimeUnit.SECONDS)); - } - - @Override protected DistributionSummary newDistributionSummary(Id id) { - final MetricName name = toMetricName(id); - return new MetricsDistributionSummary(clock(), id, impl.newHistogram(name, false)); - } - - @Override protected Timer newTimer(Id id) { - final MetricName name = toMetricName(id); - return new MetricsTimer(clock(), id, impl.newTimer(name, TimeUnit.SECONDS, TimeUnit.SECONDS)); - } -} diff --git a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsTimer.java b/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsTimer.java deleted file mode 100644 index 46b027189..000000000 --- a/spectator-reg-metrics2/src/main/java/com/netflix/spectator/metrics2/MetricsTimer.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright 2015 Netflix, Inc. - * - * Licensed 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 com.netflix.spectator.metrics2; - -import com.netflix.spectator.api.AbstractTimer; -import com.netflix.spectator.api.Clock; -import com.netflix.spectator.api.Id; -import com.netflix.spectator.api.Measurement; - -import java.util.Collections; -import java.util.concurrent.TimeUnit; - -/** Timer implementation for the metrics2 registry. */ -class MetricsTimer extends AbstractTimer { - - private final Id id; - private final com.yammer.metrics.core.Timer impl; - - /** Create a new instance. */ - MetricsTimer(Clock clock, Id id, com.yammer.metrics.core.Timer impl) { - super(clock); - this.id = id; - this.impl = impl; - } - - @Override public Id id() { - return id; - } - - @Override public boolean hasExpired() { - return false; - } - - @Override public void record(long amount, TimeUnit unit) { - impl.update(amount, unit); - } - - @Override public Iterable measure() { - final long now = clock.wallTime(); - return Collections.singleton(new Measurement(id, now, impl.meanRate())); - } - - @Override public long count() { - return impl.count(); - } - - @Override public long totalTime() { - return (long) impl.sum(); - } -} diff --git a/spectator-reg-metrics2/src/main/resources/META-INF/services/com.netflix.spectator.api.Registry b/spectator-reg-metrics2/src/main/resources/META-INF/services/com.netflix.spectator.api.Registry deleted file mode 100644 index dc8ac67dc..000000000 --- a/spectator-reg-metrics2/src/main/resources/META-INF/services/com.netflix.spectator.api.Registry +++ /dev/null @@ -1 +0,0 @@ -com.netflix.spectator.metrics2.MetricsRegistry