Skip to content

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

@pentium100

Description

@pentium100

Is there an existing issue for this?

  • 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

HertzBeat version(s): v1.8.0

Debug logs

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions