This page lists every supported export of @pharn-dev/phargus, one section per exports subpath.
Anything not listed on this page is internal: it can change or disappear in any release, including
a patch release. That covers files you could reach by a deep path such as
@pharn-dev/phargus/dist/esm/agent/http-tracing.js too.
npm run check:exports enforces the runtime lists below: it loads each subpath through import and
require and fails when the loaded names differ from the expected list, in either direction. The
type lists are not runtime exports and are checked by reading the declaration files.
Importing this subpath also starts the agent (it reads PHARGUS_* variables and writes NDJSON to
the configured output). The functions below are the library API for code that wants the pieces
without relying on the auto-start.
Runtime exports
ANONYMOUS_FUNCTION— the function name the deopt parser reports for an unnamed functionDEFAULT_ALLOCATION_SAMPLING_DURATION_MS— default length of one allocation sampling runDEFAULT_ALLOCATION_SAMPLING_INTERVAL— default allocation sampling interval, in bytesDEFAULT_ALLOCATION_SITE_LIMIT— default number of allocation sites returnedDEPENDENT_CODE_KIND— the deopt event kind reported for dependent-code deoptimizationsPhargusConfigError— thrown for an invalid agent configuration valuePhargusPermissionError— thrown when the Node permission model denies something the agent needsSPAN_RECORD_TYPE— thetypevalue of a span line in the NDJSON streamassertPermission— throwsPhargusPermissionErrorunless a permission scope is grantedcheckPermission— reports whether a permission scope is grantedcreateBackpressureProbe— creates the stream backpressure probecreateDeoptParser— creates a parser for--trace-deoptoutputcreateEventLoopSampler— creates the event loop delay samplercreateGcSampler— creates the garbage collection samplercreateNdjsonExporter— creates an exporter that writes records as NDJSON with backpressurecreateSamplerController— creates the controller that runs all samplers on an intervalcurrentTraceId— returns the trace id of the current async context, if anydefaultAgentConfig— the agent configuration used when nothing is setisPermissionModelEnabled— reports whether the process runs with the permission modelloadAgentConfig— builds the agent configuration from the environmentrunWithTrace— runs a function inside a given trace idsampleAllocations— takes an allocation profile and returns the top allocation sitessampleHeapSpaces— samplesv8.getHeapSpaceStatistics()sampleMemory— samples process memory usagetakeHeapSnapshot— writes a heap snapshot to disk on demand
Types
AgentConfig— the validated agent configurationAgentLossCounters— counters for samples and spans the agent droppedAgentSample— one combined sampler readingAgentSampleLine— the NDJSON line shape for a sampleAllocationSamplingOptions— options forsampleAllocationsAllocationSite— one allocation site in an allocation profileBackpressureHotspot— one stream with recorded backpressure stallsBackpressureProbe— the backpressure probeBackpressureProbeOptions— options forcreateBackpressureProbeBackpressureSample— one backpressure readingDeoptEvent— one parsed deoptimization eventDeoptLocation— a source location in a deoptimization eventDeoptParser— the deopt output parserDeoptParserOptions— options forcreateDeoptParserEventLoopSample— one event loop delay readingEventLoopSampler— the event loop samplerEventLoopSamplerOptions— options forcreateEventLoopSamplerGcSample— one garbage collection readingGcSampler— the garbage collection samplerHeapSnapshotOptions— options fortakeHeapSnapshotHeapSnapshotResult— the result oftakeHeapSnapshotHeapSpaceEntry— one V8 heap space readingHeapSpaceSample— all heap spaces at one momentLoadAgentConfigOptions— options forloadAgentConfigMemorySample— one memory readingNdjsonExporter— the NDJSON exporterNdjsonExporterOptions— options forcreateNdjsonExporterPermissionCheck— the result ofcheckPermissionPermissionScope— a permission-model scope nameSamplerController— the sampler controllerSpanRecord— a trace span as it appears in the NDJSON streamTraceSpan— a finished HTTP request span
Runtime exports
DEFAULT_MAX_LINE_BYTES— default longest NDJSON line the decoder acceptsDEFAULT_SPAN_CAPACITY— default number of spans the collector keepscreateAlertEvaluator— creates a transform that turns windows into alertscreateCollector— creates the collector that aggregates samples into windows and keeps spanscreateFileSink— creates an alert sink that appends to a filecreateNdjsonDecoder— creates a transform that splits a byte stream into NDJSON recordscreateRingBuffer— creates a fixed-size buffer that drops the oldest item when fullcreateSinks— builds alert sinks from sink configurationscreateStdoutSink— creates an alert sink that writes to stdoutcreateWebhookSink— creates an alert sink that posts to a URLcreateWindowStore— creates the in-memory window store, with optional disk persistencevalidateAlertRules— checks alert rules and returns them typed
Types
AggregatedWindow— one aggregated time windowAlert— an alert raised by a ruleAlertComparison— the comparison an alert rule appliesAlertMetric— a metric an alert rule can watchAlertRule— an alert ruleAlertSink— a destination for alertsAlertState— whether an alert is firing or resolvedCollector— the collectorCollectorListener— a callback for collector eventsCollectorOptions— options forcreateCollectorFileSinkOptions— options forcreateFileSinkIgnoredReason— why the collector ignored a recordIgnoredRecordHandler— a callback for ignored recordsNdjsonDecoder— the NDJSON decoderNdjsonDecoderOptions— options forcreateNdjsonDecoderNdjsonSkip— a line the decoder skipped, with the reasonPersistOptions— options for disk persistence of windowsRingBuffer— the ring bufferSinkConfig— a sink configuration objectSinkErrorHandler— a callback for sink errorsSinkInput— a sink configuration or a ready sinkSpanRecord— a trace span record, re-exported from the agentStdoutSinkOptions— options forcreateStdoutSinkWebhookSinkOptions— options forcreateWebhookSinkWindowPersistence— the persistence hook the collector writes windows throughWindowStore— the window store
Runtime exports
DEFAULT_MAX_SNAPSHOT_BYTES— default largest heap snapshot the analyzer readsDEFAULT_MAX_SOURCE_FILE_BYTES— default largest source or source map file the symbolizer readsDEFAULT_RESOURCE_LIMITS— default memory limits for worker threadsHeapSnapshotTooLargeError— thrown when a heap snapshot exceeds the size limitMalformedSourceMapError— thrown when a source map cannot be parsedWorkerCrashedError— a worker thread exited while running a taskWorkerPoolClosedError— a task was submitted to a closed poolWorkerQueueFullError— the pool queue is fullWorkerTaskError— a task threw inside the workerWorkerTaskTimeoutError— a task ran longer than its timeoutcreateHeapSnapshotPool— creates a worker pool for heap snapshot workcreateSymbolizationPool— creates a worker pool for stack-trace symbolizationcreateWorkerPool— creates a general worker thread pooldiffHeapSnapshots— compares two heap snapshot summariesheapSnapshotTimeoutMs— the default heap snapshot analysis timeout for a file of a given sizesummarizeHeapSnapshot— summarizes a heap snapshot file by constructor typesymbolizeStackFrames— maps stack frames back to original source positions
Types
HeapSnapshotDiff— the difference between two snapshot summariesHeapSnapshotDiffEntry— one row of a snapshot diffHeapSnapshotSummary— a snapshot summaryHeapSnapshotTypeStats— counts and sizes for one type in a summaryOriginalPosition— a position in the original sourceStackFrame— a stack frame to symbolizeSymbolizedFrame— a stack frame with its original positionWorkerPool— the worker poolWorkerPoolOptions— options forcreateWorkerPool
Runtime exports
createDashboardServer— creates the HTTP server that serves the dashboard and its SSE streamisLoopbackHost— true forlocalhost,::1and127.0.0.0/8
Types
DashboardServer— the dashboard serverDashboardServerOptions— options forcreateDashboardServer
Runtime exports
BuiltinRuleId— the ids of the built-in rulesRuleErrorCode— the error codes a rule run can reportRuleParameterError— thrown for an invalid rule parametercreatePluginRunner— creates the sandboxed rule runnereventLoopLagRule— the built-in event loop lag rulegcPauseShareRule— the built-in GC pause share ruleheapGrowthRule— the built-in heap growth ruleloadRulesDirectory— loads rule files from a directoryrunRules— runs a set of rules over aggregated windows
Types
EventLoopLagParams— parameters of the event loop lag ruleGcPauseShareParams— parameters of the GC pause share ruleHeapGrowthParams— parameters of the heap growth rulePluginRunner— the rule runnerPluginRunnerOptions— options forcreatePluginRunnerRuleDescriptor— the description of a ruleRuleErrorCodeValue— one value ofRuleErrorCodeRuleFinding— a finding a rule producedRuleLoadFailure— a rule file that failed to loadRuleResults— the results ofrunRulesRuleRunResult— the result of one ruleRulesDirectoryResult— the result ofloadRulesDirectory
Runtime exports
AGGREGATION_TEMPORALITY_DELTA— the OTLP delta aggregation temporality valueSPAN_KIND_SERVER— the OTLP server span kind valueSTATUS_CODE_ERROR— the OTLP error status code valueSTATUS_CODE_UNSET— the OTLP unset status code valuecreateOtlpMetricsExporter— creates an OTLP/HTTP JSON exporter for collector windowscreateOtlpTraceExporter— creates an OTLP/HTTP JSON exporter for spanstoOtlpMetrics— converts windows to an OTLP metrics request bodytoOtlpTraces— converts spans to an OTLP traces request body
Types
OtlpExporterOptions— options shared by both exportersOtlpMetric— one OTLP metricOtlpMetricsExporter— the metrics exporterOtlpMetricsExporterOptions— options forcreateOtlpMetricsExporterOtlpMetricsRequest— an OTLP metrics request bodyOtlpNumberDataPoint— one OTLP number data pointOtlpSpan— one OTLP spanOtlpTraceExporter— the trace exporterOtlpTraceExporterOptions— options forcreateOtlpTraceExporterOtlpTracesRequest— an OTLP traces request body