Prabal864 opened a new pull request, #4339:
URL: https://github.com/apache/hertzbeat/pull/4339

   ## What's changed?
   
   Removes the broken **Push Style Monitor** (`app-push`) feature, per option 1 
in #4313.
   
   `PushCollectImpl` polls `GET /api/push?id=...&time=...` expecting a JSON 
body, but #3204 deleted `PushController`/`PushService` and replaced the push 
module with the Prometheus pushgateway-style API (`POST 
/api/push/prometheus/job/{job}/instance/{instance}`, documented at 
`home/docs/help/push.md`). Every collect cycle for an `app-push` monitor now 
fails with `HTTP 404`, and has since #3204 merged.
   
   A straight "rewire the URI" fix (option 2 in the issue) isn't viable: the 
two APIs are incompatible in method (GET-poll vs POST-push), payload format 
(custom JSON vs Prometheus text exposition), and addressing (`monitorId`+`time` 
vs `job`+`instance`). Making the old push template work again would mean 
writing a new collector, not a config change — and the pushgateway API already 
exists and is documented as the way to do push-style monitoring today.
   
   So this removes the dead code end to end instead of leaving a 
permanently-404ing monitor type in the UI:
   
   - `hertzbeat-manager/src/main/resources/define/app-push.yml` — the monitor 
template
   - `PushProtocol`, `PushMetricsDto` entities and their tests
   - `PushCollectImpl` (+ its test, + its two `META-INF/services` SPI 
registrations for regular and native-image builds)
   - The `push` field on `Metrics`, `DispatchConstants.PROTOCOL_PUSH`, and the 
special-case branches in `WheelTimerTask` and `AppServiceImpl.getAppHierarchy` 
that referenced it
   - `AppService(Impl).getPushDefine` and the `AppController` 
`/{monitorId}/pushdefine` endpoint (+ its controller test), and the frontend 
calls to it in `app-define.service.ts` / `monitor-detail.component.ts` / 
`startup.service.ts`
   - `home/docs/advanced/extend-push.md` (+ its current zh-CN i18n copy) — 
stale docs for the removed feature; its replacement is already documented at 
`home/docs/help/push.md`. The versioned docs snapshots for 1.6.x/1.7.x/1.8.0 
are left untouched since push-style monitoring worked as documented in those 
released versions.
   
   Closes #4313
   
   ## How was this patch tested?
   
   - `mvn -pl 
hertzbeat-common-core,hertzbeat-collector/hertzbeat-collector-common,hertzbeat-collector/hertzbeat-collector-basic,hertzbeat-manager
 -am compile` — clean build with JDK 25.
   - `mvn ... test-compile` — test sources compile.
   - Ran `AppControllerTest`, `WheelTimerTaskTest`, `CollectUtilTest` — all 
pass after the removal.
   - Grepped the full repo for `PROTOCOL_PUSH`, `PushProtocol`, 
`PushCollectImpl`, `PushMetricsDto`, `getPushDefine`, `pushdefine`, 
`app-push.yml` and `replaceFieldsForPushStyleMonitor` to confirm no leftover 
references outside historical blog posts / versioned docs.
   - I was not able to run the Angular frontend build (`web-app`) in this 
environment — no `node_modules` installed and installing them was outside the 
environment's network allowance — so the three edited `.ts` files were verified 
by manual read-through and grep for dangling references rather than a 
`tsc`/build pass. Worth a maintainer double-check on CI.
   
   ## Checklist
   
   - [x] I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [ ] I have written the necessary doc or comment. — not applicable; this 
removes a feature and its docs rather than adding one.
   - [x] I have added the necessary unit tests and all cases have passed. — no 
new tests added (this is a removal); existing tests touching the removed code 
were deleted with it, and the remaining suite (`AppControllerTest`, 
`WheelTimerTaskTest`, `CollectUtilTest`) passes.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed. — not applicable; this only removes API surface 
(`/apps/{monitorId}/pushdefine`), it doesn't add any.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to