You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "gougouzcm (GitHub)" <gi...@apache.org> on 2019/02/14 07:57:59 UTC
[GitHub] [incubator-dubbo] gougouzcm opened issue #3472: How can I
get the provider application.name in a consumer filter
I am writing a log filter in consumer sideļ¼ I want to know which provider application that client is calling.
I want to get the provider url,
So I use the method `RpcContext.getContext().getUrls()`
but the url I got seems is a merged url , not my expected result.
Can any one help me, thk.
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3472 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] gougouzcm commented on issue #3472: How
can I get the provider application.name in a consumer filter
Posted by "gougouzcm (GitHub)" <gi...@apache.org>.
> You can get the provider's ip and port int your Filter like this
>
> ```
> String providerIp = invoker.getUrl().getHost();
> int providerPort = invoker.getUrl().getPort;
> ```
> does this solve your problem?
@kexianjun I want get the provider application name . I need the provider application name and do some analyse.
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3472 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] kexianjun commented on issue #3472: How
can I get the provider application.name in a consumer filter
Posted by "kexianjun (GitHub)" <gi...@apache.org>.
You can get the provider's ip and port int your Filter like this
```
String providerIp = invoker.getUrl().getHost();
int providerPort = invoker.getUrl().getPort;
```
does this solve your problem?
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3472 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] Bricks-Man commented on issue #3472: How
can I get the provider application.name in a consumer filter
Posted by "Bricks-Man (GitHub)" <gi...@apache.org>.
> > You can get the provider's ip and port int your Filter like this
> > ```
> > String providerIp = invoker.getUrl().getHost();
> > int providerPort = invoker.getUrl().getPort;
> > ```
> > does this solve your problem?
>
> @kexianjun I want get the provider application name . I need the provider application name and do some analyse.
I think you can get result like this:
```
String application = RpcContext.getContext().getUrl().getParameter("application");
```
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3472 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] gougouzcm closed issue #3472: How can I
get the provider application.name in a consumer filter
Posted by "gougouzcm (GitHub)" <gi...@apache.org>.
[ issue closed by gougouzcm ]
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3472 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] kexianjun commented on issue #3472: How
can I get the provider application.name in a consumer filter
Posted by "kexianjun (GitHub)" <gi...@apache.org>.
> > > You can get the provider's ip and port int your Filter like this
> > > ```
> > > String providerIp = invoker.getUrl().getHost();
> > > int providerPort = invoker.getUrl().getPort;
> > > ```
> > > does this solve your problem?
> >
> >
> > @kexianjun I want get the provider application name . I need the provider application name and do some analyse.
>
> I think you can get result like this:
>
> ```
> String application = RpcContext.getContext().getUrl().getParameter("application");
> ```
No, the result is consumer's application name
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3472 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org
[GitHub] [incubator-dubbo] chickenlj commented on issue #3472: How
can I get the provider application.name in a consumer filter
Posted by "chickenlj (GitHub)" <gi...@apache.org>.
If you are using v2.7.0, the following statement may help you:
```java
url.getParameter(Constants.REMOTE_APPLICATION_KEY)
```
[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3472 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org