npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@m.dolgikh/nodejs-sentry-get-all-issues

v1.0.1

Published

Solving problem with unobvious pagination using sentry API - https://github.com/getsentry/sentry/issues/27147

Downloads

7

Readme

nodejs-sentry-get-all-issues

Motivation

Problem with unobvious pagination using sentry API - https://github.com/getsentry/sentry/issues/27147 There is a nodejs api solution

NOTE: its a very specific solution aimed at solving my specific problem :)

Installation

npm i @m.dolgikh/nodejs-sentry-get-all-issues

How it works

In Setnry API cursor-like pagination is being implemented. This script recursively calls function which sends request to sentry. Url with next cursor query parameter is being taken from response headers. Script is collecting results form responses until it gets result array with zero length (data.length === 0) and passes resultData to callback-function as argument.

Usage

const { getAllIssues } from 'nodejs-sentry-get-all-issues' 

getAllIssues(
  url, // your sentry url like - https://sentry.mycompany.com/api/0/organizations/sentry/issues/?limit=100&project=6&query=is%3Aunresolved&shortIdLookup=1&statsPeriod=90d
  token // -your sentry Beaber token - https://docs.sentry.io/api/auth/
  callback: (resultData) => { ...your code } // called after script execution, getting resultData as argument
)

for example, my case:

// I want to now how many JS-TypeErrors i have for last 90d

const { getAllIssues } = require('./index' )

const callback = resultData => {
  const resultMap = {}
  resultData
    .filter(record => record.title.includes('TypeError'))
    .forEach(record => {
      resultMap[record.title] = resultMap[record.title] ? Number(resultMap[record.title]) + Number(record.count) : Number(record.count)
    })
  console.log(resultMap)
} 

getAllIssues(
  'https://sentry.{my_company}.com/api/0/organizations/{my_organization}/issues/?limit=100&project=6&query=is%3Aunresolved&shortIdLookup=1&statsPeriod=90d',
  'my_token',
  callback
)

// result:
{
  "TypeError: Object doesn't support this action": 1521,
  'TypeError: NetworkError when attempting to fetch resource.': 2095,
  "TypeError: Cannot read property 'apply' of undefined": 17160,
  'TypeError: undefined is not a function': 4477,
  ...
}