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

Make muzzle reference creation package(s) configurable #1395

Closed
pavolloffay opened this issue Oct 15, 2020 · 3 comments · Fixed by #2615
Closed

Make muzzle reference creation package(s) configurable #1395

pavolloffay opened this issue Oct 15, 2020 · 3 comments · Fixed by #2615
Labels
enhancement New feature or request

Comments

@pavolloffay
Copy link
Member

The instrumentationMuzzle is created only for instrumenters in io.opentelemetry.instrumentation.

private static final String REFERENCE_CREATION_PACKAGE = "io.opentelemetry.instrumentation.";

In my custom java agent build I am adding instrumentations in a different package and these instrumentations should have also instrumentationMuzzle properly created.

The package prefixes could be configured via a system property which would be set at build time. I don't think we need an SPI for it.

@mateuszrzeszutek
Copy link
Member

It needs to be available both in compile-time and runtime - ReferenceMatcher is also using this predicate.

Are these the same packages as in BootstrapPackagePrefixesHolder?

By the way, I'm thinking that maybe we need to have some sort of AgentInternalConfig class that groups all such properties together, and a single SPI for changing that config (similar to TracerCustomizer). This way a vendor distribution could configure all its needs in a single place.

@pavolloffay
Copy link
Member Author

Are these the same packages as in BootstrapPackagePrefixesHolder?

no, the packages in BootstrapPackagePrefixesHolder are different (not instrumentation) - these are classes that provide common functionality for instrumentations.

@mateuszrzeszutek
Copy link
Member

Another idea based on: #2524 (comment)

Right now if we want to include a 3rd party library instrumentation in the javaagent (e.g. couchbase 3.1 instrumentation) we're forced to add all classes used in the library instrumentation as additionalHelperClassNames().
That's because muzzle collects neither helper classes nor references (used symbols) from 3rd party packages/classes.

To fix that a new customization point should be introduced to the InstrumentationModule: a method that returns a Predicate<String> (or similar) that returns a predicate determining whether a passed class name refers to an instrumentation helper class. The default behavior would be the current one e.g. InstrumentationClassPredicate.

To sum it up, instead of using SPI (as proposed above) we should allow customizing this behavior per instrumentation module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants