apache / apache/hertzbeat

[BUG] 当修改一个使用了服务发现的监控时,后台会抛异常

Open
#4,100 0 comments 0 reactions 1 assignee Claimed by @pentium100 View on GitHub
bug
Dominant language
Java
Stars
7.4k
Forks
1.3k
Avg merge
1d 20h
Merged PRs (30d)
32

Description

### Is there an existing issue for this?

- [x] I have searched the existing issues

### Current Behavior

[BUG] 当修改一个使用了服务发现的监控时,后台会抛异常

2026-03-29 15:22:10 [http-nio-1157-exec-1] ERROR org.apache.hertzbeat.manager.support.GlobalExceptionHandler - [monitor]-[unknown error happen]-null
java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:220)
at java.base/java.util.ImmutableCollections$MapN.(ImmutableCollections.java:1437)
at java.base/java.util.Map.of(Map.java:1384)
at org.apache.hertzbeat.manager.service.impl.MonitorServiceImpl.modifyMonitor(MonitorServiceImpl.java:418)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)

新建时不会,就是修改会。原因是修改的服务上没有处理scrape为service discovery时,instance为空的情况。

### Expected Behavior

_No response_

### Steps To Reproduce

1. add any type of monitor
2. select nacos service discovery
3. fill nacos server information.
4. confirm it.
5. edit monitor.
6. don't change any thing , just save it.
7. you will got error.

### Environment

```markdown
HertzBeat version(s): v1.8.0
```

### Debug logs

_No response_

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.