Skip to content

Instantly share code, notes, and snippets.

@sjelfull
Created February 24, 2025 08:37
Show Gist options
  • Save sjelfull/2f7350f080edbbbe5f3e582b721d13c6 to your computer and use it in GitHub Desktop.
Save sjelfull/2f7350f080edbbbe5f3e582b721d13c6 to your computer and use it in GitHub Desktop.
Download Sentry issues as CSV
function extractIssues() {
const issues = [];
const rows = document.querySelectorAll('[data-test-id="group"]');
rows.forEach(row => {
const issue = {
id: row.getAttribute('data-group-id'),
title: row.querySelector('[data-sentry-component="EventOrGroupTitle"]').textContent.trim(),
status: row.querySelector('[data-sentry-element="GraphText"]').textContent.trim(),
lastSeen: row.querySelector('time').getAttribute('datetime'),
events: row.querySelector('.app-1eic321').textContent.trim()
};
issues.push(issue);
});
return issues;
}
function createCSV(issues) {
const headers = ['ID', 'Title', 'Status', 'Last Seen', 'Events'];
const csvContent = [
headers.join(','),
...issues.map(issue => [
issue.id,
`"${issue.title.replace(/"/g, '""')}"`,
issue.status,
issue.lastSeen,
issue.events
].join(','))
].join('\n');
const blob = new Blob([csvContent], { type: 'text/csv;charset=utf-8;' });
const link = document.createElement('a');
const url = URL.createObjectURL(blob);
link.setAttribute('href', url);
link.setAttribute('download', 'sentry_issues.csv');
link.style.visibility = 'hidden';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
createCSV(issues);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment