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 #3402]"getExtension()" can return null.[Trace] #3632

Closed
wants to merge 6 commits into from

Conversation

harshithasudhakar
Copy link
Member

Fixes #3402

Motivation

Using requireNonNull() to check incoming references, can control the point in time when the exception will be thrown.

Modifications

Included "Object.requireNonNull()"

Documentation

  • Does this pull request introduce a new feature? (yes / no)
    No
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
    No

Included "Object.requireNonNull()"
Copy link
Contributor

@Alonexc Alonexc left a comment

Choose a reason for hiding this comment

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

LGTM

@xwm1992 xwm1992 changed the title [ISSUE#3402]"getExtension()" can return null.[Trace] [ISSUE #3402]"getExtension()" can return null.[Trace] Apr 6, 2023
Copy link
Member

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

Hi @harshithasudhakar CI not pass, Please check it

@harshithasudhakar
Copy link
Member Author

Hi @harshithasudhakar CI not pass, Please check it

I have rectified the issue now.

Alonexc
Alonexc previously approved these changes Apr 17, 2023
Copy link
Contributor

@Alonexc Alonexc left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@pandaapo pandaapo left a comment

Choose a reason for hiding this comment

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

The judgment of ternary operation ensures that cloudEvent. getExtension (entry) cannot return null. Objects.requireNonNull() is redundant. @harshithasudhakar @xwm1992

@@ -140,7 +141,7 @@ public Span addTraceInfoToSpan(Span span, CloudEvent cloudEvent) {
}

for (String entry : cloudEvent.getExtensionNames()) {
span.setAttribute(entry, cloudEvent.getExtension(entry) == null ? "" : cloudEvent.getExtension(entry).toString());
span.setAttribute(entry, cloudEvent.getExtension(entry) != null ? cloudEvent.getExtension(entry).toString() : "");
}
Copy link
Member

Choose a reason for hiding this comment

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

Now you see there is no problem with the original code here. The other one is in the same situation.
In conclusion, this issue should not be posted. So let's wait the maintainer to make the final decision.

@scwlkq
Copy link
Contributor

scwlkq commented Oct 22, 2023

@pandaapo 你好👋 我想找一些初级的issue但是看这个貌似已经解决了但是没有关闭,这里还有其他直接commit的点吗?

hello 👋 I am looking for some beginner issues, but it seems that they have been resolved but not closed. Are there any other direct commit points here?

@mxsm
Copy link
Member

mxsm commented Oct 22, 2023

@pandaapo 你好👋 我想找一些初级的issue但是看这个貌似已经解决了但是没有关闭,这里还有其他直接commit的点吗?

hello 👋 I am looking for some beginner issues, but it seems that they have been resolved but not closed. Are there any other direct commit points here?

@scwlkq Hi you can try this issue #4502 ,If you are interested, I can assign this issue to you.

@codecov
Copy link

codecov bot commented Oct 22, 2023

Codecov Report

Merging #3632 (97c99de) into master (d3f688d) will decrease coverage by 0.01%.
The diff coverage is 0.00%.

❗ Current head 97c99de differs from pull request most recent head ab4d13a. Consider uploading reports for the commit ab4d13a to get more accurate results

@@             Coverage Diff              @@
##             master    #3632      +/-   ##
============================================
- Coverage     15.47%   15.47%   -0.01%     
  Complexity     1452     1452              
============================================
  Files           691      691              
  Lines         28106    28112       +6     
  Branches       2626     2629       +3     
============================================
  Hits           4349     4349              
- Misses        23312    23318       +6     
  Partials        445      445              
Files Coverage Δ
...java/org/apache/eventmesh/runtime/trace/Trace.java 0.00% <0.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@pandaapo
Copy link
Member

#3632 (review)
捕获

#3632 (comment)
捕获

What is the significance of these modifications in this PR? @mxsm

@Pil0tXia
Copy link
Member

What is the significance of these modifications in this PR? @mxsm

@pandaapo In your screenshots, it seems little changes have been made indeed.

@Pil0tXia
Copy link
Member

Pil0tXia commented Jan 9, 2024

Any progress can be made in this PR?

Copy link
Contributor

It has been 60 days since the last activity on this pull request. I am reaching out here to gently remind you that the Apache EventMesh community values every pull request, and please feel free to get in touch with the reviewers at any time. They are available to assist you in advancing the progress of your pull request and offering the latest feedback.

If you encounter any challenges during development, seeking support within the community is encouraged. We sincerely appreciate your contributions to Apache EventMesh.

@github-actions github-actions bot added the Stale label Apr 22, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 22, 2024

Codecov Report

Attention: Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.

Project coverage is 15.47%. Comparing base (d3f688d) to head (97c99de).
Report is 236 commits behind head on master.

Current head 97c99de differs from pull request most recent head ab4d13a

Please upload reports for the commit ab4d13a to get more accurate results.

Files Patch % Lines
...java/org/apache/eventmesh/runtime/trace/Trace.java 0.00% 8 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3632      +/-   ##
============================================
- Coverage     15.47%   15.47%   -0.01%     
  Complexity     1452     1452              
============================================
  Files           691      691              
  Lines         28106    28112       +6     
  Branches       2626     2629       +3     
============================================
  Hits           4349     4349              
- Misses        23312    23318       +6     
  Partials        445      445              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot removed the Stale label Apr 23, 2024
Comment on lines 114 to +125
Span span = context != null ? context.get(SpanKey.SERVER_KEY) : null;
return addTraceInfoToSpan(span, cloudEvent);

if (span == null) {
log.warn("span is null when finishSpan");
return null;
}

//add trace info
for (String entry : cloudEvent.getExtensionNames()) {
span.setAttribute(entry, cloudEvent.getExtension(entry) == null ? "" : Objects.requireNonNull(cloudEvent.getExtension(entry)).toString());
}
return span;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to inline the addTraceInfoToSpan method here? I think it is enough to add a requireNonNull method in the "add trace info" step of addTraceInfoToSpan method.

Copy link
Member

Choose a reason for hiding this comment

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

I think it is enough to add a requireNonNull method in the "add trace info" step of addTraceInfoToSpan method.

I found that your current suggestion contradicts your previous one (#3632 (comment)). So, why you now think it's needed to add an extra requireNonNull to addTraceInfoToSpan method?

Copy link
Member

@Pil0tXia Pil0tXia Jun 12, 2024

Choose a reason for hiding this comment

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

@pandaapo Excuse me for overlooking some folded context earlier. I initially intended to point out that the addTraceInfoToSpan method should not be inlined here. However, it appears that further review is unnecessary as the issue corresponding to this PR is invalid. I will close the issue and label this PR as invalid.

@harshithasudhakar Thank you very much for your contribution. Please feel free to select other valuable issues to work on.

Copy link
Contributor

It has been 60 days since the last activity on this pull request. I am reaching out here to gently remind you that the Apache EventMesh community values every pull request, and please feel free to get in touch with the reviewers at any time. They are available to assist you in advancing the progress of your pull request and offering the latest feedback.

If you encounter any challenges during development, seeking support within the community is encouraged. We sincerely appreciate your contributions to Apache EventMesh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] "getExtension()" can return null.[Trace]
8 participants