@n4zen/perfkit-core
v2.0.1
Published
Core performance session engine for PerfKit.
Readme
@n4zen/perfkit-core
Core performance session engine for PerfKit.
This package contains the dependency-light engine used by PerfKit to record spans, events, samples, aggregates, budgets, top offenders, and structured JSON session exports.
Most React Native users should install this together with:
npm install @n4zen/perfkit-core @n4zen/perfkit-react-nativeFeatures
- Session lifecycle
- Span recording
- Event recording
- Sample recording
- Percentile summaries
- Top offender detection
- Budget evaluation
- Structured JSON export
- No React Native dependency
Installation
npm install @n4zen/perfkit-coreBasic Usage
import { Perf } from "@n4zen/perfkit-core"
Perf.init({
enabled: true,
app: {
name: "My App",
},
})
const span = Perf.startSpan("expensive.task")
// do work...
span.end({
status: "ok",
})
Perf.sample("custom.metric.ms", 123, "ms")
const session = Perf.exportSession()
console.log(JSON.stringify(session, null, 2))Used By
| Package | Purpose |
| ----------------------------- | ---------------------------- |
| @n4zen/perfkit-react-native | React Native instrumentation |
| @n4zen/perfkit-hud | In-app HUD |
React Native Compatibility
The core package is framework-agnostic. For React Native compatibility, use the matching @n4zen/perfkit-react-native version:
| PerfKit Version | React Native Support |
| --------------- | -------------------- |
| 1.x | RN ≤ 0.69 |
| 2.x | RN ≥ 0.70 |
License
MIT
