@probelabs/probe 0.6.0-rc136 → 0.6.0-rc137
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/build/agent/fileSpanExporter.js +1 -3
- package/build/agent/index.js +202 -82310
- package/build/agent/telemetry.js +5 -10
- package/cjs/agent/ProbeAgent.cjs +351 -581
- package/cjs/agent/telemetry.cjs +15 -30
- package/cjs/index.cjs +361 -591
- package/package.json +1 -1
- package/src/agent/fileSpanExporter.js +1 -3
- package/src/agent/telemetry.js +5 -10
package/cjs/agent/telemetry.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
|
|
30
20
|
// src/agent/telemetry.js
|
|
@@ -34,19 +24,18 @@ __export(telemetry_exports, {
|
|
|
34
24
|
initializeTelemetryFromOptions: () => initializeTelemetryFromOptions
|
|
35
25
|
});
|
|
36
26
|
module.exports = __toCommonJS(telemetry_exports);
|
|
37
|
-
var import_sdk_node =
|
|
38
|
-
var import_resources =
|
|
27
|
+
var import_sdk_node = require("@opentelemetry/sdk-node");
|
|
28
|
+
var import_resources = require("@opentelemetry/resources");
|
|
39
29
|
var import_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
40
30
|
var import_api = require("@opentelemetry/api");
|
|
41
|
-
var import_exporter_trace_otlp_http =
|
|
42
|
-
var import_sdk_trace_base =
|
|
31
|
+
var import_exporter_trace_otlp_http = require("@opentelemetry/exporter-trace-otlp-http");
|
|
32
|
+
var import_sdk_trace_base = require("@opentelemetry/sdk-trace-base");
|
|
43
33
|
var import_fs2 = require("fs");
|
|
44
34
|
var import_path = require("path");
|
|
45
35
|
|
|
46
36
|
// src/agent/fileSpanExporter.js
|
|
47
37
|
var import_fs = require("fs");
|
|
48
|
-
var import_core =
|
|
49
|
-
var { ExportResultCode } = import_core.default;
|
|
38
|
+
var import_core = require("@opentelemetry/core");
|
|
50
39
|
var FileSpanExporter = class {
|
|
51
40
|
constructor(filePath = "./traces.jsonl") {
|
|
52
41
|
this.filePath = filePath;
|
|
@@ -62,7 +51,7 @@ var FileSpanExporter = class {
|
|
|
62
51
|
*/
|
|
63
52
|
export(spans, resultCallback) {
|
|
64
53
|
if (!spans || spans.length === 0) {
|
|
65
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
54
|
+
resultCallback({ code: import_core.ExportResultCode.SUCCESS });
|
|
66
55
|
return;
|
|
67
56
|
}
|
|
68
57
|
try {
|
|
@@ -113,11 +102,11 @@ var FileSpanExporter = class {
|
|
|
113
102
|
};
|
|
114
103
|
this.stream.write(JSON.stringify(spanData) + "\n");
|
|
115
104
|
});
|
|
116
|
-
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
105
|
+
resultCallback({ code: import_core.ExportResultCode.SUCCESS });
|
|
117
106
|
} catch (error) {
|
|
118
107
|
console.error(`[FileSpanExporter] Export error: ${error.message}`);
|
|
119
108
|
resultCallback({
|
|
120
|
-
code: ExportResultCode.FAILED,
|
|
109
|
+
code: import_core.ExportResultCode.FAILED,
|
|
121
110
|
error
|
|
122
111
|
});
|
|
123
112
|
}
|
|
@@ -188,10 +177,6 @@ var FileSpanExporter = class {
|
|
|
188
177
|
};
|
|
189
178
|
|
|
190
179
|
// src/agent/telemetry.js
|
|
191
|
-
var { NodeSDK } = import_sdk_node.default;
|
|
192
|
-
var { Resource } = import_resources.default;
|
|
193
|
-
var { OTLPTraceExporter } = import_exporter_trace_otlp_http.default;
|
|
194
|
-
var { BatchSpanProcessor, ConsoleSpanExporter } = import_sdk_trace_base.default;
|
|
195
180
|
var TelemetryConfig = class {
|
|
196
181
|
constructor(options = {}) {
|
|
197
182
|
this.serviceName = options.serviceName || "probe-agent";
|
|
@@ -212,7 +197,7 @@ var TelemetryConfig = class {
|
|
|
212
197
|
console.warn("Telemetry already initialized");
|
|
213
198
|
return;
|
|
214
199
|
}
|
|
215
|
-
const resource =
|
|
200
|
+
const resource = (0, import_resources.resourceFromAttributes)({
|
|
216
201
|
[import_semantic_conventions.ATTR_SERVICE_NAME]: this.serviceName,
|
|
217
202
|
[import_semantic_conventions.ATTR_SERVICE_VERSION]: this.serviceVersion
|
|
218
203
|
});
|
|
@@ -224,7 +209,7 @@ var TelemetryConfig = class {
|
|
|
224
209
|
(0, import_fs2.mkdirSync)(dir, { recursive: true });
|
|
225
210
|
}
|
|
226
211
|
const fileExporter = new FileSpanExporter(this.filePath);
|
|
227
|
-
spanProcessors.push(new BatchSpanProcessor(fileExporter, {
|
|
212
|
+
spanProcessors.push(new import_sdk_trace_base.BatchSpanProcessor(fileExporter, {
|
|
228
213
|
maxQueueSize: 2048,
|
|
229
214
|
maxExportBatchSize: 512,
|
|
230
215
|
scheduledDelayMillis: 500,
|
|
@@ -237,10 +222,10 @@ var TelemetryConfig = class {
|
|
|
237
222
|
}
|
|
238
223
|
if (this.enableRemote) {
|
|
239
224
|
try {
|
|
240
|
-
const remoteExporter = new OTLPTraceExporter({
|
|
225
|
+
const remoteExporter = new import_exporter_trace_otlp_http.OTLPTraceExporter({
|
|
241
226
|
url: this.remoteEndpoint
|
|
242
227
|
});
|
|
243
|
-
spanProcessors.push(new BatchSpanProcessor(remoteExporter, {
|
|
228
|
+
spanProcessors.push(new import_sdk_trace_base.BatchSpanProcessor(remoteExporter, {
|
|
244
229
|
maxQueueSize: 2048,
|
|
245
230
|
maxExportBatchSize: 512,
|
|
246
231
|
scheduledDelayMillis: 500,
|
|
@@ -252,8 +237,8 @@ var TelemetryConfig = class {
|
|
|
252
237
|
}
|
|
253
238
|
}
|
|
254
239
|
if (this.enableConsole) {
|
|
255
|
-
const consoleExporter = new ConsoleSpanExporter();
|
|
256
|
-
spanProcessors.push(new BatchSpanProcessor(consoleExporter, {
|
|
240
|
+
const consoleExporter = new import_sdk_trace_base.ConsoleSpanExporter();
|
|
241
|
+
spanProcessors.push(new import_sdk_trace_base.BatchSpanProcessor(consoleExporter, {
|
|
257
242
|
maxQueueSize: 2048,
|
|
258
243
|
maxExportBatchSize: 512,
|
|
259
244
|
scheduledDelayMillis: 500,
|
|
@@ -265,7 +250,7 @@ var TelemetryConfig = class {
|
|
|
265
250
|
console.log("[Telemetry] No exporters configured, telemetry will not be collected");
|
|
266
251
|
return;
|
|
267
252
|
}
|
|
268
|
-
this.sdk = new NodeSDK({
|
|
253
|
+
this.sdk = new import_sdk_node.NodeSDK({
|
|
269
254
|
resource,
|
|
270
255
|
spanProcessors
|
|
271
256
|
});
|