Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
e9d13919
Commit
e9d13919
authored
Sep 12, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加基于Region的权重流量策略
parent
4e35f772
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletions
+15
-1
discovery-common/src/main/java/com/nepxion/discovery/common/entity/InstanceEntity.java
+9
-0
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
+4
-1
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
+2
-0
No files found.
discovery-common/src/main/java/com/nepxion/discovery/common/entity/InstanceEntity.java
View file @
e9d13919
...
@@ -22,6 +22,7 @@ public class InstanceEntity implements Serializable {
...
@@ -22,6 +22,7 @@ public class InstanceEntity implements Serializable {
private
String
serviceId
;
private
String
serviceId
;
private
String
version
;
private
String
version
;
private
String
region
;
private
String
host
;
private
String
host
;
private
int
port
;
private
int
port
;
private
Map
<
String
,
String
>
metadata
;
private
Map
<
String
,
String
>
metadata
;
...
@@ -42,6 +43,14 @@ public class InstanceEntity implements Serializable {
...
@@ -42,6 +43,14 @@ public class InstanceEntity implements Serializable {
this
.
version
=
version
;
this
.
version
=
version
;
}
}
public
String
getRegion
()
{
return
region
;
}
public
void
setRegion
(
String
region
)
{
this
.
region
=
region
;
}
public
String
getHost
()
{
public
String
getHost
()
{
return
host
;
return
host
;
}
}
...
...
discovery-console-desktop/src/main/java/com/nepxion/discovery/console/desktop/workspace/ServiceTopology.java
View file @
e9d13919
...
@@ -93,7 +93,7 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -93,7 +93,7 @@ public class ServiceTopology extends AbstractTopology {
public
static
final
String
NO_FILTER
=
ConsoleLocale
.
getString
(
"no_service_cluster_filter"
);
public
static
final
String
NO_FILTER
=
ConsoleLocale
.
getString
(
"no_service_cluster_filter"
);
private
LocationEntity
groupLocationEntity
=
new
LocationEntity
(
120
,
250
,
280
,
0
);
private
LocationEntity
groupLocationEntity
=
new
LocationEntity
(
120
,
250
,
280
,
0
);
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
0
,
0
,
120
,
1
0
0
);
private
LocationEntity
nodeLocationEntity
=
new
LocationEntity
(
0
,
0
,
120
,
1
2
0
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
private
TopologyEntity
serviceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
private
TopologyEntity
notServiceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
GATEWAY_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
private
TopologyEntity
notServiceGroupEntity
=
new
TopologyEntity
(
TopologyEntityType
.
GATEWAY_GROUP
,
TopologyStyleType
.
LARGE
,
true
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
TopologyStyleType
.
MIDDLE
,
false
);
private
TopologyEntity
serviceNodeEntity
=
new
TopologyEntity
(
TopologyEntityType
.
SERVICE
,
TopologyStyleType
.
MIDDLE
,
false
);
...
@@ -404,6 +404,9 @@ public class ServiceTopology extends AbstractTopology {
...
@@ -404,6 +404,9 @@ public class ServiceTopology extends AbstractTopology {
stringBuilder
.
append
(
" -> V"
).
append
(
instance
.
getDynamicVersion
());
stringBuilder
.
append
(
" -> V"
).
append
(
instance
.
getDynamicVersion
());
}
}
stringBuilder
.
append
(
"]"
);
stringBuilder
.
append
(
"]"
);
if
(
StringUtils
.
isNotEmpty
(
instance
.
getRegion
()))
{
stringBuilder
.
append
(
"\n [Region="
).
append
(
instance
.
getRegion
()).
append
(
"]"
);
}
}
}
return
ButtonManager
.
getHtmlText
(
stringBuilder
.
toString
());
return
ButtonManager
.
getHtmlText
(
stringBuilder
.
toString
());
...
...
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
View file @
e9d13919
...
@@ -216,12 +216,14 @@ public class ConsoleEndpoint {
...
@@ -216,12 +216,14 @@ public class ConsoleEndpoint {
Map
<
String
,
String
>
metadata
=
serviceInstance
.
getMetadata
();
Map
<
String
,
String
>
metadata
=
serviceInstance
.
getMetadata
();
String
serviceId
=
serviceInstance
.
getServiceId
().
toLowerCase
();
String
serviceId
=
serviceInstance
.
getServiceId
().
toLowerCase
();
String
version
=
metadata
.
get
(
DiscoveryConstant
.
VERSION
);
String
version
=
metadata
.
get
(
DiscoveryConstant
.
VERSION
);
String
region
=
metadata
.
get
(
DiscoveryConstant
.
REGION
);
String
host
=
serviceInstance
.
getHost
();
String
host
=
serviceInstance
.
getHost
();
int
port
=
serviceInstance
.
getPort
();
int
port
=
serviceInstance
.
getPort
();
InstanceEntity
instanceEntity
=
new
InstanceEntity
();
InstanceEntity
instanceEntity
=
new
InstanceEntity
();
instanceEntity
.
setServiceId
(
serviceId
);
instanceEntity
.
setServiceId
(
serviceId
);
instanceEntity
.
setVersion
(
version
);
instanceEntity
.
setVersion
(
version
);
instanceEntity
.
setRegion
(
region
);
instanceEntity
.
setHost
(
host
);
instanceEntity
.
setHost
(
host
);
instanceEntity
.
setPort
(
port
);
instanceEntity
.
setPort
(
port
);
instanceEntity
.
setMetadata
(
metadata
);
instanceEntity
.
setMetadata
(
metadata
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment