[ 
https://issues.apache.org/jira/browse/ARTEMIS-5045?focusedWorklogId=934730&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-934730
 ]

ASF GitHub Bot logged work on ARTEMIS-5045:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Sep/24 14:24
            Start Date: 13/Sep/24 14:24
    Worklog Time Spent: 10m 
      Work Description: gemmellr commented on code in PR #5230:
URL: https://github.com/apache/activemq-artemis/pull/5230#discussion_r1758942956


##########
artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/NettyPooledAllocatorMetrics.java:
##########
@@ -33,53 +34,64 @@ public final class NettyPooledAllocatorMetrics implements 
MeterBinder {
 
    private static final String BYTES_UNIT = "bytes";
    private final PooledByteBufAllocatorMetric metric;
+   private final Tags tags;
 
-   public NettyPooledAllocatorMetrics(final PooledByteBufAllocatorMetric 
pooledAllocatorMetric) {
+   public NettyPooledAllocatorMetrics(final PooledByteBufAllocatorMetric 
pooledAllocatorMetric, final Tags tags) {
       this.metric = pooledAllocatorMetric;
+      this.tags = tags;

Review Comment:
   Maybe _commonTags_ to make the linkage to where they came from, and how they 
are used here, clearer?



##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/PassthroughMetricsPluginTest.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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
+ * <br>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <br>
+ * 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.activemq.artemis.tests.integration.plugin;
+
+import java.util.Map;
+
+import io.micrometer.core.instrument.Meter;
+import io.micrometer.core.instrument.MeterRegistry;
+import io.micrometer.core.instrument.Tags;
+import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
+import org.apache.activemq.artemis.core.config.MetricsConfiguration;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import org.apache.activemq.artemis.core.server.metrics.ActiveMQMetricsPlugin;
+import org.apache.activemq.artemis.utils.RandomUtil;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import static 
org.apache.activemq.artemis.core.server.metrics.MetricsManager.BROKER_TAG_NAME;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+public class PassthroughMetricsPluginTest extends MetricsPluginTest {
+
+   private MeterRegistry meterRegistry;
+
+   @Override
+   protected void configureServer(ActiveMQServer server) {
+      meterRegistry = new SimpleMeterRegistry();
+      server.getConfiguration().setMetricsConfiguration(new 
MetricsConfiguration().setPlugin(new ActiveMQMetricsPlugin() {
+         @Override
+         public ActiveMQMetricsPlugin init(Map<String, String> map) {
+            return this;
+         }
+
+         @Override
+         public MeterRegistry getRegistry() {
+            return meterRegistry;
+         }
+      }));
+   }
+
+   @Test
+   public void testPassthroughMeterRegistry() {
+      final String meterName = "myGauge";

Review Comment:
   Could perhaps use the test name? E.g getTestMethodName();



##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/PassthroughMetricsPluginTest.java:
##########
@@ -0,0 +1,78 @@
+/*
+ * 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
+ * <br>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <br>

Review Comment:
   Ditto



##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/LegacyConfigMetricsPluginTest.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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
+ * <br>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <br>
+ * 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.activemq.artemis.tests.integration.plugin;
+
+import org.apache.activemq.artemis.core.config.MetricsConfiguration;
+import org.apache.activemq.artemis.core.server.ActiveMQServer;
+import 
org.apache.activemq.artemis.core.server.metrics.plugins.SimpleMetricsPlugin;
+
+public class LegacyConfigMetricsPluginTest extends MetricsPluginTest {
+
+   @Override
+   protected void configureServer(ActiveMQServer server) {
+      server.getConfiguration().setMetricsConfiguration(new 
MetricsConfiguration().setPlugin(new SimpleMetricsPlugin().init(null)));

Review Comment:
   C&P error?
   
   This does not align with that the other test did during its _legacyConfig_ 
runs (snippet below), but rather matches the prior non-legacy runs, and also 
exactly matches what the parent non-LegacyConfig MetricsPluginTest is already 
doing, i.e they are testing the same things.
   ```
   if (legacyConfig) {
      server.getConfiguration().setMetricsPlugin(new 
SimpleMetricsPlugin().init(null));
   } else {
      server.getConfiguration().setMetricsConfiguration(new 
MetricsConfiguration().setPlugin(new SimpleMetricsPlugin().init(null)));
   }
   ```
   



##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/plugin/LegacyConfigMetricsPluginTest.java:
##########
@@ -0,0 +1,30 @@
+/*
+ * 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
+ * <br>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <br>

Review Comment:
   Isnt Javadoc so shouldnt have the \<br\> elements, and the URL isn't 
indented correctly.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 934730)
    Time Spent: 0.5h  (was: 20m)

> Don't change the Micrometer MeterRegistry config
> ------------------------------------------------
>
>                 Key: ARTEMIS-5045
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5045
>             Project: ActiveMQ Artemis
>          Issue Type: Improvement
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> For embedded use-cases the Micrometer MeterRegistry may be passed in from the 
> application and used for other meters unrelated to the broker. Therefore, the 
> broker should not change the config of the MeterRegistry (e.g. by adding 
> common tags to all meters) as the config change(s) may be incompatible with 
> the needs of the embedding application.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to