Skip to content

Conversation

@pjcdawkins
Copy link
Collaborator

@pjcdawkins pjcdawkins commented Nov 5, 2025

Backports #1536 - as that MR says:

There are some changes here that will need to be communicated clearly in the changelog. I believe these are minor enough changes that they would be unlikely to break a dependent script and so they are warranted, particularly when accounting for the performance and other gains the new API brings.

  • exposing router by default
  • no longer exposing ---internal---storage (at least by default, perhaps entirely), although this was not intentionally exposed before
  • displaying inodes columns by default in the metrics command (though the first 5 columns are the same, and the other commands' default columns are the same)
  • deprecating the --interval option, as you said (the default interval displayed changes from 2 mins to 1)

romainneutron and others added 4 commits November 5, 2025 18:44
* Switch to new endpoint for querying metrics

* Address lint reports
This adjusts the backport to work with the 4.x codebase:

- Convert all metrics commands to use CommandBase methods instead of the Selector class
- Remove constructor dependencies and use service locator pattern via getService()
- Use filterEnvsMaybeActive(), validateInput(), and getSelectedEnvironment() for environment selection
- Remove CurlCommand reference from Application.php (command was deleted in backport)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Replace dependency injection with service locator pattern:
- Change $this->io->method() to $this->method() calls
- Change $this->api->method() to $this->api()->method() calls
- Use $this->getService('property_formatter') with local variable
- Fix Format::format() static method call (was trying to call instance method on string)
- Fix SourceField property access (remove ->value as they're now strings, not enums)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@pjcdawkins pjcdawkins requested a review from Copilot November 11, 2025 17:48
@pjcdawkins pjcdawkins marked this pull request as ready for review November 11, 2025 17:48
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR backports changes from #1536 to switch from the legacy metrics API to the new Observability Pipeline endpoints. The refactoring significantly simplifies the metrics querying architecture while introducing some minor breaking changes in the API behavior.

Key Changes:

  • Replaced POST-based metrics queries with GET requests to the Observability Pipeline /resources/overview endpoint
  • Removed the deprecated --interval option and the metrics:curl command
  • Refactored metrics data structures to use SourceField and SourceFieldPercentage classes instead of Sketch
  • Changed default behavior to expose router metrics and display inodes columns by default

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/Model/Metrics/TimeSpec.php Removed interval property and related methods as the new API handles intervals internally
src/Model/Metrics/Query.php Refactored to support GET-based queries with services, types, and aggregations parameters
src/Model/Metrics/Field.php Simplified from formatting logic to a data container with format, value, and warn properties
src/Model/Metrics/SourceField.php New class representing a metric source with aggregation and optional mountpoint
src/Model/Metrics/SourceFieldPercentage.php New class for calculating percentage metrics from two source fields
src/Model/Metrics/MetricKind.php New constants class defining metric types and API parameters
src/Model/Metrics/Format.php Extracted formatting logic from Field class into standalone utility
src/Model/Metrics/Aggregation.php New constants class for aggregation types
src/Model/Metrics/Sketch.php Removed legacy Sketch class no longer needed with new API
src/Command/Metrics/MetricsCommandBase.php Major refactoring to support new API with processQuery() and simplified data extraction
src/Command/Metrics/*Command.php Updated all metric commands to use new data structures and API
src/Command/Metrics/CurlCommand.php Removed deprecated command
src/Application.php Removed CurlCommand registration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@akalipetis akalipetis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@akalipetis akalipetis merged commit 9be9e3d into main Nov 17, 2025
3 of 4 checks passed
@akalipetis akalipetis deleted the backport-o11y-pipeline branch November 17, 2025 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants