butterfly-520-boy opened a new pull request, #4439:
URL: https://github.com/apache/hertzbeat/pull/4439
## What's changed?
HTTP request bodies currently cannot generate a UUID for use by subsequent
metrics. Add `{{v4uuid}}` substitution in `http.payload`, including bodies
supplied through monitoring parameters.
Generate one UUID v4 at the start of each collection cycle and reuse it
across the cycle's HTTP metrics. Each subsequent cycle gets a new value. The
UUID remains collector-local and is excluded from job serialization. Copy the
task configuration when resolving the payload so the stored template and shared
subtask state remain intact.
Existing static parameters and previous-metric token substitutions retain
their behavior. This proposal limits UUID substitution to HTTP payloads;
headers, URLs and other template fields are unchanged. Add English and Chinese
examples to the HTTP token tutorial.
Fixes #3032.
## Validation
- 26 related tests pass, including five new regression tests.
- A local HTTP server records actual request bodies to verify same-cycle
reuse, next-cycle refresh, repeated occurrences, parameter-supplied bodies and
compatibility with previous-metric token substitution.
- Tests also verify template preservation, subtask state, unchanged ordinary
payloads and job serialization.
- Checkstyle: 0 violations.
- The updated Markdown and embedded YAML/JSON examples parse successfully. A
full documentation-site build was not run.
```text
./mvnw -pl hertzbeat-collector/hertzbeat-collector-collector -am
-Dtest=DynamicUuidCollectionTest,MetricsCollectTest,CommonDispatcherTest,CollectUtilTest,JobTest
-Dsurefire.failIfNoSpecifiedTests=false test
```
## Checklist
- [x] I have read the [Contributing
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide).
- [x] I have written the necessary documentation and comments.
- [x] I have added the necessary tests and all cases have passed.
## Add or update API
No public endpoint or dependency changes. The new runtime UUID field is
excluded from job JSON.
--
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]