-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
Feature/sentinel pigeon adapter #781
Feature/sentinel pigeon adapter #781
Conversation
Codecov Report
@@ Coverage Diff @@
## master #781 +/- ##
============================================
+ Coverage 41.72% 41.73% +0.01%
Complexity 1377 1377
============================================
Files 304 304
Lines 8764 8764
Branches 1182 1182
============================================
+ Hits 3657 3658 +1
Misses 4660 4660
+ Partials 447 446 -1
Continue to review full report at Codecov.
|
7fe6827
to
834caec
Compare
834caec
to
b838dde
Compare
b838dde
to
1b34855
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using only english
and describing clearly in commits' history maybe better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And maybe we should add tests to save the poor coverage. Please reference to sentinel-dubbo-adapter
|
||
<properties> | ||
<java.source.version>1.8</java.source.version> | ||
<java.target.version>1.8</java.target.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why set the target to java8? Is there a library requiring this?
Target version is set to 1.7 in parent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test & remove jdk version 1.8 properties
ok,next commit begin to use en. |
} | ||
|
||
@Override | ||
public void afterThrowing(InvokerContext invokerContext, Throwable throwable) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not familiar with Pigeon, but I guess the afterThrowing
will be triggered when exceptions are thrown. We need to trace the exception here using Tracer.traceEntry(ex, entry)
. And if the postInvoke
is not invoked later, we need to exit the entry here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed pigeon code, you are right, afterThrowing
will be invoded when method invoked throwing exceptions, so trace the exception needed to be placed into afterThrowing
. And postInvoke
will be invoked after method invoked, so exit entry needed to be placed into postInvoke
. I will resolve these problem at once.
|
||
@Override | ||
public void preInvoke(InvokerContext invokerContext) { | ||
Entry methodEntry = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my understanding, the response time should be calculated between preInvoke
and postInvoke
hook, so here if we exit the entry in preInvoke
, the RT will be wrong. The context, as well as the invocation chain, would also not be kept. You'll need to call entry.exit()
in postInvoke
hook. You may need to carry the Entry
via InvokerContext
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed these 2 problems.
|
||
@Override | ||
public void postInvoke(InvokerContext invokerContext) { | ||
Entry methodEntry = ContextUtil.getContext().getCurEntry(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we guarantee the preInvoke
and postInvoke
of one invocation are invoked in the same thread? If they were called in different threads, the context would be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can carry the Entry
in InvokerContext
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure preInvoke
and postInvoke
of one invocation are invoked in the same thread, because of the attribute of InvokeContext
in Pigeon must be Serializable, but Entry
is not Serializable now and I think Entry
don't need to Serializable, so i use ContextUtil
to get current Entry
.
<artifactId>sentinel-demo-pigeon</artifactId> | ||
|
||
<repositories> | ||
<repository> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's not necessary to add the snapshot repository here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed snapshot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is github-dianping-maven-repo
is needed here? I've tried the URL and it's 400 bad request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because pigeon dependency can be fetched only from github-dianping-maven-repo
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is
github-dianping-maven-repo
is needed here? I've tried the URL and it's 400 bad request.
You can compiled the root of sentinel, it's successful.
<!-- Dependency for facebook --> | ||
<dependency> | ||
<groupId>com.facebook.swift</groupId> | ||
<artifactId>swift-annotations</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do the dependencies about com.facebook.swift
make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pigeon provider initialization need to swift dependency, so I add facebook dependencies related to pom.
I've noticed that the |
ok, I have added |
It might be better if you could create a new repo |
I have removed |
Yes it's indeed equally important to Dubbo, but it's not deployed to Maven Central and its way to manage libs is confusing (and not standard). We might only accept the libraries that has been deployed to Maven Central or else valid Maven repositories (e.g. Spring repo). |
Now that the adapter code has been migrated to sentinel-pigeon-adapter repo, please also remove the relevant code in this PR and only keep the change for awesome-sentinel.md. |
By the way, would you like to donate |
I have removed the relevant code with pigeon adapter. |
How should I do? |
You could refer to https://help.github.com/en/articles/transferring-a-repository. The target org is sentinel-group. |
ok |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for contributing. Once the transfer is finished, I'll update the awesome-sentinel.md :) |
When I transfer the repo to sentinel-group, it tells me you don’t have the permission to create repositories on sentinel-group. |
I've invited you to join https://github.com/sentinel-group. Once you've joined you could transfer the repo. |
I have transfered |
Nice, great work! 👍 |
[RIP-9] Added sample English documents of English transaction messages
Describe what this PR does / why we need it
This PR provides RPC framework Pigeon adapter for Sentinel.
Does this pull request fix one issue?
Features #780
Describe how you did it
Add default fallback and provider & invoker interceptor
Describe how to verify it
Run sentinel-demo-pigeon
Special notes for reviews