Skip to content

HDDS-6168. Add config to disable registering S3 Gateway metrics#9771

Closed
vyalamar wants to merge 7 commits intoapache:masterfrom
vyalamar:hdds-6168-s3g-metrics-jmx
Closed

HDDS-6168. Add config to disable registering S3 Gateway metrics#9771
vyalamar wants to merge 7 commits intoapache:masterfrom
vyalamar:hdds-6168-s3g-metrics-jmx

Conversation

@vyalamar
Copy link
Copy Markdown
Contributor

Summary

  • add config toggle to disable S3G metrics (ozone.s3g.metrics.enabled, default true)
  • make S3GatewayMetrics.create idempotent and add JVM shutdown hook to unregister; return null when disabled
  • regression test to assert create() is idempotent

Testing

  • mvn -pl hadoop-ozone/s3gateway -am -DskipITs test (ran locally; completed via cached modules)

@vyalamar
Copy link
Copy Markdown
Contributor Author

@adoroszlai, @ivanzlenko, and @Russole pls help review.

Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vyalamar for the patch.

Comment on lines +307 to +308
if (!conf.getBoolean(S3GatewayConfigKeys.OZONE_S3G_METRICS_ENABLED,
S3GatewayConfigKeys.OZONE_S3G_METRICS_ENABLED_DEFAULT)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's cache the result in a static Boolean variable.

if (metricsEnabled == null) {
  metricsEnabled = conf.getBoolean(...);
}
if (!metricsEnabled) {
  return null;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it supposed to be called once? in this case there is no need for a cache.

@vyalamar vyalamar force-pushed the hdds-6168-s3g-metrics-jmx branch from 4f0b098 to 3c7b2b4 Compare February 20, 2026 12:02
@vyalamar vyalamar force-pushed the hdds-6168-s3g-metrics-jmx branch from 3c7b2b4 to c2e8389 Compare March 8, 2026 21:28
@vyalamar vyalamar force-pushed the hdds-6168-s3g-metrics-jmx branch from c2e8389 to 0eb6f79 Compare March 8, 2026 21:31
Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @vyalamar for updating the patch.

@adoroszlai adoroszlai changed the title HDDS-6168: Guard S3G metrics JMX registration HDDS-6168. Add config to disable registering S3 Gateway metrics Mar 9, 2026
@vyalamar
Copy link
Copy Markdown
Contributor Author

vyalamar commented Mar 9, 2026

@adoroszlai updated.

instance = ms.register(SOURCE_NAME, "S3 Gateway Metrics", instance);
} else {
// Initialize annotated metrics fields without publishing the source.
MetricsAnnotations.makeSource(instance);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it produce non-null instance after this call?

adoroszlai
adoroszlai previously approved these changes Mar 9, 2026
@adoroszlai adoroszlai dismissed their stale review March 13, 2026 12:18

On another look, I doubt this patch fixes the problem reported in HDDS-6168. S3GatewayMetrics was only introduced in HDDS-6481, 2 months after HDDS-6168. So the memory issue must have been about other kinds of metrics (the ones standard across all server components).

@vyalamar
Copy link
Copy Markdown
Contributor Author

@adoroszlai sure, let me go to older version of the code and try to reproduce?

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 7, 2026

This PR has been marked as stale due to 21 days of inactivity. Please comment or remove the stale label to keep it open. Otherwise, it will be automatically closed in 7 days.

@github-actions github-actions Bot added the stale label Apr 7, 2026
@github-actions
Copy link
Copy Markdown

Thank you for your contribution. This PR is being closed due to inactivity. Please contact a maintainer if you would like to reopen it.

@github-actions github-actions Bot closed this Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants