@zharp/node 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Zharp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,123 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @zharp/node
2
+
3
+ Application Monitoring for Node.js, for [Zharp](https://zharp.io): traces of every request your server handles and makes, its logs, and its errors — joined to the browser session and user that caused them.
4
+
5
+ It is the official [OpenTelemetry Node SDK](https://opentelemetry.io/docs/languages/js/) and its auto-instrumentations, configured for Zharp. Every span comes from OpenTelemetry's instrumentation of `http`, Express, Fastify, Koa, NestJS, pg, mysql, mongodb, redis, undici/fetch, gRPC, GraphQL, AWS SDK and the rest; this package adds the configuration, the user and session on every record, a console bridge, error capture and a small API.
6
+
7
+ Requires Node 22.15 or later (as OpenTelemetry does).
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install @zharp/node
13
+ ```
14
+
15
+ Create `instrument.js`:
16
+
17
+ ```javascript
18
+ import { Zharp } from '@zharp/node';
19
+
20
+ Zharp.init({
21
+ key: process.env.ZHARP_KEY, // the app key from the dashboard
22
+ service: 'checkout-api',
23
+ environment: 'production',
24
+ release: process.env.GIT_SHA, // optional
25
+ });
26
+ ```
27
+
28
+ and load it before your application:
29
+
30
+ ```bash
31
+ node --import ./instrument.js server.js
32
+ ```
33
+
34
+ ```
35
+ [Zharp] Application monitoring active — service "checkout-api", environment "production"
36
+ ```
37
+
38
+ Loading it first is what makes it work: the instrumentations patch `http`, your framework and your database driver as they are first imported, so `init()` has to run before any of them are. With CommonJS, `node --require ./instrument.js server.js` does the same.
39
+
40
+ With nothing but environment variables: `ZHARP_API_KEY=… ZHARP_SERVICE=checkout-api node --import @zharp/node/init server.js` (also `ZHARP_ENV`, `ZHARP_RELEASE`, `ZHARP_ENDPOINT`; `ZHARP_DISABLED=true` turns it off).
41
+
42
+ ### Next.js
43
+
44
+ `instrumentation.ts` in the project root (or `src/`):
45
+
46
+ ```typescript
47
+ export async function register() {
48
+ if (process.env.NEXT_RUNTIME === 'nodejs') {
49
+ const { Zharp } = await import('@zharp/node');
50
+ Zharp.init({ key: process.env.ZHARP_KEY!, service: 'checkout-web-server', environment: process.env.NODE_ENV });
51
+ }
52
+ }
53
+ ```
54
+
55
+ The Edge runtime is not supported. If the build complains about OpenTelemetry modules, add `serverExternalPackages: ['@zharp/node']` to `next.config`.
56
+
57
+ ## What is captured
58
+
59
+ | | |
60
+ |---|---|
61
+ | **Requests** | A SERVER span per incoming request (`http.request.method`, `http.route` where the framework knows it, `http.response.status_code`; 5xx are errors), CLIENT spans for outgoing HTTP, and spans for database and cache calls. `dns`, `net` and `fs` are off — one span per lookup or file read is noise. |
62
+ | **Traces from the browser** | The `traceparent` header continues the browser's trace; `session.id` and `enduser.id` from the `baggage` header are copied onto every span and log of that request. |
63
+ | **Logs** | `Zharp.log.*`, `console.*` (default on), and pino, winston and bunyan through OpenTelemetry's log bridges — each with the trace and span it was written in. |
64
+ | **Errors** | `Zharp.captureError(err)` (handled), uncaught exceptions and unhandled rejections (unhandled). Sent as error logs with `exception.type`, `exception.message` and `exception.stacktrace`, grouped into issues. |
65
+
66
+ ### Uncaught exceptions
67
+
68
+ Listening for `uncaughtException` / `unhandledRejection` stops Node from exiting, so when Zharp's listener is the only one it does what Node would have: prints the error to stderr and exits with code 1 — after the error has been sent (at most 2 seconds). If your application has its own listeners, they decide what happens and Zharp only reports. `--unhandled-rejections=warn|none|warn-with-error-code` are respected.
69
+
70
+ ### Exit
71
+
72
+ What is waiting is sent when the event loop empties, and on SIGTERM/SIGINT (after which the signal is raised again if nothing else is listening for it). In serverless functions, `await Zharp.flush()` before returning.
73
+
74
+ ### Logs only
75
+
76
+ ```typescript
77
+ Zharp.init({ tracing: false }); // or ZHARP_TRACING=false
78
+ ```
79
+
80
+ Logs (`Zharp.log.*`, the console, pino, winston, bunyan), errors (with `exception.*` and the handled flag), the user, the session and tags are sent as usual. No spans are exported, nothing is instrumented except the log bridges and the incoming side of `http`, and no `traceparent` or `baggage` is added to outgoing requests. An incoming `traceparent` and `baggage` are still read, so a request's logs carry the caller's trace id, session and user (and `setUser()` inside a request stays with that request) — at the cost of one never-exported in-memory span per request. `Zharp.startSpan(name, fn)` just runs `fn`.
81
+
82
+ ## API
83
+
84
+ | | |
85
+ |---|---|
86
+ | `Zharp.init(options)` | Start. Once per process; a second call is ignored with a warning. |
87
+ | `Zharp.setUser({ id, email?, name? })` | Inside a request: `enduser.id` (email, name) on every span and log of that request from here on, and on the request's span. Outside one: on everything the process sends — for a script or worker. Requests from `@zharp/browser` already carry the user. |
88
+ | `Zharp.clearUser()` | |
89
+ | `Zharp.setTag(key, value)` | An attribute on every span and log from now on. |
90
+ | `Zharp.captureError(err, attrs?)` | |
91
+ | `Zharp.log.<level>(message, attrs?)` | `trace`, `debug`, `info`, `warn`, `error`, `fatal`. An `Error` among the attributes of an error log is sent as its exception. |
92
+ | `Zharp.startSpan(name, fn, options?)` | Run `fn` in a span, ending when it returns or its promise settles. |
93
+ | `Zharp.flush(timeoutMs?)` | Send everything waiting. |
94
+ | `Zharp.shutdown()` | Flush and stop. |
95
+
96
+ Everything else is plain OpenTelemetry: `trace.getActiveSpan()`, `trace.getTracer('my-lib')` and the rest of `@opentelemetry/api` work as usual.
97
+
98
+ ## Options
99
+
100
+ | Option | Default | |
101
+ |---|---|---|
102
+ | `key` | `ZHARP_API_KEY` | The app key (`zpk_…`) or a workspace API key with ingest scope. |
103
+ | `service` | `ZHARP_SERVICE`, `OTEL_SERVICE_NAME`, package.json name | `service.name` |
104
+ | `environment` | `ZHARP_ENV`, `NODE_ENV` | `deployment.environment.name` |
105
+ | `release` | `ZHARP_RELEASE` | `service.version` |
106
+ | `endpoint` | `https://api.zharp.io/api/v1/otlp` | |
107
+ | `tracing` | `ZHARP_TRACING`, else `true` | `false` for logs only (see above). |
108
+ | `sampleRate` | `1` | Fraction of new traces kept. A trace that arrives with a decision (from the browser) keeps it. Errors and logs are always sent. |
109
+ | `captureConsole` | `true` | |
110
+ | `captureUncaught` | `true` | |
111
+ | `instrumentations` | | Per-instrumentation config for `getNodeAutoInstrumentations`, e.g. `{ '@opentelemetry/instrumentation-fs': { enabled: true } }`. |
112
+ | `extraInstrumentations` | `[]` | More OpenTelemetry instrumentations. |
113
+ | `debug` | `false` | Print what OpenTelemetry is doing. |
114
+
115
+ Traces and logs go as OTLP/protobuf, gzipped, to `{endpoint}/v1/traces` and `/v1/logs` with `Authorization: Bearer <key>`.
116
+
117
+ ## Readable stack traces
118
+
119
+ Bundled or minified server code (a Next.js server build, an esbuild or webpack bundle) becomes original files, lines and code once its source maps are uploaded with a [Zharp bundler plugin](../bundler-plugins/README.md) or [`@zharp/cli`](../cli/README.md). Every error this SDK sends — `captureError`, error logs with an error, uncaught errors, exceptions recorded on spans by the instrumentations, and error logs from pino and winston — carries the debug IDs of the bundled files in its stack as `zharp.debug_ids`. Nothing to configure here.
120
+
121
+ ## License
122
+
123
+ MIT
@@ -0,0 +1,157 @@
1
+ import { Span, SpanOptions } from '@opentelemetry/api';
2
+ import { InstrumentationConfigMap } from '@opentelemetry/auto-instrumentations-node';
3
+ import { Instrumentation } from '@opentelemetry/instrumentation';
4
+
5
+ /** OTLP severity numbers. */
6
+ declare const SEVERITY: {
7
+ readonly trace: 1;
8
+ readonly debug: 5;
9
+ readonly info: 9;
10
+ readonly warn: 13;
11
+ readonly error: 17;
12
+ readonly fatal: 21;
13
+ };
14
+ type Level = keyof typeof SEVERITY;
15
+
16
+ /** A value an attribute can hold. Objects and arrays are sent as they are and shown as JSON. */
17
+ type AttributeValue = string | number | boolean | null | undefined | AttributeValue[] | {
18
+ [key: string]: AttributeValue;
19
+ };
20
+ type Attributes = Record<string, unknown>;
21
+ interface ZharpUser {
22
+ /** Sent as `enduser.id`. An ID or an email — whatever identifies the person in your app. */
23
+ id: string | number;
24
+ /** Sent as `enduser.email`. */
25
+ email?: string;
26
+ /** Sent as `enduser.name`. */
27
+ name?: string;
28
+ }
29
+ interface NodeOptions {
30
+ /**
31
+ * The app's key from the Zharp dashboard (`zpk_…`), or a workspace API key with the ingest
32
+ * scope. Falls back to `ZHARP_API_KEY`. Without one, `init()` starts nothing and says so.
33
+ */
34
+ key?: string;
35
+ /** `service.name`. Falls back to `ZHARP_SERVICE`, `OTEL_SERVICE_NAME`, then package.json's name. */
36
+ service?: string;
37
+ /** `deployment.environment.name`. Falls back to `ZHARP_ENV`, then `NODE_ENV`. */
38
+ environment?: string;
39
+ /** `service.version`, e.g. `api@2.3.0` or a commit SHA. Falls back to `ZHARP_RELEASE`. */
40
+ release?: string;
41
+ /** Default `https://api.zharp.io/api/v1/otlp`. Falls back to `ZHARP_ENDPOINT`. */
42
+ endpoint?: string;
43
+ /**
44
+ * Fraction of traces to keep, 0 to 1. Default 1. A trace that arrives with a decision from
45
+ * the caller (the browser SDK's `traceparent`) keeps that decision. Errors and logs are always
46
+ * sent.
47
+ */
48
+ sampleRate?: number;
49
+ /**
50
+ * Traces. Default **true**. `false` is logs only: logs, errors, user, session and tags are
51
+ * sent as usual, but no spans are exported, no http/database/framework instrumentation is
52
+ * installed, and no `traceparent` or `baggage` is added to outgoing requests. An incoming
53
+ * `traceparent` is still read, so the logs of a request carry the caller's trace id.
54
+ * `startSpan` just runs its callback. Falls back to `ZHARP_TRACING` (`false` turns it off).
55
+ */
56
+ tracing?: boolean;
57
+ /**
58
+ * Send `console.*` output as logs. Default **true**: on a server, the console is where most
59
+ * logging already goes. pino, winston and bunyan are bridged by their instrumentations
60
+ * whatever this says.
61
+ */
62
+ captureConsole?: boolean;
63
+ /**
64
+ * Capture uncaught exceptions and unhandled rejections. Default true. The process still
65
+ * exits as Node would have, once they have been sent.
66
+ */
67
+ captureUncaught?: boolean;
68
+ /**
69
+ * Per-instrumentation settings, passed to `getNodeAutoInstrumentations`. `dns`, `net` and
70
+ * `fs` are off by default (a span per lookup, socket or file read is noise); turn one back on
71
+ * with `{ '@opentelemetry/instrumentation-dns': { enabled: true } }`.
72
+ */
73
+ instrumentations?: InstrumentationConfigMap;
74
+ /** More instrumentations to register alongside the automatic ones. */
75
+ extraInstrumentations?: Instrumentation[];
76
+ /** Print what the SDK and OpenTelemetry are doing. Default false. */
77
+ debug?: boolean;
78
+ }
79
+
80
+ type LogFn = (message: unknown, attributes?: Attributes) => void;
81
+ declare class ZharpNode {
82
+ private sdk;
83
+ private spanProcessors;
84
+ private logProcessors;
85
+ private logger;
86
+ private readonly store;
87
+ private teardowns;
88
+ /** False in logs-only mode (`tracing: false` / `ZHARP_TRACING=false`). */
89
+ private tracing;
90
+ /** Errors already sent, so one that is both rejected and then thrown is reported once. */
91
+ private readonly reported;
92
+ /** `Zharp.log.info("Order placed", { orderId })` — and debug, warn, error, fatal, trace. */
93
+ readonly log: Record<Level, LogFn>;
94
+ /** Whether `init()` started the SDK. */
95
+ get isActive(): boolean;
96
+ /**
97
+ * Start sending traces, logs and errors. Call it once, before the application's own modules
98
+ * load — from a file preloaded with `node --import` (see the README) — so that http, the
99
+ * database drivers and the frameworks are instrumented when they are first imported.
100
+ */
101
+ init(options?: NodeOptions): void;
102
+ private start;
103
+ /**
104
+ * The user the current request is for: `enduser.id` (and `enduser.email`, `enduser.name`) on
105
+ * every span and log of the request from here on, and on the request's own span. Outside a
106
+ * request it applies to everything the process sends — for a script or a worker that runs as
107
+ * one user.
108
+ *
109
+ * Requests from a page running @zharp/browser already carry the user in their baggage; this
110
+ * is for servers that know the user themselves.
111
+ */
112
+ setUser(user: ZharpUser | null): void;
113
+ /** Forget the user — for the current request, or the process's when called outside one. */
114
+ clearUser(): void;
115
+ /** An attribute on every span and log sent from now on, e.g. `setTag("region", "eu-west-1")`. */
116
+ setTag(key: string, value: string | number | boolean | null | undefined): void;
117
+ /**
118
+ * Report an error you caught. It is sent as handled, in the trace of the request it happened
119
+ * in, and grouped into an issue with every other occurrence.
120
+ */
121
+ captureError(error: unknown, attributes?: Attributes): void;
122
+ /**
123
+ * Run `fn` inside a span named `name`, which ends when `fn` returns or its promise settles. A
124
+ * throw or rejection marks the span as failed and is passed on unchanged.
125
+ */
126
+ startSpan<T>(name: string, fn: (span: Span) => T, options?: SpanOptions): T;
127
+ /** Send everything waiting now. Await it before a serverless function returns. */
128
+ flush(timeoutMs?: number): Promise<void>;
129
+ /** Flush, stop, and put back everything that was patched. */
130
+ shutdown(): Promise<void>;
131
+ private emit;
132
+ private report;
133
+ /**
134
+ * Uncaught exceptions and unhandled rejections, reported as unhandled.
135
+ *
136
+ * Listening for either changes what Node does — it no longer exits — so when Zharp's listener
137
+ * is the only one, it finishes the job the way Node would have: print the error, then exit
138
+ * with code 1, after the error has been sent. When the application has listeners of its own,
139
+ * they decide, and Zharp only reports.
140
+ */
141
+ private captureProcessErrors;
142
+ private crashing;
143
+ private crash;
144
+ /**
145
+ * Send what is waiting when the process ends on its own (the event loop drains) or is told to
146
+ * stop. A signal listener also replaces Node's default of exiting, so once the flush is done,
147
+ * if no one else is listening, the signal is raised again with Zharp's listener gone.
148
+ */
149
+ private flushOnExit;
150
+ }
151
+
152
+ /** Sent as `telemetry.sdk.version`. Bumped with package.json. */
153
+ declare const VERSION = "0.1.0";
154
+
155
+ declare const Zharp: ZharpNode;
156
+
157
+ export { type AttributeValue, type Attributes, type NodeOptions, VERSION, Zharp, ZharpNode, type ZharpUser, Zharp as default };
@@ -0,0 +1,157 @@
1
+ import { Span, SpanOptions } from '@opentelemetry/api';
2
+ import { InstrumentationConfigMap } from '@opentelemetry/auto-instrumentations-node';
3
+ import { Instrumentation } from '@opentelemetry/instrumentation';
4
+
5
+ /** OTLP severity numbers. */
6
+ declare const SEVERITY: {
7
+ readonly trace: 1;
8
+ readonly debug: 5;
9
+ readonly info: 9;
10
+ readonly warn: 13;
11
+ readonly error: 17;
12
+ readonly fatal: 21;
13
+ };
14
+ type Level = keyof typeof SEVERITY;
15
+
16
+ /** A value an attribute can hold. Objects and arrays are sent as they are and shown as JSON. */
17
+ type AttributeValue = string | number | boolean | null | undefined | AttributeValue[] | {
18
+ [key: string]: AttributeValue;
19
+ };
20
+ type Attributes = Record<string, unknown>;
21
+ interface ZharpUser {
22
+ /** Sent as `enduser.id`. An ID or an email — whatever identifies the person in your app. */
23
+ id: string | number;
24
+ /** Sent as `enduser.email`. */
25
+ email?: string;
26
+ /** Sent as `enduser.name`. */
27
+ name?: string;
28
+ }
29
+ interface NodeOptions {
30
+ /**
31
+ * The app's key from the Zharp dashboard (`zpk_…`), or a workspace API key with the ingest
32
+ * scope. Falls back to `ZHARP_API_KEY`. Without one, `init()` starts nothing and says so.
33
+ */
34
+ key?: string;
35
+ /** `service.name`. Falls back to `ZHARP_SERVICE`, `OTEL_SERVICE_NAME`, then package.json's name. */
36
+ service?: string;
37
+ /** `deployment.environment.name`. Falls back to `ZHARP_ENV`, then `NODE_ENV`. */
38
+ environment?: string;
39
+ /** `service.version`, e.g. `api@2.3.0` or a commit SHA. Falls back to `ZHARP_RELEASE`. */
40
+ release?: string;
41
+ /** Default `https://api.zharp.io/api/v1/otlp`. Falls back to `ZHARP_ENDPOINT`. */
42
+ endpoint?: string;
43
+ /**
44
+ * Fraction of traces to keep, 0 to 1. Default 1. A trace that arrives with a decision from
45
+ * the caller (the browser SDK's `traceparent`) keeps that decision. Errors and logs are always
46
+ * sent.
47
+ */
48
+ sampleRate?: number;
49
+ /**
50
+ * Traces. Default **true**. `false` is logs only: logs, errors, user, session and tags are
51
+ * sent as usual, but no spans are exported, no http/database/framework instrumentation is
52
+ * installed, and no `traceparent` or `baggage` is added to outgoing requests. An incoming
53
+ * `traceparent` is still read, so the logs of a request carry the caller's trace id.
54
+ * `startSpan` just runs its callback. Falls back to `ZHARP_TRACING` (`false` turns it off).
55
+ */
56
+ tracing?: boolean;
57
+ /**
58
+ * Send `console.*` output as logs. Default **true**: on a server, the console is where most
59
+ * logging already goes. pino, winston and bunyan are bridged by their instrumentations
60
+ * whatever this says.
61
+ */
62
+ captureConsole?: boolean;
63
+ /**
64
+ * Capture uncaught exceptions and unhandled rejections. Default true. The process still
65
+ * exits as Node would have, once they have been sent.
66
+ */
67
+ captureUncaught?: boolean;
68
+ /**
69
+ * Per-instrumentation settings, passed to `getNodeAutoInstrumentations`. `dns`, `net` and
70
+ * `fs` are off by default (a span per lookup, socket or file read is noise); turn one back on
71
+ * with `{ '@opentelemetry/instrumentation-dns': { enabled: true } }`.
72
+ */
73
+ instrumentations?: InstrumentationConfigMap;
74
+ /** More instrumentations to register alongside the automatic ones. */
75
+ extraInstrumentations?: Instrumentation[];
76
+ /** Print what the SDK and OpenTelemetry are doing. Default false. */
77
+ debug?: boolean;
78
+ }
79
+
80
+ type LogFn = (message: unknown, attributes?: Attributes) => void;
81
+ declare class ZharpNode {
82
+ private sdk;
83
+ private spanProcessors;
84
+ private logProcessors;
85
+ private logger;
86
+ private readonly store;
87
+ private teardowns;
88
+ /** False in logs-only mode (`tracing: false` / `ZHARP_TRACING=false`). */
89
+ private tracing;
90
+ /** Errors already sent, so one that is both rejected and then thrown is reported once. */
91
+ private readonly reported;
92
+ /** `Zharp.log.info("Order placed", { orderId })` — and debug, warn, error, fatal, trace. */
93
+ readonly log: Record<Level, LogFn>;
94
+ /** Whether `init()` started the SDK. */
95
+ get isActive(): boolean;
96
+ /**
97
+ * Start sending traces, logs and errors. Call it once, before the application's own modules
98
+ * load — from a file preloaded with `node --import` (see the README) — so that http, the
99
+ * database drivers and the frameworks are instrumented when they are first imported.
100
+ */
101
+ init(options?: NodeOptions): void;
102
+ private start;
103
+ /**
104
+ * The user the current request is for: `enduser.id` (and `enduser.email`, `enduser.name`) on
105
+ * every span and log of the request from here on, and on the request's own span. Outside a
106
+ * request it applies to everything the process sends — for a script or a worker that runs as
107
+ * one user.
108
+ *
109
+ * Requests from a page running @zharp/browser already carry the user in their baggage; this
110
+ * is for servers that know the user themselves.
111
+ */
112
+ setUser(user: ZharpUser | null): void;
113
+ /** Forget the user — for the current request, or the process's when called outside one. */
114
+ clearUser(): void;
115
+ /** An attribute on every span and log sent from now on, e.g. `setTag("region", "eu-west-1")`. */
116
+ setTag(key: string, value: string | number | boolean | null | undefined): void;
117
+ /**
118
+ * Report an error you caught. It is sent as handled, in the trace of the request it happened
119
+ * in, and grouped into an issue with every other occurrence.
120
+ */
121
+ captureError(error: unknown, attributes?: Attributes): void;
122
+ /**
123
+ * Run `fn` inside a span named `name`, which ends when `fn` returns or its promise settles. A
124
+ * throw or rejection marks the span as failed and is passed on unchanged.
125
+ */
126
+ startSpan<T>(name: string, fn: (span: Span) => T, options?: SpanOptions): T;
127
+ /** Send everything waiting now. Await it before a serverless function returns. */
128
+ flush(timeoutMs?: number): Promise<void>;
129
+ /** Flush, stop, and put back everything that was patched. */
130
+ shutdown(): Promise<void>;
131
+ private emit;
132
+ private report;
133
+ /**
134
+ * Uncaught exceptions and unhandled rejections, reported as unhandled.
135
+ *
136
+ * Listening for either changes what Node does — it no longer exits — so when Zharp's listener
137
+ * is the only one, it finishes the job the way Node would have: print the error, then exit
138
+ * with code 1, after the error has been sent. When the application has listeners of its own,
139
+ * they decide, and Zharp only reports.
140
+ */
141
+ private captureProcessErrors;
142
+ private crashing;
143
+ private crash;
144
+ /**
145
+ * Send what is waiting when the process ends on its own (the event loop drains) or is told to
146
+ * stop. A signal listener also replaces Node's default of exiting, so once the flush is done,
147
+ * if no one else is listening, the signal is raised again with Zharp's listener gone.
148
+ */
149
+ private flushOnExit;
150
+ }
151
+
152
+ /** Sent as `telemetry.sdk.version`. Bumped with package.json. */
153
+ declare const VERSION = "0.1.0";
154
+
155
+ declare const Zharp: ZharpNode;
156
+
157
+ export { type AttributeValue, type Attributes, type NodeOptions, VERSION, Zharp, ZharpNode, type ZharpUser, Zharp as default };