yunfengzhou-hub opened a new pull request, #760: URL: https://github.com/apache/flink-agents/pull/760
<!-- Please link the PR to the relevant issue(s). Hotfix doesn't need this.
-->
Linked issue: #744
### Purpose of change
Use key-value metric groups for `action` and `model` dimensions instead of
plain named sub-groups. This makes these dimensions available as labels in
reporters that support them (e.g., Prometheus), and produces more structured
metric identifiers:
- Action metrics: `<action_name>.numOfActionsExecuted` →
`action.<action_name>.numOfActionsExecuted`
- Token metrics: `<action_name>.<model_name>.promptTokens` →
`action.<action_name>.model.<model_name>.promptTokens`
### Tests
- Unit tests (value-based and mock-based) verify the key-value group
hierarchy and counter accumulation.
- An end-to-end integration test using `InMemoryReporter` +
`MiniClusterExtension` validates the complete metric identifier through the
real Flink metric system.
### API
- **Breaking**: The metric identifiers for `promptTokens`,
`completionTokens`, and per-action execution counters now include the key
prefix (`action.`, `model.`). Metric reporter queries or dashboards referencing
the old names need updating.
- A new `getSubGroup(String key, String value)` method is added to the
`FlinkAgentsMetricGroup` interface (Java) and `get_sub_group(name, value)`
(Python).
- `getSubGroup(String name)` now rejects names containing `=` to prevent
cache-key collisions with the key-value variant.
### Documentation
<!-- Do not remove this section. Check the proper box only. -->
- [ ] `doc-needed` <!-- Your PR changes impact docs -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [x] `doc-included` <!-- Your PR already contains the necessary
documentation updates -->
--
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]
