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 library instrumentation for elasticsearch rest client 7 #8911

Merged
merged 6 commits into from
Aug 1, 2023

Conversation

laurit
Copy link
Contributor

@laurit laurit commented Jul 10, 2023

Implement library instrumentation for elasticsearch-rest-7.0 by using a byte-buddy bytcode proxy to wrap the RestClient. Using bytecode proxy allows to handle differences in the constructor signature of RestClient so we don't need to have separate instrumentation for each change in the constructor.
See #8867

}

private static Function<RestClient, RestClient> getProxyFactory(Class<?> clazz) {
for (Constructor<?> constructor : clazz.getDeclaredConstructors()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here we expect that the class has a constructor that takes Header[] as second and List as third argument, these are the only 2 parameters that we need to fill with non default values. Alternatively we could skip the constructor call if there are too many changes in the constructors.

@laurit laurit marked this pull request as ready for review July 10, 2023 17:36
@laurit laurit requested a review from a team as a code owner July 10, 2023 17:36
@trask
Copy link
Member

trask commented Jul 10, 2023

cc Elastic folks for visibility @AlexanderWert @estolfo @jackshirazi

Copy link
Contributor

@JonasKunz JonasKunz left a comment

Choose a reason for hiding this comment

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

LGTM. I compared the instrumentation to what we do in the elastic-apm agent and to the Otel agent, it should be equivalent.

@laurit laurit force-pushed the elasticsearch-rest-library branch from aa25ef4 to 7b35d89 Compare July 11, 2023 16:50
Copy link
Member

@mateuszrzeszutek mateuszrzeszutek left a comment

Choose a reason for hiding this comment

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

Nice 👍

@trask trask enabled auto-merge (squash) July 31, 2023 17:59
@laurit laurit force-pushed the elasticsearch-rest-library branch from 586e8d8 to 256cfef Compare August 1, 2023 13:45
@trask trask merged commit fbae980 into open-telemetry:main Aug 1, 2023
45 checks passed
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

4 participants