tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ulrich Stärk <...@spielviel.de>
Subject Re: [2/5] git commit: Strip out the metrics support
Date Fri, 17 May 2013 07:36:20 GMT
Why?

On 17.05.2013 00:00, hlship@apache.org wrote:
> Strip out the metrics support
> 
> 
> Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
> Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/4fda4c80
> Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/4fda4c80
> Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/4fda4c80
> 
> Branch: refs/heads/master
> Commit: 4fda4c803dc40bb164dff4203d8358c0e3996c85
> Parents: 53443f2
> Author: Howard M. Lewis Ship <hlship@apache.org>
> Authored: Thu May 16 14:34:07 2013 -0700
> Committer: Howard M. Lewis Ship <hlship@apache.org>
> Committed: Thu May 16 14:34:07 2013 -0700
> 
> ----------------------------------------------------------------------
>  .../apache/tapestry5/corelib/pages/AppMetrics.java |   48 --
>  .../tapestry5/modules/RootMetricsFilter.java       |   52 ---
>  .../apache/tapestry5/modules/TapestryModule.java   |    2 +-
>  .../apache/tapestry5/modules/WebMetricsModule.java |   34 --
>  .../apache/tapestry5/corelib/pages/AppMetrics.tml  |    6 -
>  tapestry-ioc/build.gradle                          |    2 -
>  .../services/metrics/MetricCollectorImpl.java      |  358 ---------------
>  .../tapestry5/ioc/modules/MetricsModule.java       |   29 --
>  .../tapestry5/ioc/modules/TapestryIOCModule.java   |    3 +-
>  .../tapestry5/ioc/services/metrics/Metric.java     |  106 -----
>  .../ioc/services/metrics/MetricCollector.java      |   32 --
>  .../ioc/services/metrics/MetricsSymbols.java       |   10 -
>  12 files changed, 2 insertions(+), 680 deletions(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/AppMetrics.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/AppMetrics.java
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/AppMetrics.java
> deleted file mode 100644
> index d57b75c..0000000
> --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/pages/AppMetrics.java
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -// Copyright 2013 The Apache Software Foundation
> -//
> -// 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 org.apache.tapestry5.corelib.pages;
> -
> -import org.apache.tapestry5.annotations.WhitelistAccessOnly;
> -import org.apache.tapestry5.beaneditor.BeanModel;
> -import org.apache.tapestry5.ioc.Messages;
> -import org.apache.tapestry5.ioc.annotations.Inject;
> -import org.apache.tapestry5.ioc.services.metrics.Metric;
> -import org.apache.tapestry5.ioc.services.metrics.MetricCollector;
> -import org.apache.tapestry5.services.BeanModelSource;
> -
> -import java.util.List;
> -
> -@WhitelistAccessOnly
> -/**
> - * Contributes to the {@link T5Dashboard} page, providing application metrics from the
{@link org.apache.tapestry5.ioc.services.metrics.MetricCollector}.
> - */
> -public class AppMetrics
> -{
> -    @Inject
> -    MetricCollector collector;
> -
> -    @Inject
> -    BeanModelSource beanModelSource;
> -
> -    @Inject
> -    private Messages messages;
> -
> -    public final BeanModel<Metric> metricModel = beanModelSource.createDisplayModel(Metric.class,
messages);
> -
> -    public List<Metric> getRootMetrics()
> -    {
> -        return collector.getRootMetrics();
> -    }
> -}
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-core/src/main/java/org/apache/tapestry5/modules/RootMetricsFilter.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/RootMetricsFilter.java
b/tapestry-core/src/main/java/org/apache/tapestry5/modules/RootMetricsFilter.java
> deleted file mode 100644
> index 3d08f30..0000000
> --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/RootMetricsFilter.java
> +++ /dev/null
> @@ -1,52 +0,0 @@
> -// Copyright 2013 The Apache Software Foundation
> -//
> -// 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 org.apache.tapestry5.modules;
> -
> -import org.apache.tapestry5.ioc.services.metrics.Metric;
> -import org.apache.tapestry5.ioc.services.metrics.MetricCollector;
> -import org.apache.tapestry5.services.HttpServletRequestFilter;
> -import org.apache.tapestry5.services.HttpServletRequestHandler;
> -
> -import javax.servlet.http.HttpServletRequest;
> -import javax.servlet.http.HttpServletResponse;
> -import java.io.IOException;
> -
> -public class RootMetricsFilter implements HttpServletRequestFilter
> -{
> -
> -    private final Metric count, requestTime;
> -
> -    public RootMetricsFilter(MetricCollector collector)
> -    {
> -        count = collector.createRootMetric("request-count", Metric.Type.TOTAL, Metric.Units.COUNTER);
> -        requestTime = collector.createRootMetric("request-time", Metric.Type.RATE, Metric.Units.MILLISECONDS);
> -    }
> -
> -    public boolean service(HttpServletRequest request, HttpServletResponse response,
HttpServletRequestHandler handler) throws IOException
> -    {
> -        long start = System.currentTimeMillis();
> -
> -        boolean handled = handler.service(request, response);
> -
> -        // We don't count the unhandled requests
> -
> -        if (handled) {
> -            count.increment();
> -            requestTime.accumulate(System.currentTimeMillis() - start);
> -        }
> -
> -        return handled;
> -    }
> -}
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
> index 4f567b9..0dbe078 100644
> --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
> +++ b/tapestry-core/src/main/java/org/apache/tapestry5/modules/TapestryModule.java
> @@ -108,7 +108,7 @@ import java.util.regex.Pattern;
>   */
>  @Marker(Core.class)
>  @SubModule(
> -        {InternalModule.class, AssetsModule.class, PageLoadModule.class, JavaScriptModule.class,
CompatibilityModule.class, DashboardModule.class, WebMetricsModule.class})
> +        {InternalModule.class, AssetsModule.class, PageLoadModule.class, JavaScriptModule.class,
CompatibilityModule.class, DashboardModule.class})
>  public final class TapestryModule
>  {
>      private final PipelineBuilder pipelineBuilder;
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-core/src/main/java/org/apache/tapestry5/modules/WebMetricsModule.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/modules/WebMetricsModule.java
b/tapestry-core/src/main/java/org/apache/tapestry5/modules/WebMetricsModule.java
> deleted file mode 100644
> index 7778e94..0000000
> --- a/tapestry-core/src/main/java/org/apache/tapestry5/modules/WebMetricsModule.java
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -// Copyright 2013 The Apache Software Foundation
> -//
> -// 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 org.apache.tapestry5.modules;
> -
> -import org.apache.tapestry5.ioc.OrderedConfiguration;
> -import org.apache.tapestry5.ioc.annotations.Contribute;
> -import org.apache.tapestry5.services.HttpServletRequestFilter;
> -import org.apache.tapestry5.services.HttpServletRequestHandler;
> -
> -/**
> - * Responsible for contributing filters in various places, to handle metrics collection.
> - *
> - * @since 5.4
> - */
> -public class WebMetricsModule
> -{
> -    @Contribute(HttpServletRequestHandler.class)
> -    public static void addRootFilter(OrderedConfiguration<HttpServletRequestFilter>
configuration)
> -    {
> -        configuration.addInstance("RootMetrics", RootMetricsFilter.class, "before:GZip");
> -    }
> -}
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/AppMetrics.tml
> ----------------------------------------------------------------------
> diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/AppMetrics.tml
b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/AppMetrics.tml
> deleted file mode 100644
> index 736698a..0000000
> --- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/pages/AppMetrics.tml
> +++ /dev/null
> @@ -1,6 +0,0 @@
> -<t:block id="content" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"
> -        >
> -
> -    <t:grid source="rootMetrics" model="metricModel"/>"
> -
> -</t:block>
> \ No newline at end of file
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-ioc/build.gradle
> ----------------------------------------------------------------------
> diff --git a/tapestry-ioc/build.gradle b/tapestry-ioc/build.gradle
> index b08f585..e890f7e 100644
> --- a/tapestry-ioc/build.gradle
> +++ b/tapestry-ioc/build.gradle
> @@ -17,8 +17,6 @@ dependencies {
>      testCompile "org.spockframework:spock-core:${versions.spock}"
>      testCompile "commons-lang:commons-lang:2.6"
>  
> -    compile "org.rrd4j:rrd4j:2.1.1"
> -
>      provided "org.testng:testng:${versions.testng}", { transitive = false }
>  }
>  
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java
> deleted file mode 100644
> index 51cf1c9..0000000
> --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/metrics/MetricCollectorImpl.java
> +++ /dev/null
> @@ -1,358 +0,0 @@
> -// Copyright 2013 The Apache Software Foundation
> -//
> -// 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 org.apache.tapestry5.ioc.internal.services.metrics;
> -
> -import org.apache.tapestry5.func.F;
> -import org.apache.tapestry5.ioc.annotations.PostInjection;
> -import org.apache.tapestry5.ioc.annotations.PreventServiceDecoration;
> -import org.apache.tapestry5.ioc.annotations.Symbol;
> -import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
> -import org.apache.tapestry5.ioc.internal.util.InternalUtils;
> -import org.apache.tapestry5.ioc.internal.util.LockSupport;
> -import org.apache.tapestry5.ioc.services.cron.IntervalSchedule;
> -import org.apache.tapestry5.ioc.services.cron.PeriodicExecutor;
> -import org.apache.tapestry5.ioc.services.metrics.Metric;
> -import org.apache.tapestry5.ioc.services.metrics.MetricCollector;
> -import org.apache.tapestry5.ioc.services.metrics.MetricsSymbols;
> -import org.apache.tapestry5.ioc.util.ExceptionUtils;
> -import org.rrd4j.ConsolFun;
> -import org.rrd4j.DsType;
> -import org.rrd4j.core.*;
> -import org.slf4j.Logger;
> -
> -import java.io.File;
> -import java.io.IOException;
> -import java.util.Date;
> -import java.util.HashMap;
> -import java.util.List;
> -import java.util.Map;
> -import java.util.concurrent.atomic.AtomicReference;
> -
> -@PreventServiceDecoration
> -public class MetricCollectorImpl extends LockSupport implements MetricCollector, Runnable
> -{
> -    private final boolean inMemory;
> -
> -    private final RrdBackendFactory factory;
> -
> -    private final Logger logger;
> -
> -    private final String dbDir;
> -
> -    private final List<Runnable> updates = CollectionFactory.newThreadSafeList();
> -
> -    public static final int HEARTBEAT = 10; // seconds
> -
> -    public static final String DS_NAME = "data";
> -
> -    public class MetricImpl extends LockSupport implements Metric, Comparable<MetricImpl>,
Runnable
> -    {
> -        private final MetricImpl parent;
> -
> -        private final Map<String, Metric> children = new HashMap<String, Metric>();
> -
> -        private final String name;
> -
> -        private final String path;
> -
> -        private final Type type;
> -
> -        private final Units units;
> -
> -        private final RrdDb db;
> -
> -        // TODO: May want to initialize this from stored data for Type.TOTAL
> -
> -        private final AtomicReference<Double> accumulator = new AtomicReference<Double>(0d);
> -
> -        MetricImpl(MetricImpl parent, String name, Type type, Units units)
> -        {
> -            this.name = name;
> -            assert InternalUtils.isNonBlank(name);
> -            assert type != null;
> -            assert units != null;
> -
> -            this.parent = parent;
> -
> -            // Parent may be null for a root Metric
> -            this.path = parent == null ? name : parent.getPath() + "/" + name;
> -
> -            this.type = type;
> -            this.units = units;
> -
> -            try
> -            {
> -                this.db = createDb();
> -            } catch (IOException ex)
> -            {
> -                throw new RuntimeException(String.format("Unable to create RrdDb for
'%s': %s",
> -                        path,
> -                        ExceptionUtils.toMessage(ex)), ex);
> -            }
> -
> -            updates.add(this);
> -        }
> -
> -        private RrdDb createDb() throws IOException
> -        {
> -
> -            if (inMemory)
> -            {
> -                return new RrdDb(createDef(path), factory);
> -            }
> -
> -            // TODO: If we want to support other options, such as Mongo or Berkley,
we'll need
> -            // to abstract the RRDb factory a bit further!
> -
> -            String filePath = dbDir + "/" + path + ".rrdb";
> -
> -            File dbFile = new File(filePath);
> -            dbFile.getParentFile().mkdirs();
> -
> -            if (dbFile.exists())
> -            {
> -                return new RrdDb(filePath, factory);
> -            }
> -
> -            return new RrdDb(createDef(filePath), factory);
> -        }
> -
> -        private RrdDef createDef(String filePath)
> -        {
> -            RrdDef result = new RrdDef(filePath, HEARTBEAT);
> -
> -            result.addDatasource(DS_NAME, DsType.COUNTER, HEARTBEAT, 0, Double.NaN);
> -            // One archive: average for each new data point, 10 minutes worth.
> -            result.addArchive(new ArcDef(ConsolFun.AVERAGE, .5, 1, 60));
> -
> -            return result;
> -        }
> -
> -        public int compareTo(MetricImpl o)
> -        {
> -            return this.name.compareTo(o.name);
> -        }
> -
> -        public Metric createChild(String name)
> -        {
> -            assert InternalUtils.isNonBlank(name);
> -
> -            try
> -            {
> -                acquireReadLock();
> -
> -                Metric child = children.get(name);
> -
> -                if (child == null)
> -                {
> -                    try
> -                    {
> -                        upgradeReadLockToWriteLock();
> -
> -                        // Could be a race ...
> -
> -                        child = children.get(name);
> -
> -                        if (child == null)
> -                        {
> -                            child = new MetricImpl(this, name, type, units);
> -
> -                            children.put(name, child);
> -                        }
> -                    } finally
> -                    {
> -                        downgradeWriteLockToReadLock();
> -                    }
> -                }
> -
> -                return child;
> -
> -            } finally
> -            {
> -                releaseReadLock();
> -            }
> -        }
> -
> -        public String getPath()
> -        {
> -            return path;
> -        }
> -
> -        public Type getType()
> -        {
> -            return type;
> -        }
> -
> -        public Units getUnits()
> -        {
> -            return units;
> -        }
> -
> -        public void increment()
> -        {
> -            accumulate(1);
> -        }
> -
> -        public void accumulate(double value)
> -        {
> -            while (true)
> -            {
> -                Double current = accumulator.get();
> -                Double updated = current + value;
> -
> -                // This is where an Atomic is better than a simple volatile, we can
detect
> -                // when a race condition would have caused the loss of data by overlapping
> -                // read-and-increment operations. Still miss Clojure's approach, of
course.
> -
> -                if (accumulator.compareAndSet(current, updated))
> -                {
> -                    break;
> -                }
> -            }
> -
> -            if (parent != null)
> -            {
> -                parent.accumulate(value);
> -            }
> -        }
> -
> -        public List<Metric> getChildren()
> -        {
> -            try
> -            {
> -                acquireReadLock();
> -
> -                return F.flow(children.values()).sort().toList();
> -            } finally
> -            {
> -                releaseReadLock();
> -            }
> -        }
> -
> -        public Date getLastUpdateTime()
> -        {
> -            try
> -            {
> -                return new Date(db.getLastUpdateTime());
> -            } catch (IOException ex)
> -            {
> -                return null;
> -            }
> -        }
> -
> -        public void run()
> -        {
> -            try
> -            {
> -                db.createSample().setValue(DS_NAME, accumulator.getAndSet(0d)).update();
> -            } catch (IOException ex)
> -            {
> -                logger.error(String.format("Unable to update database for metric '%s':
%s",
> -                        path,
> -                        ExceptionUtils.toMessage(ex)), ex);
> -            }
> -        }
> -    }
> -
> -    private final Map<String, Metric> rootMetrics = new HashMap<String, Metric>();
> -
> -    public MetricCollectorImpl(Logger logger, @Symbol(MetricsSymbols.RRD_DB_DIR) String
dbDir)
> -    {
> -        this.logger = logger;
> -        this.dbDir = dbDir;
> -
> -        inMemory = dbDir.equals("");
> -
> -        factory = inMemory ? new RrdMemoryBackendFactory() : new RrdNioBackendFactory();
> -
> -        logger.info(String.format("Collecting metrics %s.",
> -                inMemory ? "in memory" : (" to" + dbDir)));
> -    }
> -
> -
> -    public Metric createRootMetric(String name, Metric.Type type, Metric.Units units)
> -    {
> -
> -        try
> -        {
> -            acquireReadLock();
> -
> -            Metric result = rootMetrics.get(name);
> -
> -            if (result == null)
> -            {
> -                try
> -                {
> -                    upgradeReadLockToWriteLock();
> -
> -                    // There's a window where another thread may create the metric instead.
> -
> -                    result = rootMetrics.get(name);
> -
> -                    // But in the normal case, that won't happen and this thread has
the exclusive
> -                    // write lock to create and cache the new metric.
> -                    if (result == null)
> -                    {
> -
> -                        result = new MetricImpl(null, name, type, units);
> -
> -                        rootMetrics.put(name, result);
> -                    }
> -                } finally
> -                {
> -                    downgradeWriteLockToReadLock();
> -                }
> -            }
> -
> -            if (result.getType() != type || result.getUnits() != units)
> -            {
> -                throw new IllegalArgumentException(String.format("Metric %s already
exists and is type %s, units %s.",
> -                        result.getPath(),
> -                        result.getType().name(),
> -                        result.getUnits().name()));
> -            }
> -
> -            return result;
> -
> -        } finally
> -        {
> -            releaseReadLock();
> -        }
> -
> -    }
> -
> -    /**
> -     * Invoked every few seconds to make all the active metrics update their dbs.
> -     */
> -    public void run()
> -    {
> -        for (Runnable r : updates)
> -        {
> -            r.run();
> -        }
> -    }
> -
> -    @PostInjection
> -    public void activatePeriodicUpdates(PeriodicExecutor executor)
> -    {
> -        executor.addJob(new IntervalSchedule(HEARTBEAT * 1000),
> -                "UpdateMetrics", this);
> -    }
> -
> -    public List<Metric> getRootMetrics()
> -    {
> -        return F.flow(rootMetrics.values()).sort().toList();
> -    }
> -}
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/MetricsModule.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/MetricsModule.java
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/MetricsModule.java
> deleted file mode 100644
> index 38b2732..0000000
> --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/MetricsModule.java
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -package org.apache.tapestry5.ioc.modules;
> -
> -import org.apache.tapestry5.ioc.MappedConfiguration;
> -import org.apache.tapestry5.ioc.ServiceBinder;
> -import org.apache.tapestry5.ioc.annotations.Contribute;
> -import org.apache.tapestry5.ioc.annotations.Marker;
> -import org.apache.tapestry5.ioc.internal.services.metrics.MetricCollectorImpl;
> -import org.apache.tapestry5.ioc.services.Builtin;
> -import org.apache.tapestry5.ioc.services.FactoryDefaults;
> -import org.apache.tapestry5.ioc.services.SymbolProvider;
> -import org.apache.tapestry5.ioc.services.metrics.MetricCollector;
> -import org.apache.tapestry5.ioc.services.metrics.MetricsSymbols;
> -
> -@Marker(Builtin.class)
> -public class MetricsModule
> -{
> -
> -    public static void bind(ServiceBinder binder)
> -    {
> -        binder.bind(MetricCollector.class, MetricCollectorImpl.class);
> -    }
> -
> -    @Contribute(SymbolProvider.class)
> -    @FactoryDefaults
> -    public static void provideDefaults(MappedConfiguration<String, Object> configuration)
> -    {
> -        configuration.add(MetricsSymbols.RRD_DB_DIR, "");
> -    }
> -}
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
> index 178edf2..7f95181 100644
> --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
> +++ b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/modules/TapestryIOCModule.java
> @@ -1,4 +1,4 @@
> -// Copyright 2006-2012 The Apache Software Foundation
> +// Copyright 2006-2013 The Apache Software Foundation
>  //
>  // Licensed under the Apache License, Version 2.0 (the "License");
>  // you may not use this file except in compliance with the License.
> @@ -43,7 +43,6 @@ import static org.apache.tapestry5.ioc.OrderConstraintBuilder.before;
>   */
>  @SuppressWarnings("all")
>  @Marker(Builtin.class)
> -@SubModule(MetricsModule.class)
>  public final class TapestryIOCModule
>  {
>      public static void bind(ServiceBinder binder)
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/Metric.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/Metric.java
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/Metric.java
> deleted file mode 100644
> index 71cda59..0000000
> --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/Metric.java
> +++ /dev/null
> @@ -1,106 +0,0 @@
> -// Copyright 2013 The Apache Software Foundation
> -//
> -// 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 org.apache.tapestry5.ioc.services.metrics;
> -
> -import java.util.Date;
> -import java.util.List;
> -
> -/**
> - * @since 5.4
> - */
> -public interface Metric
> -{
> -    enum Type
> -    {
> -        /**
> -         * Storing a value accumulates into an ever increasing total. Example:
> -         * number of burgers served.
> -         */
> -        TOTAL,
> -
> -        /**
> -         * Storing a value accumulates just for the current time interval.  Example:
> -         * burgers served per second.
> -         */
> -        RATE
> -    }
> -
> -
> -    /**
> -     * Primarily used when reporting to indicate the types of values.
> -     */
> -    enum Units
> -    {
> -        /**
> -         * Appropriate when measuring bytes transferred, etc.
> -         */
> -        BYTES,
> -        /**
> -         * Useful when measuring the time to produce a result, such as processing some
kind of request.
> -         */
> -        MILLISECONDS,
> -        /**
> -         * Placeholder for all other kinds of units, such as "pages viewed" or "messages
processed".
> -         */
> -        COUNTER
> -    }
> -
> -    /**
> -     * Creates a child metric with the same type and units.
> -     * Values posted to the child are also posted to the container (this
> -     * bubbling up can occur across several levels).
> -     *
> -     * @param name
> -     *         child's extension to this Metric's name
> -     * @return the child with the given name (creating it if necessary).
> -     */
> -    Metric createChild(String name);
> -
> -    /**
> -     * Returns the path to this metric: the metric's name appended (after a slash) to
the parent
> -     * metric's path.
> -     */
> -    String getPath();
> -
> -    Type getType();
> -
> -    Units getUnits();
> -
> -    /**
> -     * Accumulates a value of 1; useful  when the metric's type is {@link Units#COUNTER}.
> -     */
> -    void increment();
> -
> -    /**
> -     * Adds the provided value to the current time interval's value. This may be called
multiple times during
> -     * a time interval, and the values will accumulate. In addition, {@link #accumulate(double)}
> -     * propagates the value up to the parent metrics, if any, all the way up to the
root metric.
> -     *
> -     * @param value
> -     */
> -    void accumulate(double value);
> -
> -    /**
> -     * Returns the children of this metric, sorted by name.
> -     */
> -    List<Metric> getChildren();
> -
> -    /**
> -     * Returns the last time the archive was updated (this happens a regular intervals
called heartbeats).
> -     *
> -     * @return archive update time, or null if there is an exception accessing the time
> -     */
> -    Date getLastUpdateTime();
> -}
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricCollector.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricCollector.java
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricCollector.java
> deleted file mode 100644
> index e5c168f..0000000
> --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricCollector.java
> +++ /dev/null
> @@ -1,32 +0,0 @@
> -package org.apache.tapestry5.ioc.services.metrics;
> -
> -import java.util.List;
> -
> -/**
> - * Central hub for creating or obtaining {@link Metric}s.
> - *
> - * @since 5.4
> - */
> -public interface MetricCollector
> -{
> -    /**
> -     * Creates a root metric, or returns an existing one.
> -     *
> -     * @param name
> -     *         name of the metric to create
> -     * @param type
> -     *         used when creating the metric
> -     * @param units
> -     *         used when creating the metric
> -     * @return the metric
> -     * @throws IllegalMonitorStateException
> -     *         if an existing root metric with that name is present, but does
> -     *         not have the matching type and units.
> -     */
> -    Metric createRootMetric(String name, Metric.Type type, Metric.Units units);
> -
> -    /**
> -     * Returns root metrics, sorted by name.
> -     */
> -    List<Metric> getRootMetrics();
> -}
> 
> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/4fda4c80/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricsSymbols.java
> ----------------------------------------------------------------------
> diff --git a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricsSymbols.java
b/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricsSymbols.java
> deleted file mode 100644
> index 39c9bb1..0000000
> --- a/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/metrics/MetricsSymbols.java
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -package org.apache.tapestry5.ioc.services.metrics;
> -
> -public class MetricsSymbols
> -{
> -    /**
> -     * The directory in which RRDb database files are stored. If blank (the default),
> -     * then RRD is set up for in-memory databases only (re-created on each launch of
the application).
> -     */
> -    public static final String RRD_DB_DIR = "tapestry.rrd-dir";
> -}
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


Mime
View raw message