Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add option for automatic JMX retry #3511

Merged
merged 10 commits into from Feb 9, 2024
Merged

Conversation

SylvainJuge
Copy link
Member

@SylvainJuge SylvainJuge commented Feb 1, 2024

  • minor code changes
  • add simple retry strategy

What does this PR do?

Some MBeans throw exceptions when the state they expose isn't completely initialized yet.

When the agent starts, such MBeans will be ignored by the agent as they can't be accessed and the agent requires to get their values on registration to get their type, in particular for composite attributes, this is not something that can't be known before invocation.

Checklist

  • This is an enhancement of existing features, or a new feature in existing plugins
    • I have updated CHANGELOG.asciidoc
    • I have added tests that prove my fix is effective or that my feature works
    • Added an API method or config option? Document in which version this will be introduced
    • I have made corresponding changes to the documentation

@elastic-apm-tech elastic-apm-tech added this to In Progress in APM-Agents (OLD) Feb 1, 2024
}

@Test
void testMBeanExceptionWhenRegisteredThenOk() throws Exception {
Copy link
Member Author

Choose a reason for hiding this comment

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

[for reviewer] this tests the new behavior, every other change is mostly refactoring in this file.

}
return value;
Copy link
Member Author

Choose a reason for hiding this comment

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

[for reviewer] this allows to set a breakpoint to investigate the captured value when debugging.

@SylvainJuge SylvainJuge marked this pull request as ready for review February 8, 2024 09:06
@SylvainJuge SylvainJuge changed the title [wip] attempt automatic JMX retry add option for automatic JMX retry Feb 8, 2024
register(jmxConfiguration.getCaptureJmxMetrics().get(), platformMBeanServer);

ConfigurationOption<TimeDuration> failedRetryConfig = jmxConfiguration.getFaildRetryInterval();
long retryMillis = failedRetryConfig.getValue().getMillis();
Copy link
Contributor

Choose a reason for hiding this comment

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

scope is inside the if statement, why here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in 91f49cf

@v1v
Copy link
Member

v1v commented Feb 9, 2024

run docs-build

@SylvainJuge SylvainJuge merged commit 826fbf9 into elastic:main Feb 9, 2024
14 checks passed
APM-Agents (OLD) automation moved this from In Progress to Done Feb 9, 2024
@SylvainJuge SylvainJuge deleted the jmx-retry branch February 9, 2024 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants