@loglayer/mixin-datadog-http-metrics 2.0.0 → 2.2.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 +1 -1
- package/dist/index.cjs +48 -27
- package/dist/index.d.cts +2070 -1
- package/dist/index.d.mts +2070 -1
- package/dist/index.mjs +38 -13
- package/package.json +7 -7
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Theo Gravity / [Disaresta](https://disaresta.com)
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6,16 +7,12 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
9
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
19
16
|
}
|
|
20
17
|
return to;
|
|
21
18
|
};
|
|
@@ -23,12 +20,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
23
20
|
value: mod,
|
|
24
21
|
enumerable: true
|
|
25
22
|
}) : target, mod));
|
|
26
|
-
|
|
27
23
|
//#endregion
|
|
28
24
|
let datadog_metrics = require("datadog-metrics");
|
|
29
|
-
datadog_metrics = __toESM(datadog_metrics);
|
|
30
|
-
let loglayer = require("loglayer");
|
|
31
|
-
|
|
25
|
+
datadog_metrics = __toESM(datadog_metrics, 1);
|
|
32
26
|
//#region src/client.ts
|
|
33
27
|
let metricsClient = null;
|
|
34
28
|
/**
|
|
@@ -57,7 +51,42 @@ function isNoOpClient() {
|
|
|
57
51
|
function getMetricsClient() {
|
|
58
52
|
return metricsClient;
|
|
59
53
|
}
|
|
60
|
-
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region ../../core/plugin/dist/index.js
|
|
56
|
+
/**
|
|
57
|
+
* List of plugin callbacks that can be called by the plugin manager.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#transformloglevel | transformLogLevel Docs}
|
|
60
|
+
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforedataout | onBeforeDataOut Docs}
|
|
61
|
+
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#shouldsendtologger | shouldSendToLogger Docs}
|
|
62
|
+
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onmetadatacalled | onMetadataCalled Docs}
|
|
63
|
+
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#onbeforemessageout | onBeforeMessageOut Docs}
|
|
64
|
+
* @see {@link https://loglayer.dev/plugins/creating-plugins.html#oncontextcalled | onContextCalled Docs}
|
|
65
|
+
*/
|
|
66
|
+
let PluginCallbackType = /* @__PURE__ */ function(PluginCallbackType) {
|
|
67
|
+
PluginCallbackType["transformLogLevel"] = "transformLogLevel";
|
|
68
|
+
PluginCallbackType["onBeforeDataOut"] = "onBeforeDataOut";
|
|
69
|
+
PluginCallbackType["shouldSendToLogger"] = "shouldSendToLogger";
|
|
70
|
+
PluginCallbackType["onMetadataCalled"] = "onMetadataCalled";
|
|
71
|
+
PluginCallbackType["onBeforeMessageOut"] = "onBeforeMessageOut";
|
|
72
|
+
PluginCallbackType["onContextCalled"] = "onContextCalled";
|
|
73
|
+
return PluginCallbackType;
|
|
74
|
+
}({});
|
|
75
|
+
PluginCallbackType.onBeforeDataOut, PluginCallbackType.onMetadataCalled, PluginCallbackType.onBeforeMessageOut, PluginCallbackType.transformLogLevel, PluginCallbackType.shouldSendToLogger, PluginCallbackType.onContextCalled;
|
|
76
|
+
/**
|
|
77
|
+
* The class that the mixin extends
|
|
78
|
+
*/
|
|
79
|
+
let LogLayerMixinAugmentType = /* @__PURE__ */ function(LogLayerMixinAugmentType) {
|
|
80
|
+
/**
|
|
81
|
+
* Mixin extends the LogBuilder prototype
|
|
82
|
+
*/
|
|
83
|
+
LogLayerMixinAugmentType["LogBuilder"] = "LogBuilder";
|
|
84
|
+
/**
|
|
85
|
+
* Mixin extends the LogLayer prototype
|
|
86
|
+
*/
|
|
87
|
+
LogLayerMixinAugmentType["LogLayer"] = "LogLayer";
|
|
88
|
+
return LogLayerMixinAugmentType;
|
|
89
|
+
}({});
|
|
61
90
|
//#endregion
|
|
62
91
|
//#region src/CommonMetricsBuilder.ts
|
|
63
92
|
/**
|
|
@@ -100,7 +129,6 @@ var CommonMetricsBuilder = class {
|
|
|
100
129
|
return this;
|
|
101
130
|
}
|
|
102
131
|
};
|
|
103
|
-
|
|
104
132
|
//#endregion
|
|
105
133
|
//#region src/builders/DistributionBuilder.ts
|
|
106
134
|
/**
|
|
@@ -131,7 +159,6 @@ var DistributionBuilder = class extends CommonMetricsBuilder {
|
|
|
131
159
|
this.client.distribution(this.key, this.value, this.tags, this.timestamp);
|
|
132
160
|
}
|
|
133
161
|
};
|
|
134
|
-
|
|
135
162
|
//#endregion
|
|
136
163
|
//#region src/builders/GaugeBuilder.ts
|
|
137
164
|
/**
|
|
@@ -162,7 +189,6 @@ var GaugeBuilder = class extends CommonMetricsBuilder {
|
|
|
162
189
|
this.client.gauge(this.key, this.value, this.tags, this.timestamp);
|
|
163
190
|
}
|
|
164
191
|
};
|
|
165
|
-
|
|
166
192
|
//#endregion
|
|
167
193
|
//#region src/builders/HistogramBuilder.ts
|
|
168
194
|
/**
|
|
@@ -205,7 +231,6 @@ var HistogramBuilder = class extends CommonMetricsBuilder {
|
|
|
205
231
|
this.client.histogram(this.key, this.value, this.tags, this.timestamp, this.histogramOptions);
|
|
206
232
|
}
|
|
207
233
|
};
|
|
208
|
-
|
|
209
234
|
//#endregion
|
|
210
235
|
//#region src/builders/IncrementBuilder.ts
|
|
211
236
|
/**
|
|
@@ -244,7 +269,6 @@ var IncrementBuilder = class extends CommonMetricsBuilder {
|
|
|
244
269
|
this.client.increment(this.key, this.value, this.tags, this.timestamp);
|
|
245
270
|
}
|
|
246
271
|
};
|
|
247
|
-
|
|
248
272
|
//#endregion
|
|
249
273
|
//#region src/MetricsAPI.ts
|
|
250
274
|
/**
|
|
@@ -252,6 +276,7 @@ var IncrementBuilder = class extends CommonMetricsBuilder {
|
|
|
252
276
|
* Provides a fluent interface for sending metrics to Datadog via HTTP.
|
|
253
277
|
*/
|
|
254
278
|
var MetricsAPI = class {
|
|
279
|
+
client;
|
|
255
280
|
/**
|
|
256
281
|
* Creates a new MetricsAPI instance.
|
|
257
282
|
*
|
|
@@ -335,7 +360,6 @@ var MetricsAPI = class {
|
|
|
335
360
|
return this.client;
|
|
336
361
|
}
|
|
337
362
|
};
|
|
338
|
-
|
|
339
363
|
//#endregion
|
|
340
364
|
//#region src/MockMetricsAPI.ts
|
|
341
365
|
/**
|
|
@@ -431,7 +455,6 @@ var MockMetricsAPI = class {
|
|
|
431
455
|
};
|
|
432
456
|
}
|
|
433
457
|
};
|
|
434
|
-
|
|
435
458
|
//#endregion
|
|
436
459
|
//#region src/LogLayer.augment.ts
|
|
437
460
|
/**
|
|
@@ -439,7 +462,7 @@ var MockMetricsAPI = class {
|
|
|
439
462
|
* Provides access to the MetricsAPI for sending metrics to Datadog via HTTP.
|
|
440
463
|
*/
|
|
441
464
|
const logLayerDatadogMetricsMixin = {
|
|
442
|
-
augmentationType:
|
|
465
|
+
augmentationType: LogLayerMixinAugmentType.LogLayer,
|
|
443
466
|
augment: (prototype) => {
|
|
444
467
|
Object.defineProperty(prototype, "ddStats", {
|
|
445
468
|
get() {
|
|
@@ -467,7 +490,6 @@ const logLayerDatadogMetricsMixin = {
|
|
|
467
490
|
});
|
|
468
491
|
}
|
|
469
492
|
};
|
|
470
|
-
|
|
471
493
|
//#endregion
|
|
472
494
|
//#region src/index.ts
|
|
473
495
|
const BufferedMetricsLogger = datadog_metrics.default.BufferedMetricsLogger;
|
|
@@ -516,11 +538,10 @@ function datadogMetricsMixin(options) {
|
|
|
516
538
|
pluginsToAdd: []
|
|
517
539
|
};
|
|
518
540
|
}
|
|
519
|
-
|
|
520
541
|
//#endregion
|
|
521
542
|
exports.BufferedMetricsLogger = BufferedMetricsLogger;
|
|
522
543
|
exports.DatadogReporter = DatadogReporter;
|
|
523
544
|
exports.MetricsAPI = MetricsAPI;
|
|
524
545
|
exports.MockMetricsAPI = MockMetricsAPI;
|
|
525
546
|
exports.NullReporter = NullReporter;
|
|
526
|
-
exports.datadogMetricsMixin = datadogMetricsMixin;
|
|
547
|
+
exports.datadogMetricsMixin = datadogMetricsMixin;
|