Add Python client for GetGlobalMetrics service with time range and statistics filtering #136
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements a comprehensive Python script to interact with the HPCC Platform GetGlobalMetrics service in ws_machines, based on the existing cppunit tests in
ws_machineService.cpp.Overview
The new
tools/get_global_metrics.pyscript provides a command-line interface for querying global metrics from HPCC Platform with support for:Implementation Details
The script creates XML requests that match the format expected by the GetGlobalMetrics service:
And parses the XML responses into structured Python data for easy processing.
Usage Examples
Testing and Quality Assurance
The implementation includes comprehensive unit tests (
testing/unittests/test_get_global_metrics.py) that verify:All tests pass and validate the script works correctly with the expected XML formats.
Future Extensibility
The script is designed to be easily extended with aggregation functionality in the next round of changes. An example aggregation script (
tools/example_aggregation.py) demonstrates how to build on this foundation to:Files Added
tools/get_global_metrics.py- Main Python client scripttools/example_aggregation.py- Example showing future aggregation capabilitiestools/README.md- Comprehensive documentation and usage examplestesting/unittests/test_get_global_metrics.py- Unit testsThe implementation provides a solid foundation for the planned aggregation features while being immediately useful for querying and analyzing HPCC Platform global metrics.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.