{"id":20806308,"url":"https://github.com/nodesource/ah-stack-capturer","last_synced_at":"2025-03-12T03:41:30.220Z","repository":{"id":57174696,"uuid":"79946638","full_name":"nodesource/ah-stack-capturer","owner":"nodesource","description":"Captures async hook stack traces for specific resource types and events.","archived":false,"fork":false,"pushed_at":"2017-02-09T19:00:17.000Z","size":1185,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-18T13:28:37.877Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://nodesource.github.io/ah-stack-capturer","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodesource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-24T19:36:00.000Z","updated_at":"2021-12-26T19:11:37.000Z","dependencies_parsed_at":"2022-09-03T09:03:13.836Z","dependency_job_id":null,"html_url":"https://github.com/nodesource/ah-stack-capturer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-stack-capturer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-stack-capturer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-stack-capturer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodesource%2Fah-stack-capturer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodesource","download_url":"https://codeload.github.com/nodesource/ah-stack-capturer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243152876,"owners_count":20244657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T19:19:14.724Z","updated_at":"2025-03-12T03:41:30.198Z","avatar_url":"https://github.com/nodesource.png","language":"JavaScript","readme":"# ah-stack-capturer [![build status](https://secure.travis-ci.org/nodesource/ah-stack-capturer.png)](http://travis-ci.org/nodesource/ah-stack-capturer)\n\nCaptures async hook stack traces for specific resource types and events.\n\n```js\nconst capturer = StackCapturer.forAllEvents()\ncapturer.shouldCapture('init') // =\u003e true\nconst stack = capturer.captureStack()\nconst processed = capturer.processStack()\n```\n\n## Installation\n\n    npm install ah-stack-capturer\n\n## [API](https://nodesource.github.io/ah-stack-capturer)\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### StackCapturer\n\nCreates StackCapturere instance.\nEither `shouldCapture` OR `events` with optional `types` need to be supplied.\n\n**Parameters**\n\n-   `$0` **[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)** configures when a stack should be captured\n    -   `$0.events` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\u0026lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e?** defines on which async hooks events\n        (init|before|after|destroy) a stack should be captured (optional, default `null`)\n    -   `$0.types` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\u0026lt;[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e?** defines for which async hook types a\n        stack should be captured (optional, default `null`)\n    -   `$0.shouldCapture` **[function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function)?** `function ((event, type, activity)`\n        if supplied overrides the `shouldCapture` method entirely (optional, default `null`)\n\n### stackCapturer.shouldCaptureStack\n\nReturns `true|false` indicating if a stack should be captured according to the\noptions passed in the @constructor.\n\n**Parameters**\n\n-   `event` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the async hook event (init|before|after|destroy)\n-   `type` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the type of async resource that triggered the event\n\nReturns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` or `false` indicating if a stack should be captured\n\n### stackCapturer.captureStack\n\nCaptures the current stack.\n\nReturns **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the current stack\n\n### stackCapturer.processStack\n\nProcesses the supplied stack by splitting the string into lines\nand removing those that are part of the async hook execution itself.\n\nThis allows the user to focus only on the relevant stack.\n\n**Parameters**\n\n-   `stack` **[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** the captured stack\n\nReturns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\u0026lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e** the processed stack\n\n### StackCapturer.forAllEvents\n\nCreates a StackCapturer that captures ALL events for the supplied types.\n\n**Parameters**\n\n-   `types` **[Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\u0026lt;[String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\u003e?** types passed to the StackCapturer constructor\n\n### StackCapturer.turnedOff\n\nCreates a StackCapturer that captures nothing.\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fah-stack-capturer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodesource%2Fah-stack-capturer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodesource%2Fah-stack-capturer/lists"}