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

Fail-fast manual tracer creation in presence of java agent #1994

Merged
merged 2 commits into from
Oct 15, 2020

Conversation

randomanderson
Copy link
Contributor

@randomanderson randomanderson commented Oct 15, 2020

Historically, we would allow the creation of DDTracer even when the java agent was installed. The failure to register was noted in the logs and the application continued normally.

Recently, creating DDTracer when the agent was installed causes java.lang.NoSuchMethodError because of class renaming.

In both cases, the newly created DDTracer can't be used. This pull request changes the behavior to fail fast by throwing an exception immediately.

@randomanderson randomanderson requested a review from a team as a code owner October 15, 2020 16:45
Copy link
Contributor

@tylerbenson tylerbenson left a comment

Choose a reason for hiding this comment

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

a bunch of optional/nit comments...

public class IncorrectSetupWithAgentApplication {
public static void main(final String[] args) {
try {
DDTracer.builder().build();
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want to throw an assertion error after this in case it doesn't fail as expected?

Co-authored-by: Tyler Benson <tyler.benson@datadoghq.com>
@randomanderson randomanderson merged commit 38e4b33 into master Oct 15, 2020
@randomanderson randomanderson deleted the landerson/failfast-bad-setup branch October 15, 2020 19:49
@github-actions github-actions bot added this to the 0.66.0 milestone Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants