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

Issue 1699 extend destination field #1788

Merged
merged 23 commits into from
Jun 23, 2021

Conversation

videnkz
Copy link
Contributor

@videnkz videnkz commented Apr 26, 2021

What does this PR do?

closes #1699

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

@apmmachine
Copy link
Contributor

apmmachine commented Apr 26, 2021

💚 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

Expand to view the summary

Build stats

  • Build Cause: Pull request #1788 updated

  • Start Time: 2021-06-23T14:48:29.769+0000

  • Duration: 51 min 25 sec

  • Commit: 14805b3

Test stats 🧪

Test Results
Failed 0
Passed 2286
Skipped 19
Total 2305

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 2286
Skipped 19
Total 2305

@felixbarny
Copy link
Member

Hey @kananindzya 👋
Thanks for the PR. However, we're currently re-thinking how the API should look like given that the destination.service.name and destination.service.type are not actually used. More info here: elastic/apm#424 (comment)

@eyalkoren
Copy link
Contributor

Blocked until elastic/apm#436 is finalized

Copy link
Contributor

@eyalkoren eyalkoren left a comment

Choose a reason for hiding this comment

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

Thanks (again) @kananindzya !
Some changes required, mostly minor ones.
Please add tests to verify that the destination.service.resource provide through the API always take precedence, considering that it can be set before or after the resource was automatically set.

@eyalkoren
Copy link
Contributor

eyalkoren commented Jun 9, 2021

@kananindzya would you like me to take over and apply these minor fixes?
I can make a PR on this PR if you want

@videnkz
Copy link
Contributor Author

videnkz commented Jun 9, 2021

@kananindzya would you like me to take over and apply these minor fixes?
I can make a PR on this PR if you want

Hi @eyalkoren, after 30 min I will send changes.

Copy link
Contributor

@eyalkoren eyalkoren left a comment

Choose a reason for hiding this comment

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

@kananindzya Thanks for the fixes! 🙏

There were some required fixes, including for tests and updating according to the latest spec changes, so I did these changes myself.
If you disagree with something in my latest commits, please let me know.
Thanks!

@Advice.Argument(1) int port) {
if (context instanceof Span) {
SpanContext spanContext = ((Span) context).getContext();
if (address != null && !address.isBlank()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

isBlank() is Java 11, we cannot use it

public String getType() {
return type;
}

public boolean hasContent() {
return resource.length() > 0 || name.length() > 0 || type != null;
return resource.length() > 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

userResource should be taken into account as well

@@ -185,52 +186,75 @@ public Destination withInetAddress(InetAddress inetAddress) {
*/
private final StringBuilder resource = new StringBuilder();

private final StringBuilder userResource = new StringBuilder();
Copy link
Contributor

Choose a reason for hiding this comment

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

Must be reset in resetState()

@eyalkoren eyalkoren requested a review from SylvainJuge June 20, 2021 12:14
@felixbarny
Copy link
Member

Instead of duplicating the properties for user-supplied values, would it be possible to either

  • Only override existing values if they are user-supplied (no additional properties needed)
  • Mark properties that have been user-supplied with a boolean flag (similar to the span name priority)

@eyalkoren
Copy link
Contributor

@elasticmachine run elasticsearch-ci/docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[META 424] Public API extended by destination fields
5 participants