-
Notifications
You must be signed in to change notification settings - Fork 1.3k
fix(manager): set instance to 'unknow' for dynamic monitors on modification #4101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 7 commits
91f4f9f
c336f9a
92e68ac
241a54c
9a05e82
a63d626
908b092
dcedd8b
61e5e26
6b123d6
1429ee5
be46c3c
48e8e94
4bdaf65
a8e2d53
31b2e19
1b5c453
005590a
83867e1
454f92f
ded849f
e4b0340
37858f3
19e223e
dac79ae
fbcb50f
d2f0379
9569828
93b6b7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -172,7 +172,7 @@ public void addMonitor(Monitor monitor, List<Param> params, String collector, Gr | |
| Job appDefine = appService.getAppDefine(app); | ||
| if (!isStatic) { | ||
| appDefine.setSd(true); | ||
| monitor.setInstance("unknow"); | ||
| monitor.setInstance("unknown"); | ||
| } | ||
| if (CommonConstants.PROMETHEUS.equals(monitor.getApp())) { | ||
| appDefine.setApp(CommonConstants.PROMETHEUS_APP_PREFIX + monitor.getName()); | ||
|
|
@@ -382,6 +382,12 @@ public void modifyMonitor(Monitor monitor, List<Param> params, String collector, | |
| labelDao.saveAll(addLabels); | ||
| } | ||
|
|
||
| boolean isStatic = CommonConstants.SCRAPE_STATIC.equals(monitor.getScrape()) | ||
| || !StringUtils.hasText(monitor.getScrape()); | ||
| if (!isStatic && !StringUtils.hasText(monitor.getInstance())) { | ||
| monitor.setInstance("unknown"); | ||
| } | ||
|
|
||
| String instance = monitor.getInstance(); | ||
| // The port field may be null | ||
| Param portParam = params.stream() | ||
|
|
@@ -391,13 +397,13 @@ public void modifyMonitor(Monitor monitor, List<Param> params, String collector, | |
| String portWithMark = (Objects.isNull(portParam) || !StringUtils.hasText(portParam.getParamValue())) | ||
| ? "" | ||
| : SignConstants.DOUBLE_MARK + portParam.getParamValue(); | ||
| if (Objects.nonNull(instance)) { | ||
| if (Objects.nonNull(instance)&&!IpDomainUtil.isHasPortWithMark(instance)) { | ||
| instance = instance + portWithMark; | ||
| } | ||
|
|
||
|
|
||
| monitor.setInstance(instance); | ||
|
Comment on lines
391
to
404
|
||
|
|
||
| boolean isStatic = CommonConstants.SCRAPE_STATIC.equals(monitor.getScrape()) | ||
| || !StringUtils.hasText(monitor.getScrape()); | ||
| if (preMonitor.getStatus() != CommonConstants.MONITOR_PAUSED_CODE) { | ||
| // Construct the collection task Job entity | ||
| String app = isStatic ? monitor.getApp() : monitor.getScrape(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.