{
"repo": "hypertrace",
"timestamp": "2026-01-16T23:56:01.934Z",
"entryPoint": "index.js",
"exports": {
"packageJson": {
"main": "index.js"
}
},
"api": {
"file": "index.js",
"exports": [],
"classes": [
{
"name": "Hypertrace"
},
{
"name": "NoTracingClass"
},
{
"name": "cannot"
}
],
"functions": [
{
"name": "is"
}
]
},
"readme": {
"content": "# hypertrace\n\nAdd tracing and insights to classes. One of the goals of the module is that there is close to zero overhead when tracing is not enabled. This is achieved by not enabling tracing on objects created before tracing was enabled.\n\nSimilarly if caching is enabled then there is almost zero overhead while tracing.\n\nThere is support for Prometheus/Grafana through [hypertrace-prometheus](https://github.com/holepunchto/hypertrace-prometheus) to get better visual insights into an application's behavior.\n\n## Installation\n\n```\n$ npm i hypertrace\n```\n\n## Usage / instrumentation\n\nFirst create tracers in the classes where insights are needed\n\n`some-module.js`\n``` js\nimport { createTracer } from 'hypertrace'\n\nexport default class SomeModule {\n constructor () {\n this.tracer = createTracer(this, {\n props: {\n some: 'property'\n }\n })\n }\n\n createChild () {\n const child = new Child(this.tracer)\n return child\n }\n}\n\nclass Child {\n constructor (parentTracer) {\n ",
"sections": [
"intro",
"installation",
"usage / instrumentation",
"methods"
],
"hasApi": false,
"hasExamples": true,
"exampleCount": 4,
"examples": [
"$ npm i hypertrace",
"Then add `.setTraceFunction()` when traces are needed. It's important that this happens **before** classes that use Hypertrace are instantiated. Otherwise the tracer will not be enabled for those objects.\n\n`app.js`",
"## Methods\n\n### createTracer(context, { parent, props })\n\nCreate a new Hypertrace instance inside a class. Often used in the `constructor`.\n\n_If_ this is called before `setTraceFunction` then it will return a cummy class. This means that there will be close to zero overhead when tracing is not needed.\n\n- **props**: (optional) Some properties that are passed along to the trace function\n- **parent**: (optional) A parent hypertrace instance to allow deeper understanding of structure. This is pased to the trace function."
]
},
"patterns": []
}