Skip to content

Switch to Observability Pipeline endpoints for querying metrics#1536

Merged
pjcdawkins merged 2 commits intoplatformsh:5.xfrom
romainneutron:metriccommands
Nov 5, 2025
Merged

Switch to Observability Pipeline endpoints for querying metrics#1536
pjcdawkins merged 2 commits intoplatformsh:5.xfrom
romainneutron:metriccommands

Conversation

@romainneutron
Copy link
Copy Markdown
Contributor

@romainneutron romainneutron commented Jun 2, 2025

This PR uses observability pipeline for metrics commands

It fixes OBS-1224

This deprecates the interval option that is not supported on observability pipelines, and the metrics:curl command that is not supported by observability pipelines

@romainneutron romainneutron force-pushed the metriccommands branch 3 times, most recently from 167435c to de96051 Compare October 14, 2025 09:44
@romainneutron romainneutron force-pushed the metriccommands branch 2 times, most recently from 96dfa31 to dadcded Compare October 14, 2025 12:43
@romainneutron romainneutron changed the title Switch to new endpoint for querying metrics Switch to Observability Pipeline endpoints for querying metrics Oct 14, 2025
@romainneutron romainneutron marked this pull request as ready for review October 14, 2025 12:44
@pjcdawkins pjcdawkins requested a review from Copilot October 30, 2025 12:20
Copy link
Copy Markdown

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 modernizes the metrics command system by switching from the legacy metrics API to the new Observability Pipeline endpoints. The changes involve significant refactoring of the metrics command architecture and data model.

  • Replaces the legacy metrics API with observability pipeline endpoints for querying metrics
  • Introduces new model classes with type-safe enums and structured data handling
  • Deprecates the interval option and metrics:curl command as they are not supported by the new pipeline

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/Model/ProjectRoles.php Style improvement for consistent comparison operator placement
src/Model/Metrics/TimeSpec.php Removes interval parameter from TimeSpec constructor and related methods
src/Model/Metrics/SourceFieldPercentage.php Adds new model for percentage calculations with value and limit fields
src/Model/Metrics/SourceField.php Adds new model for source field definitions with metric kind, aggregation, and mountpoint
src/Model/Metrics/Sketch.php Removes deprecated Sketch class that handled old API response format
src/Model/Metrics/Query.php Complete refactor to support new observability pipeline query format
src/Model/Metrics/MetricKind.php Adds enum for metric types and API constants for type and aggregation mapping
src/Model/Metrics/Format.php Adds new enum-based formatting system with color-coded warning thresholds
src/Model/Metrics/Field.php Simplifies Field class to use new format and source field system
src/Model/Metrics/Aggregation.php Adds enum for aggregation types (avg, max)
src/Command/Metrics/MetricsCommandBase.php Removes legacy base class with old API integration
src/Command/Metrics/MemCommand.php Updates to use new AbstractMetricsCommandBase and new model classes
src/Command/Metrics/DiskUsageCommand.php Updates to use new AbstractMetricsCommandBase and new model classes
src/Command/Metrics/CurlCommand.php Deprecates command with warning message as it's not supported by new pipeline
src/Command/Metrics/CpuCommand.php Updates to use new AbstractMetricsCommandBase and new model classes
src/Command/Metrics/AllMetricsCommand.php Updates to use new AbstractMetricsCommandBase and comprehensive field mapping
src/Command/Metrics/AbstractMetricsCommandBase.php Adds new base class with observability pipeline integration
.php-cs-fixer.dist.php Adds rule to remove unused imports for better code quality

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

@romainneutron romainneutron force-pushed the metriccommands branch 4 times, most recently from 900e327 to 04bfc0a Compare October 31, 2025 08:58
@romainneutron romainneutron force-pushed the metriccommands branch 2 times, most recently from 0b94788 to 59ffeda Compare November 4, 2025 11:00
@pjcdawkins
Copy link
Copy Markdown
Collaborator

Noting:

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)

cc @akalipetis

@pjcdawkins pjcdawkins merged commit 5ddedfc into platformsh:5.x Nov 5, 2025
3 checks passed
@romainneutron romainneutron deleted the metriccommands branch November 5, 2025 17:21
pjcdawkins pushed a commit that referenced this pull request Nov 5, 2025
* Switch to new endpoint for querying metrics

* Address lint reports
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.

3 participants