Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dinky
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangpeng
dinky
Commits
1400d08e
Unverified
Commit
1400d08e
authored
Jan 24, 2024
by
ZackYoung
Committed by
GitHub
Jan 24, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Doc] Optimize cdcsource split table (#3055)
parent
3c386303
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
SplitUtil.java
dinky-common/src/main/java/org/dinky/utils/SplitUtil.java
+11
-7
index.tsx
dinky-web/src/pages/Metrics/Server/index.tsx
+1
-1
cdcsource_overview.md
.../practical_guide/cdcsource_practice/cdcsource_overview.md
+0
-0
No files found.
dinky-common/src/main/java/org/dinky/utils/SplitUtil.java
View file @
1400d08e
...
@@ -33,18 +33,22 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -33,18 +33,22 @@ import lombok.extern.slf4j.Slf4j;
*/
*/
@Slf4j
@Slf4j
public
class
SplitUtil
{
public
class
SplitUtil
{
public
static
final
String
ENABLE
=
"enable"
;
public
static
final
String
MATCH_NUMBER_REGEX
=
"match_number_regex"
;
public
static
final
String
MAX_MATCH_VALUE
=
"match_number_regex"
;
public
static
final
String
MATCH_WAY
=
"match_way"
;
public
static
boolean
contains
(
String
regex
,
String
sourceData
)
{
public
static
boolean
contains
(
String
regex
,
String
sourceData
)
{
return
Pattern
.
matches
(
regex
,
sourceData
);
return
Pattern
.
matches
(
regex
,
sourceData
);
}
}
public
static
boolean
isSplit
(
String
value
,
Map
<
String
,
String
>
splitConfig
)
{
public
static
boolean
isSplit
(
String
value
,
Map
<
String
,
String
>
splitConfig
)
{
String
matchNumberRegex
=
splitConfig
.
get
(
"match_number_regex"
);
String
matchNumberRegex
=
splitConfig
.
get
(
MATCH_NUMBER_REGEX
);
Pattern
pattern
=
Pattern
.
compile
(
matchNumberRegex
);
Pattern
pattern
=
Pattern
.
compile
(
matchNumberRegex
);
Matcher
matcher
=
pattern
.
matcher
(
value
);
Matcher
matcher
=
pattern
.
matcher
(
value
);
if
(
matcher
.
find
())
{
if
(
matcher
.
find
())
{
long
splitNum
=
Long
.
parseLong
(
matcher
.
group
(
0
).
replaceFirst
(
"_"
,
""
));
long
splitNum
=
Long
.
parseLong
(
matcher
.
group
(
0
).
replaceFirst
(
"_"
,
""
));
long
maxMatchValue
=
Long
.
parseLong
(
splitConfig
.
get
(
"max_match_value"
));
long
maxMatchValue
=
Long
.
parseLong
(
splitConfig
.
get
(
MAX_MATCH_VALUE
));
return
splitNum
<=
maxMatchValue
;
return
splitNum
<=
maxMatchValue
;
}
}
return
false
;
return
false
;
...
@@ -53,8 +57,8 @@ public class SplitUtil {
...
@@ -53,8 +57,8 @@ public class SplitUtil {
public
static
String
getReValue
(
String
value
,
Map
<
String
,
String
>
splitConfig
)
{
public
static
String
getReValue
(
String
value
,
Map
<
String
,
String
>
splitConfig
)
{
if
(
isEnabled
(
splitConfig
))
{
if
(
isEnabled
(
splitConfig
))
{
try
{
try
{
String
matchNumberRegex
=
splitConfig
.
get
(
"match_number_regex"
);
String
matchNumberRegex
=
splitConfig
.
get
(
MATCH_NUMBER_REGEX
);
String
matchWay
=
splitConfig
.
get
(
"match_way"
);
String
matchWay
=
splitConfig
.
get
(
MATCH_WAY
);
Pattern
pattern
=
Pattern
.
compile
(
matchNumberRegex
);
Pattern
pattern
=
Pattern
.
compile
(
matchNumberRegex
);
Matcher
matcher
=
pattern
.
matcher
(
value
);
Matcher
matcher
=
pattern
.
matcher
(
value
);
// Determine whether it is a prefix or a suffix
// Determine whether it is a prefix or a suffix
...
@@ -62,7 +66,7 @@ public class SplitUtil {
...
@@ -62,7 +66,7 @@ public class SplitUtil {
if
(
matcher
.
find
())
{
if
(
matcher
.
find
())
{
String
num
=
matcher
.
group
(
0
);
String
num
=
matcher
.
group
(
0
);
long
splitNum
=
Long
.
parseLong
(
num
.
replaceFirst
(
"_"
,
""
));
long
splitNum
=
Long
.
parseLong
(
num
.
replaceFirst
(
"_"
,
""
));
long
maxMatchValue
=
Long
.
parseLong
(
splitConfig
.
get
(
"max_match_value"
));
long
maxMatchValue
=
Long
.
parseLong
(
splitConfig
.
get
(
MAX_MATCH_VALUE
));
if
(
splitNum
<=
maxMatchValue
)
{
if
(
splitNum
<=
maxMatchValue
)
{
return
value
.
substring
(
0
,
value
.
lastIndexOf
(
num
));
return
value
.
substring
(
0
,
value
.
lastIndexOf
(
num
));
}
}
...
@@ -76,7 +80,7 @@ public class SplitUtil {
...
@@ -76,7 +80,7 @@ public class SplitUtil {
return
value
;
return
value
;
}
}
long
splitNum
=
Long
.
parseLong
(
num
.
replaceFirst
(
"_"
,
""
));
long
splitNum
=
Long
.
parseLong
(
num
.
replaceFirst
(
"_"
,
""
));
long
maxMatchValue
=
Long
.
parseLong
(
splitConfig
.
get
(
"max_match_value"
));
long
maxMatchValue
=
Long
.
parseLong
(
splitConfig
.
get
(
MAX_MATCH_VALUE
));
if
(
splitNum
<=
maxMatchValue
)
{
if
(
splitNum
<=
maxMatchValue
)
{
return
value
.
substring
(
0
,
value
.
lastIndexOf
(
num
));
return
value
.
substring
(
0
,
value
.
lastIndexOf
(
num
));
}
}
...
@@ -90,6 +94,6 @@ public class SplitUtil {
...
@@ -90,6 +94,6 @@ public class SplitUtil {
}
}
public
static
boolean
isEnabled
(
Map
<
String
,
String
>
split
)
{
public
static
boolean
isEnabled
(
Map
<
String
,
String
>
split
)
{
return
Boolean
.
parseBoolean
(
split
.
get
(
"enable"
));
return
Boolean
.
parseBoolean
(
split
.
get
(
ENABLE
));
}
}
}
}
dinky-web/src/pages/Metrics/Server/index.tsx
View file @
1400d08e
...
@@ -72,7 +72,7 @@ const Server: React.FC<ServerProp> = (props) => {
...
@@ -72,7 +72,7 @@ const Server: React.FC<ServerProp> = (props) => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
timeRange
.
isReal
)
{
if
(
timeRange
.
isReal
)
{
return
subscribeTopic
([
`
${
SSE_TOPIC
.
METRICS
}
/local`
],
(
data
:
SseData
)
=>
return
subscribeTopic
([
`
${
SSE_TOPIC
.
METRICS
}
/local`
],
(
data
:
SseData
)
=>
setJvmData
((
prevState
)
=>
processData
(
prevState
,
[
data
.
data
])
)
setJvmData
((
prevState
)
=>
[...
processData
(
prevState
,
[
data
.
data
])]
)
);
);
}
}
},
[
timeRange
]);
},
[
timeRange
]);
...
...
docs/docs/practical_guide/cdcsource_practice/cdcsource_overview.md
View file @
1400d08e
This diff is collapsed.
Click to expand it.
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