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
0a332896
Unverified
Commit
0a332896
authored
Jul 24, 2023
by
ZackYoung
Committed by
GitHub
Jul 24, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize get metrics (#2145)
parent
beca02a7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
FlinkMetricsIndicator.java
...nky/configure/schedule/metrics/FlinkMetricsIndicator.java
+15
-6
No files found.
dinky-admin/src/main/java/org/dinky/configure/schedule/metrics/FlinkMetricsIndicator.java
View file @
0a332896
...
@@ -52,8 +52,10 @@ import org.springframework.stereotype.Component;
...
@@ -52,8 +52,10 @@ import org.springframework.stereotype.Component;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.thread.AsyncUtil
;
import
cn.hutool.core.thread.AsyncUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.URLUtil
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONArray
;
import
cn.hutool.json.JSONObject
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
...
@@ -179,15 +181,15 @@ public class FlinkMetricsIndicator extends BaseSchedule {
...
@@ -179,15 +181,15 @@ public class FlinkMetricsIndicator extends BaseSchedule {
return
;
return
;
}
}
// http://10.8.16.125:8282/jobs/06ccde3ff6e53bafe729e0e50fca72fd/vertices/cbc357ccb763df2852fee8c4fc7d55f2/metrics?get=0.buffers.inputExclusiveBuffersUsage
// http://10.8.16.125:8282/jobs/06ccde3ff6e53bafe729e0e50fca72fd/vertices/cbc357ccb763df2852fee8c4fc7d55f2/metrics?get=0.buffers.inputExclusiveBuffersUsage
,0.numRecordsInPerSecond
flinkMetrics
flinkMetrics
.
getVerticesAndMetricsMap
()
.
getVerticesAndMetricsMap
()
.
forEach
(
.
forEach
(
(
v
,
m
)
->
{
(
v
,
m
)
->
{
for
(
String
metrics
:
m
.
keySet
())
{
if
(
CollUtil
.
isEmpty
(
urlList
))
{
if
(
CollUtil
.
isEmpty
(
urlList
))
{
return
;
return
;
}
}
String
metricsName
=
StrUtil
.
join
(
","
,
m
.
keySet
());
HttpUtils
.
asyncRequest
(
HttpUtils
.
asyncRequest
(
flinkMetrics
.
getUrls
(),
flinkMetrics
.
getUrls
(),
"/jobs/"
"/jobs/"
...
@@ -195,14 +197,21 @@ public class FlinkMetricsIndicator extends BaseSchedule {
...
@@ -195,14 +197,21 @@ public class FlinkMetricsIndicator extends BaseSchedule {
+
"/vertices/"
+
"/vertices/"
+
v
+
v
+
"/metrics?get="
+
"/metrics?get="
+
metrics
,
+
URLUtil
.
encode
(
metricsName
)
,
flinkMetricsRequestTimeout
.
get
(),
flinkMetricsRequestTimeout
.
get
(),
x
->
{
x
->
{
JSONArray
array
=
JSONUtil
.
parseArray
(
x
.
body
());
JSONArray
array
=
JSONUtil
.
parseArray
(
x
.
body
());
String
value
=
array
.
getJSONObject
(
0
).
getStr
(
"value"
);
if
(
CollUtil
.
isEmpty
(
array
))
{
m
.
put
(
metrics
,
value
);
return
;
});
}
}
array
.
forEach
(
y
->
{
JSONObject
jsonObject
=
JSONUtil
.
parseObj
(
y
);
String
id
=
jsonObject
.
getStr
(
"id"
);
String
value
=
jsonObject
.
getStr
(
"value"
);
m
.
put
(
id
,
value
);
});
});
});
});
FLINK_METRICS_DATA_MAP
.
get
(
now
).
add
(
flinkMetrics
);
FLINK_METRICS_DATA_MAP
.
get
(
now
).
add
(
flinkMetrics
);
}
}
...
...
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