Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Jar shading issue with NewRelic integration in NewRelicReflector #171

Closed
apottere opened this issue Oct 14, 2019 · 6 comments
Closed

Jar shading issue with NewRelic integration in NewRelicReflector #171

apottere opened this issue Oct 14, 2019 · 6 comments

Comments

@apottere
Copy link

Describe the bug
NewRelicReflector never works, because it's looking for the location of the NewRelic jar in the wrong package: com.launchdarkly.shaded.com.newrelic.api.agent.NewRelic

To reproduce
https://github.com/apottere/launchdarkly-newrelic-bug/tree/master

mvn exec:java -Dexec.mainClass="com.launchdarkly.client.DemoApplication"

Expected behavior
When running that application, I would expect to see this logged:

Used actual package: com.newrelic.api.agent.NewRelic

Instead, I see this logged:

Used shaded package: com.launchdarkly.shaded.com.newrelic.api.agent.NewRelic

SDK version
4.8.0

Language version, developer tools
Java 8

OS/platform
MacOS

@eli-darkly
Copy link
Contributor

Thanks for pointing this out. Either due to having changed which shading plugin we were using, or due to a change in the behavior of that plugin at some point, it started not just shading the classes in the jar but also transforming the string parameter in a call to Class.forName(). It's a bit odd for it to do so for a class name that is clearly not one of the classes being shaded— I would think that that would make the tool's default behavior unusable for code that had to check for the presence of any external framework at all— but it should be possible to override this.

@apottere
Copy link
Author

Yeah, I was surprised to see that was getting shaded as well - hopefully it's an easy fix in the shader config. Thanks for taking a look!

@eli-darkly
Copy link
Contributor

Please let us know once you've had a chance to retest with the 4.8.1 release.

@apottere
Copy link
Author

@eli-darkly that fixed it, thank you!

@eli-darkly
Copy link
Contributor

Annoyingly, this was not an easy fix in the Shadow plugin config. We're still trying to figure out why it behaves this way; in the meantime, we've implemented a workaround in the code that is pretty silly-looking, but does work.

@apottere
Copy link
Author

apottere commented Oct 18, 2019

Haha yeah, I was looking at the workaround yesterday. If its silly and it works, ¯\_(ツ)_/¯

LaunchDarklyCI pushed a commit that referenced this issue Jan 30, 2020
…istent-store-intf-4.x

partially implement new DataStore/DataSource APIs, + fix Redis cache stats logic
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants