okumin opened a new pull request, #4554:
URL: https://github.com/apache/ozone/pull/4554

   ## What changes were proposed in this pull request?
   
   This change would let Ozone avoid initializing `DefaultMetricsSystem` twice.
   
   Currently, we see the following warning when we launch S3 Gateway.
   
   ```
   ozone-s3g-df95ff75c-4jm4c: 2023-04-07 12:49:54,343 [qtp6519275-23] WARN 
impl.MetricsSystemImpl: S3Gateway metrics system already initialized! 
   ```
   
   `DefaultMetricsSystem` is a singleton. It means it should be initialized 
only once per JVM.
   
   - 
https://github.com/apache/hadoop/blob/rel/release-3.3.5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/lib/DefaultMetricsSystem.java#L52-L63
   - 
https://github.com/apache/hadoop/blob/rel/release-3.3.5/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/impl/MetricsSystemImpl.java#L150-L153
   
   However, on S3 Gateway, it is initialized twice. One is for S3 Gateway's 
metrics and the other one is for an Ozone client.
   
   - 
https://github.com/apache/ozone/blob/ozone-1.3.0/hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/Gateway.java#L94
   - 
https://github.com/apache/ozone/blob/ozone-1.3.0/hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientMetrics.java#L76
   
   Checking similar usage, I found some components create a dedicated metrics 
system. This PR follows the manner.
   
   - 
https://github.com/apache/hadoop/blob/rel/release-3.3.5/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3AInstrumentation.java#L245-L254
   - 
https://github.com/apache/hadoop/blob/rel/release-3.3.5/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azure/metrics/AzureFileSystemMetricsSystem.java
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-8395
   
   ## How was this patch tested?
   
   I checked that I don't see the warning with this patch applied.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to