feature: support for batch creating task through http_sd
What's changed?
Steps to batch create task through http_sd
- Add http_sd params in template yml
- field: http_sd
name:
zh-CN: http_sd
en-US: http_sd
type: text
placeholder: Enter http_sd url
required: false
hide: true
- Enter http_sd url when trying to create task(optional)
Checklist
- [x] 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.
👍 relate pr https://github.com/apache/hertzbeat/pull/1791
Relate issue #1625
hi thanks for contribution. there are some conflict files need be resolved if you are time.
hi thanks for contribution. there are some conflict files need be resolved if you are time.
@tomsun28 I've resolved conflict, please wait me to check the code and feature if is all set before merging.
@tomsun28 This branch can be merged now!
@tomsun28 This branch can be merged now!
thanks, we want to merge this after publish v1.6.0
@tomsun28 This branch can be merged now!
thanks, we want to merge this after publish v1.6.0
Got it.
hi, how about the design when update the monitoring.
hi, how about the design when update the monitoring.
Do you mean updating http_sd monitor or those monitors which are created by http_sd?
Do you mean updating http_sd monitor or those monitors which are created by http_sd?
hi, yes. Due the monitors automatic discovery by http_sd response data, when http_sd response data change, should we consider updating the automatically created monitors?
Suggest we consider these designs in the first version to facilitate future expansion, but do not have to implement it right away.
Do you mean updating http_sd monitor or those monitors which are created by http_sd?
hi, yes. Due the monitors automatic discovery by http_sd response data, when http_sd response data change, should we consider updating the automatically created monitors?
It should be discussed first. I think these steps are the key of updating monitors automatically:
- The monitor which is configed http_sd(Maybe we can refer to it as
the main monitorbelow) must have a relation in DB with monitors which are created bythe main monitor. So that we can handle each monitor withthe main monitor. - Create a cyclic task for
the main monitor, which is used to collect service discovery data. - Isolate data in
CommonDataQueuedue to service discovery data is completely different from other data. -
Managerpoll service discovery data and update monitors.
So far this idea came into my mind. How about this design in general?
hi, look great!!
- The monitor which is configed http_sd(Maybe we can refer to it as the main monitor below) must have a relation in DB with monitors which are created by the main monitor. So that we can handle each monitor with the main monitor.
It is recommended to create a new table to associate their relationships.
Not sure if we need to add an 'auto' field to 'hzb_monitor' to indicate if this monitor was created by auto discover or not, if it's not non-essential, we may choose not add it now.
The design makes full use of existing capabilities while minimizing modifications.👍
hi, look great!!
- The monitor which is configed http_sd(Maybe we can refer to it as the main monitor below) must have a relation in DB with monitors which are created by the main monitor. So that we can handle each monitor with the main monitor.
It is recommended to create a new table to associate their relationships. Not sure if we need to add an 'auto' field to 'hzb_monitor' to indicate if this monitor was created by auto discover or not, if it's not non-essential, we may choose not add it now.
The design makes full use of existing capabilities while minimizing modifications.👍
We can add a tag named Auto created by http_sd to each monitor.
I will try to implement this design this weekend.
@tomsun28
http_sd can detect target regularly and create monitor automatically now.
Two steps to support more sd if we need it:
- Create a sd collect like any other collect
- Add an enum element in
org.apache.hertzbeat.common.entity.sd.ServiceDiscoveryProtocol
The entire process of sd:
@tomsun28
hi, look great!!
- The monitor which is configed http_sd(Maybe we can refer to it as the main monitor below) must have a relation in DB with monitors which are created by the main monitor. So that we can handle each monitor with the main monitor.
It is recommended to create a new table to associate their relationships. Not sure if we need to add an 'auto' field to 'hzb_monitor' to indicate if this monitor was created by auto discover or not, if it's not non-essential, we may choose not add it now.
The design makes full use of existing capabilities while minimizing modifications.👍
I create a table named hzb_monitor_bind to associate relationships.
See also: org.apache.hertzbeat.common.entity.manager.MonitorBind
It's hard to merge after all these pr, I think I have to create another pr and this pr will be closed tomorrow. @tomsun28
It's hard to merge after all these pr, I think I have to create another pr and this pr will be closed tomorrow. @tomsun28
ok, we refactored some modules which caused so many conflicts.