@alex-michaud/pino-graylog-transport 1.0.2 → 1.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/README.md +6 -6
- package/dist/graylog-transport.d.ts +4 -4
- package/dist/graylog-transport.js +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -425,15 +425,15 @@ The GELF formatting logic is optimized for speed. Benchmarks were run using [mit
|
|
|
425
425
|
|
|
426
426
|
| Benchmark | Time | Description |
|
|
427
427
|
|-----------|------|-------------|
|
|
428
|
-
| JSON.stringify (Raw) |
|
|
429
|
-
| **pino-graylog-transport** | **1.
|
|
430
|
-
| Manual GELF Construction |
|
|
428
|
+
| JSON.stringify (Raw) | 615 ns | Baseline - just serialization, no transformation |
|
|
429
|
+
| **pino-graylog-transport** | **1.29 µs** | Our GELF formatter |
|
|
430
|
+
| Manual GELF Construction | 1.88 µs | Simulated naive implementation |
|
|
431
431
|
|
|
432
432
|
### Key Takeaways
|
|
433
433
|
|
|
434
|
-
- ✅ **
|
|
435
|
-
- ✅ **~
|
|
436
|
-
- ✅ **Negligible overhead**: The ~
|
|
434
|
+
- ✅ **31% faster** than a naive manual GELF construction approach
|
|
435
|
+
- ✅ **~775,000 messages/second** theoretical formatting throughput (single-threaded)
|
|
436
|
+
- ✅ **Negligible overhead**: The ~0.67 µs formatting overhead is 1000-100,000x smaller than typical network latency
|
|
437
437
|
|
|
438
438
|
### Run Benchmarks
|
|
439
439
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Writable } from 'node:stream';
|
|
2
|
-
export type
|
|
2
|
+
export type PinoGraylogTransportOptions = {
|
|
3
3
|
host?: string;
|
|
4
4
|
port?: number;
|
|
5
5
|
protocol?: 'tcp' | 'tls' | 'udp';
|
|
@@ -16,7 +16,7 @@ export type GraylogTransportOpts = {
|
|
|
16
16
|
/**
|
|
17
17
|
* A Writable stream that sends logs to Graylog and exposes status methods.
|
|
18
18
|
*/
|
|
19
|
-
export declare class
|
|
19
|
+
export declare class PinoGraylogTransport extends Writable {
|
|
20
20
|
private socket;
|
|
21
21
|
private udpClient;
|
|
22
22
|
private connectionPromise;
|
|
@@ -33,7 +33,7 @@ export declare class GraylogWritable extends Writable {
|
|
|
33
33
|
private readonly waitForDrain;
|
|
34
34
|
private readonly handleError;
|
|
35
35
|
private readonly onReady?;
|
|
36
|
-
constructor(opts:
|
|
36
|
+
constructor(opts: PinoGraylogTransportOptions);
|
|
37
37
|
isReady(): boolean;
|
|
38
38
|
getQueueSize(): number;
|
|
39
39
|
isConnected(): boolean;
|
|
@@ -52,4 +52,4 @@ export declare class GraylogWritable extends Writable {
|
|
|
52
52
|
* @param opts Options for configuring the Graylog transport.
|
|
53
53
|
* @returns A GraylogWritable stream compatible with Pino's transport interface.
|
|
54
54
|
*/
|
|
55
|
-
export default function graylogTransport(opts?:
|
|
55
|
+
export default function graylogTransport(opts?: PinoGraylogTransportOptions): PinoGraylogTransport;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.PinoGraylogTransport = void 0;
|
|
7
7
|
exports.default = graylogTransport;
|
|
8
8
|
const node_os_1 = __importDefault(require("node:os"));
|
|
9
9
|
const node_stream_1 = require("node:stream");
|
|
@@ -14,7 +14,7 @@ const udp_client_1 = require("./udp-client");
|
|
|
14
14
|
/**
|
|
15
15
|
* A Writable stream that sends logs to Graylog and exposes status methods.
|
|
16
16
|
*/
|
|
17
|
-
class
|
|
17
|
+
class PinoGraylogTransport extends node_stream_1.Writable {
|
|
18
18
|
constructor(opts) {
|
|
19
19
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
20
20
|
super({ objectMode: true });
|
|
@@ -204,7 +204,7 @@ class GraylogWritable extends node_stream_1.Writable {
|
|
|
204
204
|
return this.connectionPromise;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
exports.
|
|
207
|
+
exports.PinoGraylogTransport = PinoGraylogTransport;
|
|
208
208
|
/**
|
|
209
209
|
* Factory function for creating a GraylogWritable transport.
|
|
210
210
|
*
|
|
@@ -212,5 +212,5 @@ exports.GraylogWritable = GraylogWritable;
|
|
|
212
212
|
* @returns A GraylogWritable stream compatible with Pino's transport interface.
|
|
213
213
|
*/
|
|
214
214
|
function graylogTransport(opts = {}) {
|
|
215
|
-
return new
|
|
215
|
+
return new PinoGraylogTransport(opts);
|
|
216
216
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import graylogTransport, {
|
|
2
|
-
export {
|
|
1
|
+
import graylogTransport, { PinoGraylogTransport, PinoGraylogTransportOptions } from './graylog-transport';
|
|
2
|
+
export { PinoGraylogTransport, PinoGraylogTransportOptions };
|
|
3
3
|
export default graylogTransport;
|
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.PinoGraylogTransport = void 0;
|
|
37
37
|
const graylog_transport_1 = __importStar(require("./graylog-transport"));
|
|
38
|
-
Object.defineProperty(exports, "
|
|
38
|
+
Object.defineProperty(exports, "PinoGraylogTransport", { enumerable: true, get: function () { return graylog_transport_1.PinoGraylogTransport; } });
|
|
39
39
|
exports.default = graylog_transport_1.default;
|