Skip to content

[bugfix] Fix imported monitor instance being empty due to host/instan…#4142

Merged
tomsun28 merged 4 commits into
apache:masterfrom
starryCoder:fix-import-instance-empty
May 28, 2026
Merged

[bugfix] Fix imported monitor instance being empty due to host/instan…#4142
tomsun28 merged 4 commits into
apache:masterfrom
starryCoder:fix-import-instance-empty

Conversation

@starryCoder
Copy link
Copy Markdown
Contributor

@starryCoder starryCoder commented May 22, 2026

…ce field mismatch

What's changed?

When importing monitors via JSON/Excel, the instance field (which stores host:port) is always null in the database, because AbstractImExportServiceImpl.convert() uses BeanUtils.copyProperties to map between
MonitorDTO and Monitor, but the field names differ:

  • Monitor.instance stores host:port (e.g. localhost:161)
  • MonitorDTO.host is used in the export/import JSON format

BeanUtils.copyProperties matches by field name, so instancehost is never mapped.

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

@tomsun28 tomsun28 merged commit d5cf683 into apache:master May 28, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants