Skip to content

Conversation

@tobiasstadler
Copy link
Contributor

@tobiasstadler tobiasstadler commented Feb 3, 2022

What does this PR do?

Implements the solution suggested in #2369

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

@github-actions github-actions bot added agent-java community Issues and PRs created by the community triage labels Feb 3, 2022
@github-actions
Copy link

github-actions bot commented Feb 3, 2022

👋 @tobiasstadler Thanks a lot for your contribution!

It may take some time before we review a PR, so even if you don’t see activity for some time, it does not mean that we have forgotten about it.

Every once in a while we go through a process of prioritization, after which we are focussing on the tasks that were planned for the upcoming milestone. The prioritization status is typically reflected through the PR labels. It could be pending triage, a candidate for a future milestone, or have a target milestone set to it.

@ghost
Copy link

ghost commented Feb 3, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-02-15T09:39:24.552+0000

  • Duration: 54 min 54 sec

Test stats 🧪

Test Results
Failed 0
Passed 2495
Skipped 16
Total 2511

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • run benchmark tests : Run the benchmark tests.

  • run jdk compatibility tests : Run the JDK Compatibility tests.

  • run integration tests : Run the Agent Integration tests.

  • run end-to-end tests : Run the APM-ITs.

  • run windows tests : Build & tests on windows.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Member

@felixbarny felixbarny left a comment

Choose a reason for hiding this comment

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

I've added some changes, let me know if this works for you.
LGTM, but I'd like to wait for @eyalkoren's feedback before merging

@felixbarny
Copy link
Member

run elasticsearch-ci/docs

@felixbarny
Copy link
Member

run elasticsearch-ci/docs

@tobiasstadler
Copy link
Contributor Author

I've added some changes, let me know if this works for you.

Much better that what I did! Thank you for your support.

Yes, service name/version and MDC work for me.

@felixbarny felixbarny requested a review from eyalkoren February 3, 2022 16:41
@felixbarny
Copy link
Member

run elasticsearch-ci/docs

@eyalkoren
Copy link
Contributor

I actually intend to get rid of TraceContext#applicationClassLoader as part of #2428 ...
We don't need this reference anymore and it's always a good idea to store one less weak reference (and any CL reference).
Since you are actually only interested in the implicit side-effect of TraceContext#setApplicationClassLoader, which is to override the service info for the transaction, the API seems inappropriate to me. Calling it overrideServiceInfoFor(ClassLoader) would be better (the javadoc would how the provided ClassLoader is used).

Generally speaking, I would prefer a cleaner and more generic API such as overrideServiceInfo(String serviceName, String serviceVersion). If extracting the service version and name are simple enough- just implement that instead of relying on the automatic discovery. If relying on the automatic discovery is important, I assume this is mostly relevant for external plugins (not for other usages of the API), so we can expose ElasticApmTracer#getServiceInfo(ClassLoader) through the sdk by making it part of the co.elastic.apm.agent.impl.Tracer interface. WDYT?

@tobiasstadler
Copy link
Contributor Author

tobiasstadler commented Feb 6, 2022

Hm, I find it quite inconvenient to (always) have to to call getServiceInfo before I can call overrideServiceInfo. What about something like Transaction#withServiceInfoForClassCloader(ClassLoader) (or maybe use instead of with or another better name) or #2369. What do you think?

@eyalkoren I will implement your suggestion in the next days

@tobiasstadler
Copy link
Contributor Author

@eyalkoren Please see #2451 for my implementation of your suggestion

@tobiasstadler
Copy link
Contributor Author

#2451 is the preferred api

@tobiasstadler tobiasstadler deleted the public-api-setapplicationclassloader branch March 21, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-java community Issues and PRs created by the community triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants