@loglayer/transport-new-relic 2.1.6 → 2.1.7
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/dist/index.cjs +247 -225
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -83
- package/dist/index.d.ts +91 -83
- package/dist/index.js +223 -225
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LogLayerTransportParams, LoggerlessTransport, LoggerlessTransportConfig } from "@loglayer/transport";
|
|
2
|
+
|
|
3
|
+
//#region src/NewRelicTransport.d.ts
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Configuration options for the New Relic transport.
|
|
5
7
|
*/
|
|
6
8
|
interface NewRelicTransportConfig extends LoggerlessTransportConfig {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The New Relic API key
|
|
11
|
+
*/
|
|
12
|
+
apiKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* The New Relic Log API endpoint
|
|
15
|
+
* @default https://log-api.newrelic.com/log/v1
|
|
16
|
+
*/
|
|
17
|
+
endpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional callback for error handling
|
|
20
|
+
*/
|
|
21
|
+
onError?: (err: Error) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Optional callback for debugging log entries before they are sent
|
|
24
|
+
*/
|
|
25
|
+
onDebug?: (entry: Record<string, any>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to use gzip compression
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
useCompression?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Number of retry attempts before giving up
|
|
33
|
+
* @default 3
|
|
34
|
+
*/
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Base delay between retries in milliseconds
|
|
38
|
+
* @default 1000
|
|
39
|
+
*/
|
|
40
|
+
retryDelay?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to respect rate limiting by waiting when a 429 response is received
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
respectRateLimit?: boolean;
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* NewRelicTransport is responsible for sending logs to New Relic's Log API.
|
|
@@ -56,49 +58,55 @@ interface NewRelicTransportConfig extends LoggerlessTransportConfig {
|
|
|
56
58
|
* - Implements retry logic with exponential backoff
|
|
57
59
|
*/
|
|
58
60
|
declare class NewRelicTransport extends LoggerlessTransport {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
61
|
+
private apiKey;
|
|
62
|
+
private endpoint;
|
|
63
|
+
private onError?;
|
|
64
|
+
private onDebug?;
|
|
65
|
+
private useCompression;
|
|
66
|
+
private maxRetries;
|
|
67
|
+
private retryDelay;
|
|
68
|
+
private respectRateLimit;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new instance of NewRelicTransport.
|
|
71
|
+
*
|
|
72
|
+
* @param config - Configuration options for the transport
|
|
73
|
+
* @param config.apiKey - New Relic API key for authentication
|
|
74
|
+
* @param config.endpoint - Optional custom endpoint URL (defaults to New Relic's Log API endpoint)
|
|
75
|
+
* @param config.onError - Optional error callback for handling errors
|
|
76
|
+
* @param config.onDebug - Optional callback for debugging log entries before they are sent
|
|
77
|
+
* @param config.useCompression - Whether to use gzip compression (defaults to true)
|
|
78
|
+
* @param config.maxRetries - Maximum number of retry attempts (defaults to 3)
|
|
79
|
+
* @param config.retryDelay - Base delay between retries in milliseconds (defaults to 1000)
|
|
80
|
+
* @param config.respectRateLimit - Whether to honor rate limiting headers (defaults to true)
|
|
81
|
+
*/
|
|
82
|
+
constructor(config: NewRelicTransportConfig);
|
|
83
|
+
/**
|
|
84
|
+
* Processes and ships log entries to New Relic.
|
|
85
|
+
*
|
|
86
|
+
* This method:
|
|
87
|
+
* 1. Validates the message size
|
|
88
|
+
* 2. Creates and validates the log entry
|
|
89
|
+
* 3. Validates the final payload size
|
|
90
|
+
* 4. Asynchronously sends the log entry to New Relic
|
|
91
|
+
*
|
|
92
|
+
* The actual sending is done asynchronously in a fire-and-forget manner to maintain
|
|
93
|
+
* compatibility with the base transport class while still providing retry and error handling.
|
|
94
|
+
*
|
|
95
|
+
* @param params - Log parameters including level, messages, and metadata
|
|
96
|
+
* @param params.logLevel - The severity level of the log
|
|
97
|
+
* @param params.messages - Array of message strings to be joined
|
|
98
|
+
* @param params.data - Optional metadata to include with the log
|
|
99
|
+
* @param params.hasData - Whether metadata is present
|
|
100
|
+
* @returns The original messages array
|
|
101
|
+
* @throws {ValidationError} If the payload exceeds size limits or validation fails
|
|
102
|
+
*/
|
|
103
|
+
shipToLogger({
|
|
104
|
+
logLevel,
|
|
105
|
+
messages,
|
|
106
|
+
data,
|
|
107
|
+
hasData
|
|
108
|
+
}: LogLayerTransportParams): any[];
|
|
102
109
|
}
|
|
103
|
-
|
|
104
|
-
export { NewRelicTransport,
|
|
110
|
+
//#endregion
|
|
111
|
+
export { NewRelicTransport, NewRelicTransportConfig };
|
|
112
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LogLayerTransportParams, LoggerlessTransport, LoggerlessTransportConfig } from "@loglayer/transport";
|
|
2
|
+
|
|
3
|
+
//#region src/NewRelicTransport.d.ts
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Configuration options for the New Relic transport.
|
|
5
7
|
*/
|
|
6
8
|
interface NewRelicTransportConfig extends LoggerlessTransportConfig {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The New Relic API key
|
|
11
|
+
*/
|
|
12
|
+
apiKey: string;
|
|
13
|
+
/**
|
|
14
|
+
* The New Relic Log API endpoint
|
|
15
|
+
* @default https://log-api.newrelic.com/log/v1
|
|
16
|
+
*/
|
|
17
|
+
endpoint?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional callback for error handling
|
|
20
|
+
*/
|
|
21
|
+
onError?: (err: Error) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Optional callback for debugging log entries before they are sent
|
|
24
|
+
*/
|
|
25
|
+
onDebug?: (entry: Record<string, any>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to use gzip compression
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
useCompression?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Number of retry attempts before giving up
|
|
33
|
+
* @default 3
|
|
34
|
+
*/
|
|
35
|
+
maxRetries?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Base delay between retries in milliseconds
|
|
38
|
+
* @default 1000
|
|
39
|
+
*/
|
|
40
|
+
retryDelay?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to respect rate limiting by waiting when a 429 response is received
|
|
43
|
+
* @default true
|
|
44
|
+
*/
|
|
45
|
+
respectRateLimit?: boolean;
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* NewRelicTransport is responsible for sending logs to New Relic's Log API.
|
|
@@ -56,49 +58,55 @@ interface NewRelicTransportConfig extends LoggerlessTransportConfig {
|
|
|
56
58
|
* - Implements retry logic with exponential backoff
|
|
57
59
|
*/
|
|
58
60
|
declare class NewRelicTransport extends LoggerlessTransport {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
61
|
+
private apiKey;
|
|
62
|
+
private endpoint;
|
|
63
|
+
private onError?;
|
|
64
|
+
private onDebug?;
|
|
65
|
+
private useCompression;
|
|
66
|
+
private maxRetries;
|
|
67
|
+
private retryDelay;
|
|
68
|
+
private respectRateLimit;
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new instance of NewRelicTransport.
|
|
71
|
+
*
|
|
72
|
+
* @param config - Configuration options for the transport
|
|
73
|
+
* @param config.apiKey - New Relic API key for authentication
|
|
74
|
+
* @param config.endpoint - Optional custom endpoint URL (defaults to New Relic's Log API endpoint)
|
|
75
|
+
* @param config.onError - Optional error callback for handling errors
|
|
76
|
+
* @param config.onDebug - Optional callback for debugging log entries before they are sent
|
|
77
|
+
* @param config.useCompression - Whether to use gzip compression (defaults to true)
|
|
78
|
+
* @param config.maxRetries - Maximum number of retry attempts (defaults to 3)
|
|
79
|
+
* @param config.retryDelay - Base delay between retries in milliseconds (defaults to 1000)
|
|
80
|
+
* @param config.respectRateLimit - Whether to honor rate limiting headers (defaults to true)
|
|
81
|
+
*/
|
|
82
|
+
constructor(config: NewRelicTransportConfig);
|
|
83
|
+
/**
|
|
84
|
+
* Processes and ships log entries to New Relic.
|
|
85
|
+
*
|
|
86
|
+
* This method:
|
|
87
|
+
* 1. Validates the message size
|
|
88
|
+
* 2. Creates and validates the log entry
|
|
89
|
+
* 3. Validates the final payload size
|
|
90
|
+
* 4. Asynchronously sends the log entry to New Relic
|
|
91
|
+
*
|
|
92
|
+
* The actual sending is done asynchronously in a fire-and-forget manner to maintain
|
|
93
|
+
* compatibility with the base transport class while still providing retry and error handling.
|
|
94
|
+
*
|
|
95
|
+
* @param params - Log parameters including level, messages, and metadata
|
|
96
|
+
* @param params.logLevel - The severity level of the log
|
|
97
|
+
* @param params.messages - Array of message strings to be joined
|
|
98
|
+
* @param params.data - Optional metadata to include with the log
|
|
99
|
+
* @param params.hasData - Whether metadata is present
|
|
100
|
+
* @returns The original messages array
|
|
101
|
+
* @throws {ValidationError} If the payload exceeds size limits or validation fails
|
|
102
|
+
*/
|
|
103
|
+
shipToLogger({
|
|
104
|
+
logLevel,
|
|
105
|
+
messages,
|
|
106
|
+
data,
|
|
107
|
+
hasData
|
|
108
|
+
}: LogLayerTransportParams): any[];
|
|
102
109
|
}
|
|
103
|
-
|
|
104
|
-
export { NewRelicTransport,
|
|
110
|
+
//#endregion
|
|
111
|
+
export { NewRelicTransport, NewRelicTransportConfig };
|
|
112
|
+
//# sourceMappingURL=index.d.ts.map
|