vy commented on code in PR #1943:
URL: https://github.com/apache/logging-log4j2/pull/1943#discussion_r1385473711
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncQueueFullPolicyFactory.java:
##########
@@ -64,17 +79,22 @@ public class AsyncQueueFullPolicyFactory {
* {@link AsyncQueueFullPolicy} interface. The class must have a default
constructor.
* </p>
*
+ * @param metricTags tags to apply to any metrics created for the
AsyncQueueFullPolicy
* @return a new AsyncQueueFullPolicy
*/
- public static AsyncQueueFullPolicy create() {
- final String router =
PropertiesUtil.getProperties().getStringProperty(Log4jPropertyKey.ASYNC_LOGGER_QUEUE_FULL_POLICY);
+ public AsyncQueueFullPolicy create(final Map<String, String> metricTags) {
Review Comment:
Imagine a future where we appropriately measure almost every activity. If we
stick to the current strategy drafted here, we would be passing measurement
objects (tags, metric registries, etc.) at every method call instantiating a
component. This sounds pretty invasive to me. Can't we rather have a listener
concept instead? That is, say, `DiscardingAsyncQueueFullPolicy` accepting a
`List<DiscardingAsyncQueueFullPolicyListener>` in its constructor. Then
measurement probes will simply be classes extending such listeners. This way we
can avoid polluting the policy code with measurement logic.
Mine is just a suggestion, maybe there are better ones. But my point stands:
we shouldn't be passing metric objects at every method call.
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/metrics/MetricManager.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.logging.log4j.core.metrics;
+
+import java.util.Map;
+import java.util.function.ToDoubleFunction;
+
+import org.apache.logging.log4j.plugins.di.Key;
+
+public interface MetricManager {
Review Comment:
I smell a Dropwizard Metrics, Micrometer, etc. rewrite here. I doubt if such
a big undertaking is necessary. If we stick to the listener interface concept I
outlined above, maybe we can provide vendor-specific – one for Micrometer, one
for Dropwizard Metrics, etc. – modules and avoid rolling out our own
implementation.
##########
log4j-core/src/main/java/org/apache/logging/log4j/core/metrics/MetricManager.java:
##########
@@ -0,0 +1,32 @@
+/*
+ * 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.logging.log4j.core.metrics;
+
+import java.util.Map;
+import java.util.function.ToDoubleFunction;
+
+import org.apache.logging.log4j.plugins.di.Key;
+
+public interface MetricManager {
Review Comment:
I smell a Dropwizard Metrics, Micrometer, etc. rewrite here. I doubt if such
a big undertaking is necessary. If we stick to the listener interface concept I
outlined above, maybe we can provide vendor-specific – one for Micrometer, one
for Dropwizard Metrics, etc. – modules and avoid rolling out our own
implementation.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]