[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user asfgit closed the pull request at: https://github.com/apache/zookeeper/pull/582 ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user anmolnar commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207874376 --- Diff: .gitignore --- @@ -79,3 +79,4 @@ src/c/depcomp src/c/install-sh src/c/ltmain.sh src/c/missing +/nbproject/private/ --- End diff -- Please do not commit netbeans related stuff. ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user anmolnar commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207874562 --- Diff: nbproject/project.xml --- @@ -0,0 +1,124 @@ + --- End diff -- Same here. You don't want to commit your IDE specific files. ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user eolivelli commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207705040 --- Diff: src/java/main/org/apache/zookeeper/metrics/Counter.java --- @@ -0,0 +1,47 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + */ +default void inc() { +inc(1); +} + +/** + * Increment the value by a given amount. + * + * @param delta + */ +void inc(long delta); + +/** + * Get the current value held by the counter. + * + * @return the current value + */ +long get(); --- End diff -- Okay ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user eolivelli commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207704611 --- Diff: src/java/main/org/apache/zookeeper/metrics/Gauge.java --- @@ -0,0 +1,35 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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 + */ +long getCurrentValue(); --- End diff -- Okay ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user eolivelli commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207704605 --- Diff: src/java/main/org/apache/zookeeper/metrics/MetricsContext.java --- @@ -0,0 +1,61 @@ +/** + * 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.zookeeper.metrics; + +/** + * Container of metrics. + * Contexts are organized in a hierarchy. + */ +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); + +/** + * Registers an user provided {@link Gauge} which will be called by the MetricsProvider in order to sample + * an integer value. + * + * @param name + * @param gauge + */ +void registerGauge(String name, Gauge gauge); --- End diff -- Yep. I this this is feasible and it ia usefull ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user lvfangmin commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207611064 --- Diff: src/java/main/org/apache/zookeeper/metrics/Gauge.java --- @@ -0,0 +1,35 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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 + */ +long getCurrentValue(); --- End diff -- Maybe change to get() as well. ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user lvfangmin commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207611617 --- Diff: src/java/main/org/apache/zookeeper/metrics/MetricsContext.java --- @@ -0,0 +1,61 @@ +/** + * 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.zookeeper.metrics; + +/** + * Container of metrics. + * Contexts are organized in a hierarchy. + */ +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); + +/** + * Registers an user provided {@link Gauge} which will be called by the MetricsProvider in order to sample + * an integer value. + * + * @param name + * @param gauge + */ +void registerGauge(String name, Gauge gauge); --- End diff -- Maybe return boolean to indicate if we successfully registered the gauge or not. For example, adding an already exist Gauge should return false. ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user lvfangmin commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r207611316 --- Diff: src/java/main/org/apache/zookeeper/metrics/Counter.java --- @@ -0,0 +1,47 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + */ +default void inc() { +inc(1); +} + +/** + * Increment the value by a given amount. + * + * @param delta + */ +void inc(long delta); + +/** + * Get the current value held by the counter. + * + * @return the current value + */ +long get(); --- End diff -- Should we add the similar thread safety comment as Gauge here? ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user eolivelli commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205936167 --- Diff: src/java/main/org/apache/zookeeper/metrics/Counter.java --- @@ -0,0 +1,47 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + */ +public default void inc() { --- End diff -- Sure. Good catch ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user pravsingh commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205903481 --- Diff: src/java/main/org/apache/zookeeper/metrics/Summary.java --- @@ -0,0 +1,34 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + * + * @param value current value + */ + public void registerValue(long value); --- End diff -- no public. ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user pravsingh commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205902926 --- Diff: src/java/main/org/apache/zookeeper/metrics/Gauge.java --- @@ -0,0 +1,35 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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 + */ +public long getCurrentValue(); --- End diff -- no public. ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user pravsingh commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205902898 --- Diff: src/java/main/org/apache/zookeeper/metrics/Counter.java --- @@ -0,0 +1,47 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + */ +public default void inc() { --- End diff -- public keyword is not needed in interfaces. All of them are public by default ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user pravsingh commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205903511 --- Diff: src/java/main/org/apache/zookeeper/metrics/MetricsProvider.java --- @@ -0,0 +1,64 @@ +/** + * 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.zookeeper.metrics; + +import java.util.Properties; + +/** + * 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. + * After the instantiation of the provider, the system will call {@link #configure(java.util.Map) } in order to provide configuration, + * and then when the system is ready to work it will call {@link #start() }. + * + * Providers can be used both on ZooKeeper servers and on ZooKeeper clients. + */ +public interface MetricsProvider { + +/** + * Configure the provider. + * + * @param configuration the configuration. + * + * @throws MetricsProviderLifeCycleException in case of invalid configuration. + */ +public void configure(Properties configuration) throws MetricsProviderLifeCycleException; --- End diff -- no public ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user eolivelli commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205047955 --- Diff: src/java/main/org/apache/zookeeper/metrics/Counter.java --- @@ -0,0 +1,47 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + */ +public default void inc() { +inc(1); +} + +/** + * Increment the value by a given amount. + * + * @param delta + */ +public void inc(long delta); + +/** + * Get the current value held by the counter. + * + * @return the current value + */ +public long getCurrentValue(); --- End diff -- @lvfangmin done (I did a squash commit, GitHub lost the binding to the code) ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user eolivelli commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205008065 --- Diff: src/java/main/org/apache/zookeeper/metrics/Counter.java --- @@ -0,0 +1,47 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + */ +public default void inc() { +inc(1); +} + +/** + * Increment the value by a given amount. + * + * @param delta + */ +public void inc(long delta); + +/** + * Get the current value held by the counter. + * + * @return the current value + */ +public long getCurrentValue(); --- End diff -- okay, will do ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
Github user lvfangmin commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/582#discussion_r205004380 --- Diff: src/java/main/org/apache/zookeeper/metrics/Counter.java --- @@ -0,0 +1,47 @@ +/** + * 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.zookeeper.metrics; + +/** + * 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. + */ +public default void inc() { +inc(1); +} + +/** + * Increment the value by a given amount. + * + * @param delta + */ +public void inc(long delta); + +/** + * Get the current value held by the counter. + * + * @return the current value + */ +public long getCurrentValue(); --- End diff -- Just change it to get? ---
[GitHub] zookeeper pull request #582: ZOOKEEPER-3103 Pluggable metrics system for Zoo...
GitHub user eolivelli opened a pull request: https://github.com/apache/zookeeper/pull/582 ZOOKEEPER-3103 Pluggable metrics system for ZooKeeper - MetricsProvider API definition Define the API which must be implemented by a Metrics Provider. a MetricsProvider is a pluggable component which is able to gather metrics about the system and publish them to an external application for analysis. You can merge this pull request into a Git repository by running: $ git pull https://github.com/eolivelli/zookeeper fix/metrics Alternatively you can review and apply these changes as the patch at: https://github.com/apache/zookeeper/pull/582.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #582 commit f1c7b778f6177260e26264f4d64c0d7499f8fba9 Author: Enrico Olivelli - Diennea Date: 2018-07-24T10:48:30Z ZOOKEEPER-3103 Pluggable metrics system for ZooKeeper - MetricsProvider API definition ---