You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by eo...@apache.org on 2020/05/10 13:04:38 UTC

[maven-metric] 01/01: Initial commit

This is an automated email from the ASF dual-hosted git repository.

eolivelli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-metric.git

commit cab4edb943be56d379123fb8b41c2e3dab1b43f9
Author: Enrico Olivelli <eo...@apache.org>
AuthorDate: Sun May 10 15:04:24 2020 +0200

    Initial commit
---
 .gitignore                                         |  15 ++
 maven-metrics-api/pom.xml                          |  44 ++++++
 .../java/org/apache/maven/metrics/Counter.java     |  54 +++++++
 .../main/java/org/apache/maven/metrics/Gauge.java  |  38 +++++
 .../main/java/org/apache/maven/metrics/Metric.java |  47 +++++++
 .../org/apache/maven/metrics/MetricsContext.java   |  92 ++++++++++++
 .../org/apache/maven/metrics/MetricsProvider.java  |  71 ++++++++++
 .../metrics/MetricsProviderLifeCycleException.java |  51 +++++++
 .../org/apache/maven/metrics/MetricsSystem.java    |  42 ++++++
 .../java/org/apache/maven/metrics/Summary.java     |  37 +++++
 .../java/org/apache/maven/metrics/SummarySet.java  |  39 ++++++
 .../maven/metrics/impl/NullMetricsProvider.java    | 132 ++++++++++++++++++
 pom.xml                                            | 155 +++++++++++++++++++++
 13 files changed, 817 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f79c928
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,15 @@
+target/
+.project
+.classpath
+.settings/
+.svn/
+bin/
+# Intellij
+*.ipr
+*.iml
+.idea
+out/
+.DS_Store
+/bootstrap
+/dependencies.xml
+.java-version
diff --git a/maven-metrics-api/pom.xml b/maven-metrics-api/pom.xml
new file mode 100644
index 0000000..6f4fb93
--- /dev/null
+++ b/maven-metrics-api/pom.xml
@@ -0,0 +1,44 @@
+<?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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-metric</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>maven-metrics-api</artifactId>
+
+  <name>Maven Metrics API</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+  </dependencies>
+
+  <build>
+  </build>
+</project>
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/Counter.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Counter.java
new file mode 100644
index 0000000..e2eb1d1
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Counter.java
@@ -0,0 +1,54 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * A counter refers to a value which can only increase.
+ * Usually the value is reset when the process starts.
+ */
+public interface Counter
+{
+
+    /**
+     * Increment the value by one.
+     * <p>This method is thread safe, The MetricsProvider will take care of synchronization.</p>
+     */
+    default void inc()
+    {
+        add( 1 );
+    }
+
+    /**
+     * Increment the value by a given amount.
+     * <p>This method is thread safe, The MetricsProvider will take care of synchronization.</p>
+     *
+     * @param delta amount to increment, this cannot be a negative number.
+     */
+    void add( long delta );
+
+    /**
+     * Get the current value held by the counter.
+     * <p>This method is thread safe, The MetricsProvider will take care of synchronization.</p>
+     *
+     * @return the current value
+     */
+    long get();
+
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/Gauge.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Gauge.java
new file mode 100644
index 0000000..1c6559c
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Gauge.java
@@ -0,0 +1,38 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * A Gauge is an application provided object which will be called by the framework in order to sample the value
+ * of an integer value.
+ */
+public interface Gauge
+{
+
+    /**
+     * Returns the current value associated with this gauge.
+     * The MetricsProvider will call this callback without taking care of synchronization, it is up to the application
+     * to handle thread safety.
+     *
+     * @return the current value for the gauge
+     */
+    Number get();
+
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/Metric.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Metric.java
new file mode 100644
index 0000000..f77c850
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Metric.java
@@ -0,0 +1,47 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * Interface common to every metrics.
+ * It allows the user to define common metadata about the metric.
+ */
+public interface Metric
+{
+    /**
+     * Define a textual label for the metric
+     * @param label the label (plain text)
+     * @return the metric handle itself
+     */
+    default <T extends Metric> T setLabel( String label )
+    {
+        return (T) this;
+    }
+
+    /**
+     * Define a textual help for the metric
+     * @param help the help (plain text)
+     * @return the metric handle itself
+     */
+    default <T extends Metric> T setHelp( String help )
+    {
+        return (T) this;
+    }
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsContext.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsContext.java
new file mode 100644
index 0000000..cb85793
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsContext.java
@@ -0,0 +1,92 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * A MetricsContext is like a namespace for metrics. Each component/submodule
+ * will have its own MetricsContext.
+ * <p>
+ * In some cases it is possible to have a separate MetricsContext for each
+ * instance of a component, for instance on the server side a possible usecase
+ * it to gather metrics for every other peer.
+ * </p>
+ * <p>
+ * Contexts are organized in a hierarchy.
+ * </p>
+ *
+ */
+public interface MetricsContext
+{
+
+    /**
+     * Returns a sub context.
+     *
+     * @param name the name of the subcontext
+     *
+     * @return a new metrics context.
+     */
+    MetricsContext getContext( String name );
+
+    /**
+     * Returns a counter.
+     *
+     * @param name
+     * @return the counter identified by name in this context.
+     */
+    Counter getCounter( String name, String description );
+
+    /**
+     * Registers an user provided {@link Gauge} which will be called by the
+     * MetricsProvider in order to sample an integer value.
+     * If another Gauge was already registered the new one will
+     * take its place.
+     * Registering a null callback is not allowed.
+     *
+     * @param name unique name of the Gauge in this context
+     * @param gauge the implementation of the Gauge
+     *
+     */
+    void registerGauge( String name, String description, Gauge gauge );
+
+    /**
+     * Unregisters the user provided {@link Gauge} bound to the given name.
+     *
+     * @param name unique name of the Gauge in this context
+     *
+     */
+    void unregisterGauge( String name );
+
+    /**
+     * Returns a summary.
+     *
+     * @param name
+     * @return the summary identified by name in this context.
+     */
+    Summary getSummary( String name, String description );
+
+    /**
+     * Returns a set of summaries.
+     *
+     * @param name
+     * @return the summary identified by name in this context.
+     */
+    SummarySet getSummarySet( String name, String description );
+
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsProvider.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsProvider.java
new file mode 100644
index 0000000..f4af144
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsProvider.java
@@ -0,0 +1,71 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * A MetricsProvider is a system which collects Metrics and publishes current values to external facilities.
+ *
+ * The system will create an instance of the configured class using the default constructor, which must be public.<br>
+ * After the instantiation of the provider, the system will call {@link #configure(java.util.Properties) }
+ * in order to provide configuration,
+ * and then when the system is ready to work it will call {@link #start() }.
+ * <br>
+ * Providers can be used both on ZooKeeper servers and on ZooKeeper clients.
+ */
+public interface MetricsProvider
+{
+    /**
+     * Start the provider.
+     * For instance such method will start a network endpoint.
+     *
+     * @throws MetricsProviderLifeCycleException in case of failure
+     */
+    default void start() throws MetricsProviderLifeCycleException
+    {
+    }
+
+    /**
+     * Provides access to the root context.
+     *
+     * @return the root context
+     */
+    MetricsContext getRootContext();
+
+    /**
+     * Releases resources held by the provider.<br>
+     * This method must not throw exceptions.
+     * The provider may dump the results to the logs or send
+     * the results to an external <br>
+     * This method can be called more than once.
+     */
+    default void stop()
+    {
+    }
+
+    /**
+     * Reset all values.
+     * This method is optional and can be noop, depending
+     * on the underlying implementation.
+     */
+    default void resetAllValues()
+    {
+    }
+
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsProviderLifeCycleException.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsProviderLifeCycleException.java
new file mode 100644
index 0000000..ecf7d5b
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsProviderLifeCycleException.java
@@ -0,0 +1,51 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * A generic exception thrown during the licecycle of a MetricsProvider.
+ * <p>These exception will prevent the system from booting.</p>
+ * <p>Normally these exception will be ignored during shutdown.</p>
+ */
+public class MetricsProviderLifeCycleException extends Exception
+{
+
+    private static final long serialVersionUID = 1L;
+
+    public MetricsProviderLifeCycleException()
+    {
+    }
+
+    public MetricsProviderLifeCycleException( String message )
+    {
+        super( message );
+    }
+
+    public MetricsProviderLifeCycleException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+    public MetricsProviderLifeCycleException( Throwable cause )
+    {
+        super( cause );
+    }
+
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsSystem.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsSystem.java
new file mode 100644
index 0000000..9e70db5
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/MetricsSystem.java
@@ -0,0 +1,42 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * Component to access Metrics System
+ * @author Enrico Olivelli
+ */
+public interface MetricsSystem
+{
+
+    String HINT = "metricsSystem";
+    
+    /**
+     * Access current metrics context.
+     * @return the metrics context
+     */
+    MetricsContext getMetricsContext();
+    
+    /**
+     * Low level Access to the Provider
+     * @return the provider
+     */
+    MetricsProvider getMetricsProvider();
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/Summary.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Summary.java
new file mode 100644
index 0000000..9ad49c1
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/Summary.java
@@ -0,0 +1,37 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * Summaries track the size and number of events.
+ * They are able to publish minumum, maximum, average values, depending on the capabilities of the MetricsProvider.
+ */
+public interface Summary
+{
+
+    /**
+     * Register a value.
+     * <p>This method is thread safe, The MetricsProvider will take care of synchronization.</p>
+     *
+     * @param value current value
+     */
+    void add( long value );
+
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/SummarySet.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/SummarySet.java
new file mode 100644
index 0000000..e31764a
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/SummarySet.java
@@ -0,0 +1,39 @@
+package org.apache.maven.metrics;
+
+/*
+ * 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.
+ */
+
+/**
+ * Summaries track the size and number of events.
+ * They are able to publish minumum, maximum, average values, depending on the capabilities of the MetricsProvider.
+ * A SummarySet is a set of {@link Summary}.
+ */
+public interface SummarySet
+{
+
+    /**
+     * Register a value.
+     * <p>This method is thread safe, The MetricsProvider will take care of synchronization.</p>
+     *
+     * @param key the key to access the Summary for the given key
+     * @param value current value
+     */
+    void add( String key, long value );
+
+}
diff --git a/maven-metrics-api/src/main/java/org/apache/maven/metrics/impl/NullMetricsProvider.java b/maven-metrics-api/src/main/java/org/apache/maven/metrics/impl/NullMetricsProvider.java
new file mode 100644
index 0000000..a94c3b2
--- /dev/null
+++ b/maven-metrics-api/src/main/java/org/apache/maven/metrics/impl/NullMetricsProvider.java
@@ -0,0 +1,132 @@
+package org.apache.maven.metrics.impl;
+
+/*
+ * 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.
+ */
+
+import org.apache.maven.metrics.Counter;
+import org.apache.maven.metrics.Gauge;
+import org.apache.maven.metrics.MetricsContext;
+import org.apache.maven.metrics.MetricsProvider;
+import org.apache.maven.metrics.Summary;
+import org.apache.maven.metrics.SummarySet;
+
+/**
+ * This is a dummy MetricsProvider which does nothing.
+ */
+public class NullMetricsProvider implements MetricsProvider
+{
+
+    /**
+     * Instance of NullMetricsProvider useful for tests.
+     */
+    public static final MetricsProvider INSTANCE = new NullMetricsProvider();
+
+    @Override
+    public MetricsContext getRootContext()
+    {
+        return NullMetricsContext.INSTANCE;
+    }
+
+    /**
+     * Default no-op implementation.
+     */
+    public static final class NullMetricsContext implements MetricsContext
+    {
+
+        public static final NullMetricsContext INSTANCE = new NullMetricsContext();
+
+        @Override
+        public MetricsContext getContext( String name )
+        {
+            return INSTANCE;
+        }
+
+        @Override
+        public Counter getCounter( String name, String description )
+        {
+            return NullCounter.INSTANCE;
+        }
+
+        @Override
+        public void registerGauge( String name, String description, Gauge gauge )
+        {
+        }
+
+        @Override
+        public void unregisterGauge( String name )
+        {
+        }
+
+        @Override
+        public Summary getSummary( String name, String description )
+        {
+            return NullSummary.INSTANCE;
+        }
+
+        @Override
+        public SummarySet getSummarySet( String name, String description )
+        {
+            return NullSummarySet.INSTANCE;
+        }
+
+    }
+
+    private static final class NullCounter implements Counter
+    {
+
+        private static final NullCounter INSTANCE = new NullCounter();
+
+        @Override
+        public void add( long delta )
+        {
+        }
+
+        @Override
+        public long get()
+        {
+            return 0;
+        }
+
+    }
+
+    private static final class NullSummary implements Summary
+    {
+
+        private static final NullSummary INSTANCE = new NullSummary();
+
+        @Override
+        public void add( long value )
+        {
+        }
+
+    }
+
+    private static final class NullSummarySet implements SummarySet
+    {
+
+        private static final NullSummarySet INSTANCE = new NullSummarySet();
+
+        @Override
+        public void add( String key, long value )
+        {
+        }
+
+    }
+
+}
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..cbdd8bb
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,155 @@
+<?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.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven</groupId>
+    <artifactId>maven-parent</artifactId>
+    <version>34</version>
+    <relativePath>../pom/maven/pom.xml</relativePath>
+  </parent>
+
+  <artifactId>maven-metric</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <name>Apache Maven Metrics</name>
+  <description>Maven is a software build management and
+    comprehension tool. Based on the concept of a project object model:
+    builds, dependency management, documentation creation, site
+    publication, and distribution publication are all controlled from
+    the declarative file. Maven can be extended by plugins to utilise a
+    number of other development tools for reporting or the build
+    process.
+  </description>
+  <url>https://maven.apache.org/</url>
+  <inceptionYear>2020</inceptionYear>
+
+  <properties>
+    <maven.compiler.source>1.8</maven.compiler.source>
+    <maven.compiler.target>1.8</maven.compiler.target>
+    <commonsLangVersion>3.8.1</commonsLangVersion>
+    <project.build.outputTimestamp>2019-11-07T12:32:18Z</project.build.outputTimestamp>
+  </properties>
+
+  <modules>
+    <module>maven-metrics-api</module>
+  </modules>
+
+  <scm>
+    <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-metric.git</connection>
+    <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-metric.git</developerConnection>
+    <url>https://github.com/apache/maven-metric/tree/${project.scm.tag}</url>
+    <tag>master</tag>
+  </scm>
+  <issueManagement>
+    <system>jira</system>
+    <url>https://issues.apache.org/jira/browse/MNG</url>
+  </issueManagement>
+  <ciManagement>
+    <system>Jenkins</system>
+    <url>https://builds.apache.org/job/maven-box/job/maven/</url>
+  </ciManagement>
+  <distributionManagement>
+    <downloadUrl>https://maven.apache.org/download.html</downloadUrl>
+    <site>
+      <id>apache.website</id>
+      <url>scm:svn:https://svn.apache.org/repos/asf/maven-metric/website/components/${maven.site.path}</url>
+    </site>
+  </distributionManagement>
+
+  <contributors>
+  </contributors>
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.apache.commons</groupId>
+        <artifactId>commons-lang3</artifactId>
+        <version>${commonsLangVersion}</version>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.codehaus.plexus</groupId>
+          <artifactId>plexus-component-metadata</artifactId>
+          <version>${plexusVersion}</version>
+          <executions>
+            <execution>
+              <goals>
+                <goal>generate-metadata</goal>
+                <goal>generate-test-metadata</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.eclipse.sisu</groupId>
+          <artifactId>sisu-maven-plugin</artifactId>
+          <version>${sisuInjectVersion}</version>
+          <executions>
+            <execution>
+              <goals>
+                <goal>main-index</goal>
+                <goal>test-index</goal>
+              </goals>
+            </execution>
+          </executions>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-release-plugin</artifactId>
+          <configuration>
+            <autoVersionSubmodules>true</autoVersionSubmodules>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>animal-sniffer-maven-plugin</artifactId>
+        <version>1.18</version>
+        <configuration>
+          <signature>
+            <groupId>org.codehaus.mojo.signature</groupId>
+            <artifactId>java18</artifactId>
+            <version>1.0</version>
+          </signature>
+        </configuration>
+        <executions>
+          <execution>
+            <id>check-java-compat</id>
+            <phase>process-classes</phase>
+            <goals>
+              <goal>check</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  
+</project>