Skip to content

Conversation

@ericahinkleRH
Copy link
Contributor

CSV Export Plugin for TimeSeriesChart

This PR implements the CSV export functionality for the TimeSeriesChart plugin, working in conjunction with the core changes in perses/perses to enable CSV downloads for time series data. File gets downloaded with name "panelName_data.csv".

Overview

Adds an "Export as CSV" action button to TimeSeriesChart panels that allows users to download their time series data in CSV format. The export includes proper column headers (using legend names when available) and formats timestamps in ISO 8601 format for Excel and Sheets compatibility.

Implementation Details

  • TimeSeriesExportAction component: Renders the download button and handles CSV generation
  • CSV export utilities: Functions for data formatting, filename sanitization, and CSV generation
  • Plugin integration: Adds export action to TimeSeriesChart plugin definition
  • File naming: Generates descriptive filenames based on panel title (format: panelName_data.csv)

Integration with Core Changes

  • Depends on: Core CSV export infrastructure from perses/perses PR #3129 - "[FEATURE] - TimeSeries Export Functionality w/ Plugins"
  • Plugin actions system: Utilizes the refactored plugin actions architecture
  • Data flow: Receives QueryData[] from core system and converts to CSV format

Files Added/Modified

  • TimeSeriesExportAction.tsx - Export button component and download logic
  • CSVExportUtils.ts - CSV formatting and export utilities
  • TimeSeriesChart.tsx - Plugin definition with export action
  • time-series-chart-model.ts - Type definitions (if applicable)

Testing

  • Export button appears only when time series data is available
  • CSV format is Excel and Sheets-compatible
  • Filename sanitization handles special characters
  • Legend names are used as column headers when available

Dependencies

This plugin requires the core CSV export functionality implemented in perses/perses PR #3129. The dependency will be updated to use the snapshot branch once available.

Screenshots

Export Button:
image

File Name and Information Format:
image


Checklist

  • Pull request has a descriptive title and context useful to a reviewer
  • Pull request title follows the [<catalog_entry>] naming convention
  • All commits have DCO signoffs
  • Plugin follows Perses plugin architecture guidelines
  • Export functionality integrates properly with panel actions system

UI Changes

  • Changes that impact the UI include screenshots and/or screencasts of the relevant changes.
  • Code follows the UI guidelines.

@ericahinkleRH ericahinkleRH force-pushed the timeseries-csv-export-plugin branch from c6120cb to a5578cf Compare July 31, 2025 12:56
@ericahinkleRH ericahinkleRH marked this pull request as ready for review August 1, 2025 14:45
@jgbernalp
Copy link
Contributor

LGTM, we will wait for the v0.52.0-beta.1 release so we can include official changes and not from a snapshot

@ericahinkleRH ericahinkleRH force-pushed the timeseries-csv-export-plugin branch 2 times, most recently from 4f3fe8c to 465e386 Compare August 7, 2025 16:47
Signed-off-by: Erica Hinkle <ehinkle@redhat.com>
@ericahinkleRH ericahinkleRH force-pushed the timeseries-csv-export-plugin branch from 465e386 to 05c1afd Compare August 7, 2025 17:49
@jgbernalp
Copy link
Contributor

Tested locally with the latest Perses version, Awesome @ericahinkleRH !

@jgbernalp jgbernalp merged commit a590d82 into perses:main Aug 8, 2025
11 of 12 checks passed
"color-hash": "^2.0.2",
"@perses-dev/components": "0.52.0-beta.1",
"@perses-dev/core": "0.52.0-beta.1",
"@perses-dev/plugin-system": "0.52.0-beta.1"
Copy link
Member

@Nexucis Nexucis Aug 8, 2025

Choose a reason for hiding this comment

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

is there a reason why the perses dependency have been moved out of the peerDependencies ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same as #226 (comment)

rafi-ruetcse17 pushed a commit to rafi-ruetcse17/perses_plugins that referenced this pull request Aug 14, 2025
…ses#208)

Signed-off-by: Erica Hinkle <ehinkle@redhat.com>
Signed-off-by: rafi <rafialam@appscode.com>
andreasgerstmayr pushed a commit to andreasgerstmayr/perses-plugins that referenced this pull request Aug 20, 2025
abelyakin pushed a commit to abelyakin/plugins that referenced this pull request Sep 12, 2025
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