wwwlicious / servicestack-discovery-consul

ServiceStack Plugin for Service Discovery using Consul.io
Other
64 stars 13 forks source link

Name of Registed Service is always 'api' by default in v4.0.67 from nuget #18

Closed xiayy860612 closed 6 years ago

xiayy860612 commented 7 years ago

I use ServiceStack.Discovery.Consul v4.0.67 from nuget and set up multiple services, all of them are same service name in Consul unless I override IServiceDiscovery.

use name of servicestack service name instead will be better by default.

wwwlicious commented 7 years ago

The name being consistent across all services is deliberate for allowing use of the DNS interface in Consul. The standard query for consul by tag requires that you have the service name in the query so enables the following queries to be executed.

[tag.]api.service.consul

Although DNS queries are not part of the plugin at the moment, they provide another means to locate services and we plan to add them in future. We also tag every servicestack operation with the apphost definied servicename and version which can be used to filter operations by their hosted service.

Is there a specific reason why you need the service names registered in consul to be different?

.

xiayy860612 commented 7 years ago

Coz I have some different sevices, each of them has its own feature which maybe contains many request operations.

So I want to have different service name to organize them separately, in that case manage same kinds of services clearly.

If all different services use same name, it's mess for me when scaling lots of services.

wwwlicious commented 7 years ago

It is not clear to what you are referring when you say 'manage' and from where? It also is not clear why it is a mess to have all services named the same. Can you elaborate so that I can understand as I do not see the issue with having all dto operations in servicestack under one service in consul.

The services can be organised separately by using tags or consul perpared queries. In the latest version of consul TTL checks have been introduced to enabled the plugin to deregsiter unresponsive services after a time.

It may be possible to provide a configurable option to allow the default servicename to be overridden but this one 'api' service for all servicestack services is the precise behaviour that the discovery plugin is trying to enable, the seamless interaction between all servicestack registered services so I don't understand the use-case for it.

xiayy860612 commented 7 years ago

yeah, there are 2 cases for only api service and multiple services like below

All services use name api

In Services page of default dashboard ui, it will show

under api services it will list all nodes. When I want to look for some specific nodes with specific service, I need look for related dto tags in all nodes.

Different service has different name

In Services page of default dashboard ui, it will show

In this case I could be easy to locate nodes of each kind of service.

For previous words I did not declare clearly the meaning of 'manager', it's means manage the locations of services clearly currently.

Coz currently I don't use other dashboard.

Just like your representation in Example

Example

The services(ServiceA, ServiceB) are separated and that's what I want.

Maybe give an choice for users override the service name or use default will be more flexible.

wwwlicious commented 7 years ago

Yes I understand, thanks for the clarification, I think making it configurable/overridable is the best option. I'll have a look at this in the next couple of days (currently having to rebuild my dev machine at the moment)

wwwlicious commented 6 years ago

registering with custom service names breaks http and dns discoverability between services

The point of servicestack's DTO first design and this plugin is to negate the need to 'know' which service a dto is in. Can reopen if there is a more comelling reason other than to improve how registered services look in consul's UI.