You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "EdColeman (via GitHub)" <gi...@apache.org> on 2024/02/08 00:18:39 UTC
[PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
EdColeman opened a new pull request, #4244:
URL: https://github.com/apache/accumulo/pull/4244
- Adds the MeterRegistryFactory to `..core.spi.metrics` and deprecates the one in `..core.metrics`
- Modified the GENERAL_MICROMETER_FACTORY to be a list of class names. This would allow multiple provides to be used. For example, logging and statsd. Primarly this may help track down metrics issues.
- set the default for mini cluster to log metrics. This should increase the visibility of metrics during development, but may be cluttering the logs.
This replaces #4218
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483254091
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
It is currently not a property - so no. 60s is actually the default, but specifically setting it here shows how to change it, if so inclined. I'm not sure how far we want to go with supporting this as a default - users should really be using a production solution, so bare-bones impl for this may be okay.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1489654478
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
The TestStatsDRegistryFactory example splits config across two places. If a plugin follows this approach (its hard to think of any other approach a plugin could follow) then metrics config would end up being split across accumulo.properties file and accumulo-env.sh files. I will open a follow on issue about potentially improving this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1489649093
##########
core/src/main/java/org/apache/accumulo/core/conf/Property.java:
##########
@@ -300,8 +300,13 @@ public enum Property {
"Enables metrics functionality using Micrometer.", "2.1.0"),
GENERAL_MICROMETER_JVM_METRICS_ENABLED("general.micrometer.jvm.metrics.enabled", "false",
PropertyType.BOOLEAN, "Enables JVM metrics functionality using Micrometer.", "2.1.0"),
- GENERAL_MICROMETER_FACTORY("general.micrometer.factory", "", PropertyType.CLASSNAME,
- "Name of class that implements MeterRegistryFactory.", "2.1.0"),
+ GENERAL_MICROMETER_FACTORY("general.micrometer.factory",
+ "org.apache.accumulo.core.spi.metrics.SimpleLoggingMeterRegistryFactory",
+ PropertyType.CLASSNAMELIST,
+ "A comma separated list of one or more class names that implement MeterRegistryFactory. Prior to"
+ + " 2.1.3 this was a single value and the default was an empty string. In 2.1.3 the default "
+ + " was changed and it now can accept multiple class names.",
Review Comment:
Could also add something about the change in classes. Not sure if I got the packages correct.
```
In 2.1.3 a new type was introduced o.a.a.core.spi.metrics.MeterRegistryFacory and the existing type o.a.a.core.metrics.MeterRegistryFactory was deprecated. For now classes that extend either type are accepted as a value to this property.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#issuecomment-1944262073
I marked this as a blocker for 2.1.3. The SPI likely should go in some form into 2.1.3. Rather that merge this now, I working issue #4262 that could have additional improvements. If 2.1.3 release is ready, then what exists can be merged now and changes handled later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#issuecomment-2052724656
Replaced with #4459
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483575019
##########
core/src/main/java/org/apache/accumulo/core/conf/Property.java:
##########
@@ -300,8 +300,11 @@ public enum Property {
"Enables metrics functionality using Micrometer.", "2.1.0"),
GENERAL_MICROMETER_JVM_METRICS_ENABLED("general.micrometer.jvm.metrics.enabled", "false",
PropertyType.BOOLEAN, "Enables JVM metrics functionality using Micrometer.", "2.1.0"),
- GENERAL_MICROMETER_FACTORY("general.micrometer.factory", "", PropertyType.CLASSNAME,
- "Name of class that implements MeterRegistryFactory.", "2.1.0"),
+ GENERAL_MICROMETER_FACTORY("general.micrometer.factory",
+ "org.apache.accumulo.core.spi.metrics.SimpleLoggingMeterRegistryFactory",
+ PropertyType.CLASSNAMELIST,
+ "A comma separated list of one or more class names that implement MeterRegistryFactory.",
Review Comment:
Addressed in d8551b56e4
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483266070
##########
core/src/main/java/org/apache/accumulo/core/conf/Property.java:
##########
@@ -300,8 +300,11 @@ public enum Property {
"Enables metrics functionality using Micrometer.", "2.1.0"),
GENERAL_MICROMETER_JVM_METRICS_ENABLED("general.micrometer.jvm.metrics.enabled", "false",
PropertyType.BOOLEAN, "Enables JVM metrics functionality using Micrometer.", "2.1.0"),
- GENERAL_MICROMETER_FACTORY("general.micrometer.factory", "", PropertyType.CLASSNAME,
- "Name of class that implements MeterRegistryFactory.", "2.1.0"),
+ GENERAL_MICROMETER_FACTORY("general.micrometer.factory",
+ "org.apache.accumulo.core.spi.metrics.SimpleLoggingMeterRegistryFactory",
+ PropertyType.CLASSNAMELIST,
+ "A comma separated list of one or more class names that implement MeterRegistryFactory.",
Review Comment:
It would be good to explain the change in expected interface class in the docs and what the support for the old interface class is.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483178683
##########
test/src/main/resources/log4j2-test.properties:
##########
@@ -152,29 +152,6 @@ logger.38.level = debug
logger.39.name = org.apache.accumulo.manager.Manager
logger.39.level = trace
-property.metricsFilename = ./target/test-metrics
Review Comment:
If we leave it, it needs reworked - that specific line you highlighted anyway - the log should be based on the service name (it's already a prop in the file) - hard coding it as test there helped when we tailed the logs so that it was fixed and well known, but maybe not the best example.
I'd prefer keeping it - or having it somewhere discover-able, because it is a pain to get it set up correctly when you are not configuring log4j regularly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman closed pull request #4244: Provide a default metrics implementation using a LoggingProvider
URL: https://github.com/apache/accumulo/pull/4244
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483575273
##########
core/src/main/java/org/apache/accumulo/core/metrics/MetricsUtil.java:
##########
@@ -105,14 +108,16 @@ public DistributionStatisticConfig configure(Meter.Id id,
}
};
- Class<? extends MeterRegistryFactory> clazz =
- ClassLoaderUtil.loadClass(factoryClass, MeterRegistryFactory.class);
- MeterRegistryFactory factory = clazz.getDeclaredConstructor().newInstance();
+ for (String factoryName : getTrimmedStrings(factoryClasses)) {
+ Class<? extends MeterRegistryFactory> clazz =
+ ClassLoaderUtil.loadClass(factoryName, MeterRegistryFactory.class);
Review Comment:
Addressed in d8551b56e4
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1486705366
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
FWIW, I used System properties in [TestStatsDRegistryFactory](https://github.com/apache/accumulo/blob/2.1/test/src/main/java/org/apache/accumulo/test/metrics/TestStatsDRegistryFactory.java#L41). Not sure if that helps or not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "dlmarion (via GitHub)" <gi...@apache.org>.
dlmarion commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483158564
##########
core/src/test/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactoryTest.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+
+import org.apache.accumulo.core.conf.Property;
+import org.junit.jupiter.api.Test;
+
+import io.micrometer.core.instrument.MeterRegistry;
+
+class SimpleLoggingMeterRegistryFactoryTest {
+
+ @Test
+ public void createTest() {
+ SimpleLoggingMeterRegistryFactory factory = new SimpleLoggingMeterRegistryFactory();
+ assertInstanceOf(MeterRegistry.class, factory.create());
+ }
+
+ @Test
+ public void x() {
Review Comment:
This doesn't test anything, maybe remove?
##########
test/src/main/resources/log4j2-test.properties:
##########
@@ -152,29 +152,6 @@ logger.38.level = debug
logger.39.name = org.apache.accumulo.manager.Manager
logger.39.level = trace
-property.metricsFilename = ./target/test-metrics
Review Comment:
I'm wondering if we should undo this change now, so that the metrics go to a specific file for the ITs instead of polluting the server logs.
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
Review Comment:
Is this used?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483196492
##########
core/src/test/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactoryTest.java:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import static org.junit.jupiter.api.Assertions.assertInstanceOf;
+
+import org.apache.accumulo.core.conf.Property;
+import org.junit.jupiter.api.Test;
+
+import io.micrometer.core.instrument.MeterRegistry;
+
+class SimpleLoggingMeterRegistryFactoryTest {
+
+ @Test
+ public void createTest() {
+ SimpleLoggingMeterRegistryFactory factory = new SimpleLoggingMeterRegistryFactory();
+ assertInstanceOf(MeterRegistry.class, factory.create());
+ }
+
+ @Test
+ public void x() {
Review Comment:
removed in 608490bfd3
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483291797
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
The config problem is not something to worry about this in PR as its a per-existing pattern. I am just wondering how someone would use actually use this feature and if it it requires recompiling java code for every metrics config change. If the end to end user experience could be improved we could consider that when introducing a new interface though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483278490
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
Being able to configure the class but not pass any config seems cumbersome to me. If a user configure their own factory and wants to set a server to pass metrics too are they expected to hard code the server address?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1489709010
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
Opened #4262
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483246241
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
Is there any way to configure this to change the frequency?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483251189
##########
core/src/main/java/org/apache/accumulo/core/conf/Property.java:
##########
@@ -300,8 +300,11 @@ public enum Property {
"Enables metrics functionality using Micrometer.", "2.1.0"),
GENERAL_MICROMETER_JVM_METRICS_ENABLED("general.micrometer.jvm.metrics.enabled", "false",
PropertyType.BOOLEAN, "Enables JVM metrics functionality using Micrometer.", "2.1.0"),
- GENERAL_MICROMETER_FACTORY("general.micrometer.factory", "", PropertyType.CLASSNAME,
- "Name of class that implements MeterRegistryFactory.", "2.1.0"),
+ GENERAL_MICROMETER_FACTORY("general.micrometer.factory",
+ "org.apache.accumulo.core.spi.metrics.SimpleLoggingMeterRegistryFactory",
+ PropertyType.CLASSNAMELIST,
+ "A comma separated list of one or more class names that implement MeterRegistryFactory.",
Review Comment:
```suggestion
"A comma separated list of one or more class names that implement MeterRegistryFactory. Prior to 2.1.3 the default value was blank. In 2.1.3 the default value was changed.",
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "EdColeman (via GitHub)" <gi...@apache.org>.
EdColeman commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483170368
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
Review Comment:
Yes - it should log (at info) that the create was called show the metrics initialization at service start-up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483264730
##########
core/src/main/java/org/apache/accumulo/core/metrics/MetricsUtil.java:
##########
@@ -105,14 +108,16 @@ public DistributionStatisticConfig configure(Meter.Id id,
}
};
- Class<? extends MeterRegistryFactory> clazz =
- ClassLoaderUtil.loadClass(factoryClass, MeterRegistryFactory.class);
- MeterRegistryFactory factory = clazz.getDeclaredConstructor().newInstance();
+ for (String factoryName : getTrimmedStrings(factoryClasses)) {
+ Class<? extends MeterRegistryFactory> clazz =
+ ClassLoaderUtil.loadClass(factoryName, MeterRegistryFactory.class);
Review Comment:
If someone had the old Factory interface configured it seems like this would blow up.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Provide a default metrics implementation using a LoggingProvider [accumulo]
Posted by "keith-turner (via GitHub)" <gi...@apache.org>.
keith-turner commented on code in PR #4244:
URL: https://github.com/apache/accumulo/pull/4244#discussion_r1483291797
##########
core/src/main/java/org/apache/accumulo/core/spi/metrics/SimpleLoggingMeterRegistryFactory.java:
##########
@@ -0,0 +1,63 @@
+/*
+ * 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
+ *
+ * https://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.accumulo.core.spi.metrics;
+
+import java.util.function.Consumer;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingMeterRegistry;
+import io.micrometer.core.instrument.logging.LoggingRegistryConfig;
+
+/**
+ * Example implementation of enabling a metrics provider by implementing the
+ * {@link org.apache.accumulo.core.spi.metrics.MeterRegistryFactory} interface. When enabled though
+ * properties by enabling {@code Property.GENERAL_MICROMETER_ENABLED} and providing this class for
+ * the {@code Property.GENERAL_MICROMETER_FACTORY}
+ * <p>
+ * The metrics will appear in the normal service logs with a named logger of
+ * {@code org.apache.accumulo.METRICS} at the INFO level. The metrics output can be directed to a
+ * file using standard logging configuration properties.
+ */
+public class SimpleLoggingMeterRegistryFactory implements MeterRegistryFactory {
+
+ private static final Logger LOG =
+ LoggerFactory.getLogger(SimpleLoggingMeterRegistryFactory.class);
+
+ // named logger that can be configured using standard logging properties.
+ private static final Logger METRICS = LoggerFactory.getLogger("org.apache.accumulo.METRICS");
+
+ private final Consumer<String> metricConsumer = METRICS::info;
+
+ // defines the metrics update period, default is 60 seconds.
+ private final LoggingRegistryConfig lconf = c -> {
+ if (c.equals("logging.step")) {
+ return "60s";
Review Comment:
The config problem is not something to worry about this in PR as its a per-existing pattern. I am just wondering how someone would use actually use this feature and it it requires recompiling java code for every metrics config change. If the end to end user experience could be improved we could consider that when introducing a new interface though.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@accumulo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org