@foam-ai/node 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +538 -75
- package/dist/constants.d.ts +43 -0
- package/dist/constants.js +97 -0
- package/dist/endpoint.d.ts +2 -0
- package/dist/endpoint.js +11 -0
- package/dist/exporters.d.ts +25 -0
- package/dist/exporters.js +103 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +26 -0
- package/dist/ingest.d.ts +6 -0
- package/dist/ingest.js +61 -0
- package/dist/init.d.ts +22 -0
- package/dist/init.js +150 -0
- package/dist/instrumentations.d.ts +3 -0
- package/dist/instrumentations.js +101 -0
- package/dist/logs.d.ts +9 -0
- package/dist/logs.js +61 -0
- package/dist/metrics.d.ts +5 -0
- package/dist/metrics.js +29 -0
- package/dist/network-capture/collector.d.ts +27 -0
- package/dist/network-capture/collector.js +356 -0
- package/dist/network-capture/http.d.ts +5 -0
- package/dist/network-capture/http.js +221 -0
- package/dist/network-capture/index.d.ts +2 -0
- package/dist/network-capture/index.js +17 -0
- package/dist/network-capture/redact.d.ts +6 -0
- package/dist/network-capture/redact.js +87 -0
- package/dist/network-capture/undici.d.ts +5 -0
- package/dist/network-capture/undici.js +177 -0
- package/dist/otlp.d.ts +8 -0
- package/dist/otlp.js +46 -0
- package/dist/propagation.d.ts +5 -0
- package/dist/propagation.js +45 -0
- package/dist/report.d.ts +9 -0
- package/dist/report.js +56 -0
- package/dist/resource.d.ts +3 -0
- package/dist/resource.js +24 -0
- package/dist/state.d.ts +26 -0
- package/dist/state.js +61 -0
- package/dist/traces.d.ts +1 -0
- package/dist/traces.js +21 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +20 -0
- package/package.json +47 -19
- package/dist/node/src/capture-exception.d.ts +0 -9
- package/dist/node/src/capture-exception.js +0 -31
- package/dist/node/src/index.d.ts +0 -13
- package/dist/node/src/index.js +0 -19
- package/dist/node/src/init.d.ts +0 -27
- package/dist/node/src/init.js +0 -218
- package/dist/node/src/metrics.d.ts +0 -28
- package/dist/node/src/metrics.js +0 -69
- package/dist/shared/constants.d.ts +0 -1
- package/dist/shared/constants.js +0 -4
- package/dist/shared/util.d.ts +0 -9
- package/dist/shared/util.js +0 -21
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SeverityNumber } from "@opentelemetry/api-logs";
|
|
2
|
+
export declare const FOAM_ENDPOINT = "https://otel.api.foam.ai";
|
|
3
|
+
export declare const FOAM_INGEST_HOST: string;
|
|
4
|
+
export declare const FOAM_IDENTIFIER_NAME = "[foam-otel]";
|
|
5
|
+
export declare const FOAM_DISTRO_NAME = "@foam-ai/node";
|
|
6
|
+
export declare const FOAM_DISTRO_VERSION = "0.1.0-alpha.7";
|
|
7
|
+
export declare const FOAM_OTLP_TRACES_PATH = "/v1/traces";
|
|
8
|
+
export declare const FOAM_OTLP_LOGS_PATH = "/v1/logs";
|
|
9
|
+
export declare const FOAM_OTLP_METRICS_PATH = "/v1/metrics";
|
|
10
|
+
export declare const NETWORK_BODY_CHUNK_BYTES: number;
|
|
11
|
+
export declare const NETWORK_BODY_MAX_CAPTURE_BYTES: number;
|
|
12
|
+
export declare const NETWORK_BODY_MAX_DECODE_BYTES: number;
|
|
13
|
+
export declare const NETWORK_CAPTURE_EVENT = "foam.http.body.chunk";
|
|
14
|
+
export declare const NETWORK_CAPTURE_EVENT_BODY = "HTTP body chunk";
|
|
15
|
+
export declare const NETWORK_CAPTURE_DEADLINE_MS = 60000;
|
|
16
|
+
export declare const MAX_ACTIVE_CAPTURES = 128;
|
|
17
|
+
export declare const ATTR_HTTP_REQUEST_BODY_SIZE = "http.request.body.size";
|
|
18
|
+
export declare const ATTR_HTTP_RESPONSE_BODY_SIZE = "http.response.body.size";
|
|
19
|
+
export declare const ATTR_HTTP_REQUEST_BODY_CONTENT = "http.request.body.content";
|
|
20
|
+
export declare const ATTR_HTTP_RESPONSE_BODY_CONTENT = "http.response.body.content";
|
|
21
|
+
export declare const ATTR_FOAM_HTTP_BODY_ID = "foam.http.body.id";
|
|
22
|
+
export declare const ATTR_FOAM_HTTP_BODY_SIDE = "foam.http.body.side";
|
|
23
|
+
export declare const ATTR_FOAM_HTTP_BODY_DIRECTION = "foam.http.body.direction";
|
|
24
|
+
export declare const ATTR_FOAM_HTTP_BODY_COMPLETE = "foam.http.body.complete";
|
|
25
|
+
export declare const ATTR_FOAM_HTTP_BODY_TRUNCATED = "foam.http.body.truncated";
|
|
26
|
+
export declare const ATTR_FOAM_HTTP_BODY_OUTCOME = "foam.http.body.outcome";
|
|
27
|
+
export declare const ATTR_FOAM_HTTP_BODY_CAPTURED_BYTES = "foam.http.body.captured_bytes";
|
|
28
|
+
export declare const ATTR_FOAM_HTTP_BODY_CHUNK_COUNT = "foam.http.body.chunk.count";
|
|
29
|
+
export declare const ATTR_FOAM_HTTP_BODY_CHUNK_INDEX = "foam.http.body.chunk.index";
|
|
30
|
+
export declare const ATTR_FOAM_HTTP_BODY_CHUNK_BYTES = "foam.http.body.chunk.bytes";
|
|
31
|
+
export declare const ATTR_FOAM_HTTP_BODY_CHUNK_CONTENT = "foam.http.body.chunk.content";
|
|
32
|
+
export declare const ATTR_FOAM_HTTP_REQUEST_BODY_CAPTURE_ID = "foam.http.request.body.capture_id";
|
|
33
|
+
export declare const ATTR_FOAM_HTTP_RESPONSE_BODY_CAPTURE_ID = "foam.http.response.body.capture_id";
|
|
34
|
+
export declare const ATTR_FOAM_HTTP_REQUEST_BODY_COMPLETE = "foam.http.request.body.complete";
|
|
35
|
+
export declare const ATTR_FOAM_HTTP_RESPONSE_BODY_COMPLETE = "foam.http.response.body.complete";
|
|
36
|
+
export declare const ATTR_FOAM_HTTP_REQUEST_BODY_TRUNCATED = "foam.http.request.body.truncated";
|
|
37
|
+
export declare const ATTR_FOAM_HTTP_RESPONSE_BODY_TRUNCATED = "foam.http.response.body.truncated";
|
|
38
|
+
export declare const SAFE_NETWORK_HEADERS: readonly ["content-type", "content-length", "content-encoding"];
|
|
39
|
+
export declare const REDACTED_VALUE = "[REDACTED]";
|
|
40
|
+
export declare const SENSITIVE_BODY_KEY_PATTERNS: readonly ["password", "passwd", "passphrase", "secret", "token", "apikey", "authorization", "credential", "privatekey", "sessionid", "creditcard", "cardnumber", "accountnumber", "routingnumber"];
|
|
41
|
+
export declare const SENSITIVE_BODY_KEYS_EXACT: readonly ["auth", "pwd", "pin", "otp", "cvv", "cvc", "ssn", "key", "cookie", "setcookie", "session"];
|
|
42
|
+
export declare const DIAG_LOG_LEVEL = "OTEL_LOG_LEVEL";
|
|
43
|
+
export declare const SEVERITY_TEXT: Partial<Record<SeverityNumber, string>>;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEVERITY_TEXT = exports.DIAG_LOG_LEVEL = exports.SENSITIVE_BODY_KEYS_EXACT = exports.SENSITIVE_BODY_KEY_PATTERNS = exports.REDACTED_VALUE = exports.SAFE_NETWORK_HEADERS = exports.ATTR_FOAM_HTTP_RESPONSE_BODY_TRUNCATED = exports.ATTR_FOAM_HTTP_REQUEST_BODY_TRUNCATED = exports.ATTR_FOAM_HTTP_RESPONSE_BODY_COMPLETE = exports.ATTR_FOAM_HTTP_REQUEST_BODY_COMPLETE = exports.ATTR_FOAM_HTTP_RESPONSE_BODY_CAPTURE_ID = exports.ATTR_FOAM_HTTP_REQUEST_BODY_CAPTURE_ID = exports.ATTR_FOAM_HTTP_BODY_CHUNK_CONTENT = exports.ATTR_FOAM_HTTP_BODY_CHUNK_BYTES = exports.ATTR_FOAM_HTTP_BODY_CHUNK_INDEX = exports.ATTR_FOAM_HTTP_BODY_CHUNK_COUNT = exports.ATTR_FOAM_HTTP_BODY_CAPTURED_BYTES = exports.ATTR_FOAM_HTTP_BODY_OUTCOME = exports.ATTR_FOAM_HTTP_BODY_TRUNCATED = exports.ATTR_FOAM_HTTP_BODY_COMPLETE = exports.ATTR_FOAM_HTTP_BODY_DIRECTION = exports.ATTR_FOAM_HTTP_BODY_SIDE = exports.ATTR_FOAM_HTTP_BODY_ID = exports.ATTR_HTTP_RESPONSE_BODY_CONTENT = exports.ATTR_HTTP_REQUEST_BODY_CONTENT = exports.ATTR_HTTP_RESPONSE_BODY_SIZE = exports.ATTR_HTTP_REQUEST_BODY_SIZE = exports.MAX_ACTIVE_CAPTURES = exports.NETWORK_CAPTURE_DEADLINE_MS = exports.NETWORK_CAPTURE_EVENT_BODY = exports.NETWORK_CAPTURE_EVENT = exports.NETWORK_BODY_MAX_DECODE_BYTES = exports.NETWORK_BODY_MAX_CAPTURE_BYTES = exports.NETWORK_BODY_CHUNK_BYTES = exports.FOAM_OTLP_METRICS_PATH = exports.FOAM_OTLP_LOGS_PATH = exports.FOAM_OTLP_TRACES_PATH = exports.FOAM_DISTRO_VERSION = exports.FOAM_DISTRO_NAME = exports.FOAM_IDENTIFIER_NAME = exports.FOAM_INGEST_HOST = exports.FOAM_ENDPOINT = void 0;
|
|
4
|
+
const api_logs_1 = require("@opentelemetry/api-logs");
|
|
5
|
+
exports.FOAM_ENDPOINT = "https://otel.api.foam.ai";
|
|
6
|
+
exports.FOAM_INGEST_HOST = new URL(exports.FOAM_ENDPOINT).hostname;
|
|
7
|
+
exports.FOAM_IDENTIFIER_NAME = "[foam-otel]";
|
|
8
|
+
exports.FOAM_DISTRO_NAME = "@foam-ai/node";
|
|
9
|
+
exports.FOAM_DISTRO_VERSION = "0.1.0-alpha.7";
|
|
10
|
+
exports.FOAM_OTLP_TRACES_PATH = "/v1/traces";
|
|
11
|
+
exports.FOAM_OTLP_LOGS_PATH = "/v1/logs";
|
|
12
|
+
exports.FOAM_OTLP_METRICS_PATH = "/v1/metrics";
|
|
13
|
+
exports.NETWORK_BODY_CHUNK_BYTES = 64 * 1024; // pcga11: 64Kib
|
|
14
|
+
exports.NETWORK_BODY_MAX_CAPTURE_BYTES = 1024 * 1024; // pcga11: 1Mib
|
|
15
|
+
// Bounds sync zlib output when decoding captured bodies. 1 MiB of captured
|
|
16
|
+
// gzip can legally inflate to ~1 GiB (worst case ~1032:1), which would be
|
|
17
|
+
// allocated synchronously on the event loop and could OOM-abort the host
|
|
18
|
+
// app. Past this bound zlib throws instead, and the capture falls back to
|
|
19
|
+
// the compressed wire bytes. 16x covers typical text compression ratios.
|
|
20
|
+
exports.NETWORK_BODY_MAX_DECODE_BYTES = 16 * exports.NETWORK_BODY_MAX_CAPTURE_BYTES;
|
|
21
|
+
exports.NETWORK_CAPTURE_EVENT = "foam.http.body.chunk";
|
|
22
|
+
exports.NETWORK_CAPTURE_EVENT_BODY = "HTTP body chunk";
|
|
23
|
+
exports.NETWORK_CAPTURE_DEADLINE_MS = 60_000;
|
|
24
|
+
exports.MAX_ACTIVE_CAPTURES = 128;
|
|
25
|
+
// pcga11: Do not change these.
|
|
26
|
+
// Spec names copied from OpenTelemetry HTTP semantic conventions. 1.43.0 does
|
|
27
|
+
// not export BODY_CONTENT, and OTel JS recommends copying unstable names
|
|
28
|
+
// instead of importing `@opentelemetry/semantic-conventions/incubating`.
|
|
29
|
+
exports.ATTR_HTTP_REQUEST_BODY_SIZE = "http.request.body.size";
|
|
30
|
+
exports.ATTR_HTTP_RESPONSE_BODY_SIZE = "http.response.body.size";
|
|
31
|
+
exports.ATTR_HTTP_REQUEST_BODY_CONTENT = "http.request.body.content";
|
|
32
|
+
exports.ATTR_HTTP_RESPONSE_BODY_CONTENT = "http.response.body.content";
|
|
33
|
+
exports.ATTR_FOAM_HTTP_BODY_ID = "foam.http.body.id";
|
|
34
|
+
exports.ATTR_FOAM_HTTP_BODY_SIDE = "foam.http.body.side";
|
|
35
|
+
exports.ATTR_FOAM_HTTP_BODY_DIRECTION = "foam.http.body.direction";
|
|
36
|
+
exports.ATTR_FOAM_HTTP_BODY_COMPLETE = "foam.http.body.complete";
|
|
37
|
+
exports.ATTR_FOAM_HTTP_BODY_TRUNCATED = "foam.http.body.truncated";
|
|
38
|
+
exports.ATTR_FOAM_HTTP_BODY_OUTCOME = "foam.http.body.outcome";
|
|
39
|
+
exports.ATTR_FOAM_HTTP_BODY_CAPTURED_BYTES = "foam.http.body.captured_bytes";
|
|
40
|
+
exports.ATTR_FOAM_HTTP_BODY_CHUNK_COUNT = "foam.http.body.chunk.count";
|
|
41
|
+
exports.ATTR_FOAM_HTTP_BODY_CHUNK_INDEX = "foam.http.body.chunk.index";
|
|
42
|
+
exports.ATTR_FOAM_HTTP_BODY_CHUNK_BYTES = "foam.http.body.chunk.bytes";
|
|
43
|
+
exports.ATTR_FOAM_HTTP_BODY_CHUNK_CONTENT = "foam.http.body.chunk.content";
|
|
44
|
+
exports.ATTR_FOAM_HTTP_REQUEST_BODY_CAPTURE_ID = "foam.http.request.body.capture_id";
|
|
45
|
+
exports.ATTR_FOAM_HTTP_RESPONSE_BODY_CAPTURE_ID = "foam.http.response.body.capture_id";
|
|
46
|
+
exports.ATTR_FOAM_HTTP_REQUEST_BODY_COMPLETE = "foam.http.request.body.complete";
|
|
47
|
+
exports.ATTR_FOAM_HTTP_RESPONSE_BODY_COMPLETE = "foam.http.response.body.complete";
|
|
48
|
+
exports.ATTR_FOAM_HTTP_REQUEST_BODY_TRUNCATED = "foam.http.request.body.truncated";
|
|
49
|
+
exports.ATTR_FOAM_HTTP_RESPONSE_BODY_TRUNCATED = "foam.http.response.body.truncated";
|
|
50
|
+
exports.SAFE_NETWORK_HEADERS = [
|
|
51
|
+
"content-type",
|
|
52
|
+
"content-length",
|
|
53
|
+
"content-encoding",
|
|
54
|
+
];
|
|
55
|
+
exports.REDACTED_VALUE = "[REDACTED]";
|
|
56
|
+
// pcga11: Matched against body keys after lowercasing and stripping the
|
|
57
|
+
// -_. separators, so "api-key", "apiKey", and "API_KEY" all normalize to
|
|
58
|
+
// "apikey". Patterns match anywhere in the key ("user_password" is caught);
|
|
59
|
+
// exact keys are too short or too common to substring-match safely.
|
|
60
|
+
exports.SENSITIVE_BODY_KEY_PATTERNS = [
|
|
61
|
+
"password",
|
|
62
|
+
"passwd",
|
|
63
|
+
"passphrase",
|
|
64
|
+
"secret",
|
|
65
|
+
"token",
|
|
66
|
+
"apikey",
|
|
67
|
+
"authorization",
|
|
68
|
+
"credential",
|
|
69
|
+
"privatekey",
|
|
70
|
+
"sessionid",
|
|
71
|
+
"creditcard",
|
|
72
|
+
"cardnumber",
|
|
73
|
+
"accountnumber",
|
|
74
|
+
"routingnumber",
|
|
75
|
+
];
|
|
76
|
+
exports.SENSITIVE_BODY_KEYS_EXACT = [
|
|
77
|
+
"auth",
|
|
78
|
+
"pwd",
|
|
79
|
+
"pin",
|
|
80
|
+
"otp",
|
|
81
|
+
"cvv",
|
|
82
|
+
"cvc",
|
|
83
|
+
"ssn",
|
|
84
|
+
"key",
|
|
85
|
+
"cookie",
|
|
86
|
+
"setcookie",
|
|
87
|
+
"session",
|
|
88
|
+
];
|
|
89
|
+
exports.DIAG_LOG_LEVEL = "OTEL_LOG_LEVEL";
|
|
90
|
+
exports.SEVERITY_TEXT = {
|
|
91
|
+
[api_logs_1.SeverityNumber.TRACE]: "TRACE",
|
|
92
|
+
[api_logs_1.SeverityNumber.DEBUG]: "DEBUG",
|
|
93
|
+
[api_logs_1.SeverityNumber.INFO]: "INFO",
|
|
94
|
+
[api_logs_1.SeverityNumber.WARN]: "WARN",
|
|
95
|
+
[api_logs_1.SeverityNumber.ERROR]: "ERROR",
|
|
96
|
+
[api_logs_1.SeverityNumber.FATAL]: "FATAL",
|
|
97
|
+
};
|
package/dist/endpoint.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setEndpoint = exports.endpoint = void 0;
|
|
4
|
+
const constants_js_1 = require("./constants.js");
|
|
5
|
+
// pcga11: Defaults to Foam's endpoint and changes only on an explicit setEndpoint
|
|
6
|
+
// call. Exported as a live binding so importers always read the current value.
|
|
7
|
+
exports.endpoint = constants_js_1.FOAM_ENDPOINT;
|
|
8
|
+
const setEndpoint = (value) => {
|
|
9
|
+
exports.endpoint = value;
|
|
10
|
+
};
|
|
11
|
+
exports.setEndpoint = setEndpoint;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Attributes } from "@opentelemetry/api";
|
|
2
|
+
import type { ExportResult } from "@opentelemetry/core";
|
|
3
|
+
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
|
4
|
+
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
|
5
|
+
import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-http";
|
|
6
|
+
import type { ReadableLogRecord } from "@opentelemetry/sdk-logs";
|
|
7
|
+
import type { ResourceMetrics } from "@opentelemetry/sdk-metrics";
|
|
8
|
+
import type { ReadableSpan } from "@opentelemetry/sdk-trace-base";
|
|
9
|
+
type Stamp = Attributes | undefined;
|
|
10
|
+
export declare class FoamTraceExporter extends OTLPTraceExporter {
|
|
11
|
+
private readonly stamp?;
|
|
12
|
+
constructor(token: string, stamp?: Stamp);
|
|
13
|
+
export(spans: ReadableSpan[], callback: (result: ExportResult) => void): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class FoamLogExporter extends OTLPLogExporter {
|
|
16
|
+
private readonly stamp?;
|
|
17
|
+
constructor(token: string, stamp?: Stamp);
|
|
18
|
+
export(records: ReadableLogRecord[], callback: (result: ExportResult) => void): void;
|
|
19
|
+
}
|
|
20
|
+
export declare class FoamMetricExporter extends OTLPMetricExporter {
|
|
21
|
+
private readonly stamp?;
|
|
22
|
+
constructor(token: string, stamp?: Stamp);
|
|
23
|
+
export(resourceMetrics: ResourceMetrics, callback: (result: ExportResult) => void): void;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FoamMetricExporter = exports.FoamLogExporter = exports.FoamTraceExporter = void 0;
|
|
4
|
+
const exporter_logs_otlp_http_1 = require("@opentelemetry/exporter-logs-otlp-http");
|
|
5
|
+
const exporter_metrics_otlp_http_1 = require("@opentelemetry/exporter-metrics-otlp-http");
|
|
6
|
+
const exporter_trace_otlp_http_1 = require("@opentelemetry/exporter-trace-otlp-http");
|
|
7
|
+
const resources_1 = require("@opentelemetry/resources");
|
|
8
|
+
const constants_js_1 = require("./constants.js");
|
|
9
|
+
const endpoint_js_1 = require("./endpoint.js");
|
|
10
|
+
class FoamTraceExporter extends exporter_trace_otlp_http_1.OTLPTraceExporter {
|
|
11
|
+
stamp;
|
|
12
|
+
constructor(token, stamp) {
|
|
13
|
+
super({
|
|
14
|
+
url: `${endpoint_js_1.endpoint}${constants_js_1.FOAM_OTLP_TRACES_PATH}`,
|
|
15
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
16
|
+
});
|
|
17
|
+
this.stamp = stamp;
|
|
18
|
+
}
|
|
19
|
+
export(spans, callback) {
|
|
20
|
+
const { stamp } = this;
|
|
21
|
+
if (!stamp) {
|
|
22
|
+
super.export(spans, callback);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const overlay = (0, resources_1.resourceFromAttributes)(stamp);
|
|
26
|
+
const copies = spans.map((span) => ({
|
|
27
|
+
name: span.name,
|
|
28
|
+
kind: span.kind,
|
|
29
|
+
spanContext: span.spanContext.bind(span),
|
|
30
|
+
parentSpanContext: span.parentSpanContext,
|
|
31
|
+
startTime: span.startTime,
|
|
32
|
+
endTime: span.endTime,
|
|
33
|
+
status: span.status,
|
|
34
|
+
attributes: span.attributes,
|
|
35
|
+
links: span.links,
|
|
36
|
+
events: span.events,
|
|
37
|
+
duration: span.duration,
|
|
38
|
+
ended: span.ended,
|
|
39
|
+
resource: span.resource.merge(overlay),
|
|
40
|
+
instrumentationScope: span.instrumentationScope,
|
|
41
|
+
droppedAttributesCount: span.droppedAttributesCount,
|
|
42
|
+
droppedEventsCount: span.droppedEventsCount,
|
|
43
|
+
droppedLinksCount: span.droppedLinksCount,
|
|
44
|
+
}));
|
|
45
|
+
super.export(copies, callback);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.FoamTraceExporter = FoamTraceExporter;
|
|
49
|
+
class FoamLogExporter extends exporter_logs_otlp_http_1.OTLPLogExporter {
|
|
50
|
+
stamp;
|
|
51
|
+
constructor(token, stamp) {
|
|
52
|
+
super({
|
|
53
|
+
url: `${endpoint_js_1.endpoint}${constants_js_1.FOAM_OTLP_LOGS_PATH}`,
|
|
54
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
55
|
+
});
|
|
56
|
+
this.stamp = stamp;
|
|
57
|
+
}
|
|
58
|
+
export(records, callback) {
|
|
59
|
+
const { stamp } = this;
|
|
60
|
+
if (!stamp) {
|
|
61
|
+
super.export(records, callback);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const overlay = (0, resources_1.resourceFromAttributes)(stamp);
|
|
65
|
+
const copies = records.map((record) => ({
|
|
66
|
+
hrTime: record.hrTime,
|
|
67
|
+
hrTimeObserved: record.hrTimeObserved,
|
|
68
|
+
spanContext: record.spanContext,
|
|
69
|
+
severityText: record.severityText,
|
|
70
|
+
severityNumber: record.severityNumber,
|
|
71
|
+
body: record.body,
|
|
72
|
+
eventName: record.eventName,
|
|
73
|
+
resource: record.resource.merge(overlay),
|
|
74
|
+
instrumentationScope: record.instrumentationScope,
|
|
75
|
+
attributes: record.attributes,
|
|
76
|
+
droppedAttributesCount: record.droppedAttributesCount,
|
|
77
|
+
}));
|
|
78
|
+
super.export(copies, callback);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.FoamLogExporter = FoamLogExporter;
|
|
82
|
+
class FoamMetricExporter extends exporter_metrics_otlp_http_1.OTLPMetricExporter {
|
|
83
|
+
stamp;
|
|
84
|
+
constructor(token, stamp) {
|
|
85
|
+
super({
|
|
86
|
+
url: `${endpoint_js_1.endpoint}${constants_js_1.FOAM_OTLP_METRICS_PATH}`,
|
|
87
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
88
|
+
});
|
|
89
|
+
this.stamp = stamp;
|
|
90
|
+
}
|
|
91
|
+
export(resourceMetrics, callback) {
|
|
92
|
+
const { stamp } = this;
|
|
93
|
+
if (!stamp) {
|
|
94
|
+
super.export(resourceMetrics, callback);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
super.export({
|
|
98
|
+
...resourceMetrics,
|
|
99
|
+
resource: resourceMetrics.resource.merge((0, resources_1.resourceFromAttributes)(stamp)),
|
|
100
|
+
}, callback);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.FoamMetricExporter = FoamMetricExporter;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { init } from "./init.js";
|
|
2
|
+
export { getState } from "./state.js";
|
|
3
|
+
export { createFoamIngestLogRecordProcessor, createFoamIngestMetricReader, createFoamIngestSpanProcessor, } from "./ingest.js";
|
|
4
|
+
export { extractTraceContext, getBaggage, injectTraceContext, setBaggage, } from "./propagation.js";
|
|
5
|
+
export { addUpDownCounter, incrementCounter, recordHistogram, setMetric, } from "./metrics.js";
|
|
6
|
+
export { log, SeverityNumber } from "./logs.js";
|
|
7
|
+
export { recordException } from "./traces.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recordException = exports.SeverityNumber = exports.log = exports.setMetric = exports.recordHistogram = exports.incrementCounter = exports.addUpDownCounter = exports.setBaggage = exports.injectTraceContext = exports.getBaggage = exports.extractTraceContext = exports.createFoamIngestSpanProcessor = exports.createFoamIngestMetricReader = exports.createFoamIngestLogRecordProcessor = exports.getState = exports.init = void 0;
|
|
4
|
+
var init_js_1 = require("./init.js");
|
|
5
|
+
Object.defineProperty(exports, "init", { enumerable: true, get: function () { return init_js_1.init; } });
|
|
6
|
+
var state_js_1 = require("./state.js");
|
|
7
|
+
Object.defineProperty(exports, "getState", { enumerable: true, get: function () { return state_js_1.getState; } });
|
|
8
|
+
var ingest_js_1 = require("./ingest.js");
|
|
9
|
+
Object.defineProperty(exports, "createFoamIngestLogRecordProcessor", { enumerable: true, get: function () { return ingest_js_1.createFoamIngestLogRecordProcessor; } });
|
|
10
|
+
Object.defineProperty(exports, "createFoamIngestMetricReader", { enumerable: true, get: function () { return ingest_js_1.createFoamIngestMetricReader; } });
|
|
11
|
+
Object.defineProperty(exports, "createFoamIngestSpanProcessor", { enumerable: true, get: function () { return ingest_js_1.createFoamIngestSpanProcessor; } });
|
|
12
|
+
var propagation_js_1 = require("./propagation.js");
|
|
13
|
+
Object.defineProperty(exports, "extractTraceContext", { enumerable: true, get: function () { return propagation_js_1.extractTraceContext; } });
|
|
14
|
+
Object.defineProperty(exports, "getBaggage", { enumerable: true, get: function () { return propagation_js_1.getBaggage; } });
|
|
15
|
+
Object.defineProperty(exports, "injectTraceContext", { enumerable: true, get: function () { return propagation_js_1.injectTraceContext; } });
|
|
16
|
+
Object.defineProperty(exports, "setBaggage", { enumerable: true, get: function () { return propagation_js_1.setBaggage; } });
|
|
17
|
+
var metrics_js_1 = require("./metrics.js");
|
|
18
|
+
Object.defineProperty(exports, "addUpDownCounter", { enumerable: true, get: function () { return metrics_js_1.addUpDownCounter; } });
|
|
19
|
+
Object.defineProperty(exports, "incrementCounter", { enumerable: true, get: function () { return metrics_js_1.incrementCounter; } });
|
|
20
|
+
Object.defineProperty(exports, "recordHistogram", { enumerable: true, get: function () { return metrics_js_1.recordHistogram; } });
|
|
21
|
+
Object.defineProperty(exports, "setMetric", { enumerable: true, get: function () { return metrics_js_1.setMetric; } });
|
|
22
|
+
var logs_js_1 = require("./logs.js");
|
|
23
|
+
Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logs_js_1.log; } });
|
|
24
|
+
Object.defineProperty(exports, "SeverityNumber", { enumerable: true, get: function () { return logs_js_1.SeverityNumber; } });
|
|
25
|
+
var traces_js_1 = require("./traces.js");
|
|
26
|
+
Object.defineProperty(exports, "recordException", { enumerable: true, get: function () { return traces_js_1.recordException; } });
|
package/dist/ingest.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type LogRecordProcessor } from "@opentelemetry/sdk-logs";
|
|
2
|
+
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
|
3
|
+
import { type SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
4
|
+
export declare function createFoamIngestSpanProcessor(name: string, environment: string, token: string): SpanProcessor;
|
|
5
|
+
export declare function createFoamIngestLogRecordProcessor(name: string, environment: string, token: string): LogRecordProcessor;
|
|
6
|
+
export declare function createFoamIngestMetricReader(name: string, environment: string, token: string): PeriodicExportingMetricReader;
|
package/dist/ingest.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createFoamIngestSpanProcessor = createFoamIngestSpanProcessor;
|
|
4
|
+
exports.createFoamIngestLogRecordProcessor = createFoamIngestLogRecordProcessor;
|
|
5
|
+
exports.createFoamIngestMetricReader = createFoamIngestMetricReader;
|
|
6
|
+
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
7
|
+
const sdk_logs_1 = require("@opentelemetry/sdk-logs");
|
|
8
|
+
const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
|
|
9
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
10
|
+
const api_logs_1 = require("@opentelemetry/api-logs");
|
|
11
|
+
const constants_js_1 = require("./constants.js");
|
|
12
|
+
const report_js_1 = require("./report.js");
|
|
13
|
+
const exporters_js_1 = require("./exporters.js");
|
|
14
|
+
const logs_js_1 = require("./logs.js");
|
|
15
|
+
const state_js_1 = require("./state.js");
|
|
16
|
+
function prepareStamp(name, environment, token) {
|
|
17
|
+
if (!name?.trim() || !environment?.trim() || !token) {
|
|
18
|
+
throw new Error(`${constants_js_1.FOAM_IDENTIFIER_NAME}: name, environment, and token are required`);
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
stamp: {
|
|
22
|
+
[semantic_conventions_1.ATTR_SERVICE_NAME]: name,
|
|
23
|
+
[semantic_conventions_1.ATTR_DEPLOYMENT_ENVIRONMENT_NAME]: environment,
|
|
24
|
+
[constants_js_1.FOAM_INGEST_HOST]: constants_js_1.FOAM_INGEST_HOST,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function reportIngestSignal(signal, name, environment, token) {
|
|
29
|
+
(0, state_js_1.setSignal)(signal, state_js_1.SignalSources.ingest);
|
|
30
|
+
// pcga11: report() prefixes the identifier itself; adding it here would double it.
|
|
31
|
+
(0, report_js_1.report)({
|
|
32
|
+
token: token,
|
|
33
|
+
name: name,
|
|
34
|
+
environment: environment,
|
|
35
|
+
severity: api_logs_1.SeverityNumber.INFO,
|
|
36
|
+
message: `ingest ${signal} processor attached`,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
function createFoamIngestSpanProcessor(name, environment, token) {
|
|
40
|
+
const { stamp } = prepareStamp(name, environment, token);
|
|
41
|
+
const processor = new sdk_trace_base_1.BatchSpanProcessor(new exporters_js_1.FoamTraceExporter(token, stamp));
|
|
42
|
+
reportIngestSignal(state_js_1.Signals.traces, name, environment, token);
|
|
43
|
+
return processor;
|
|
44
|
+
}
|
|
45
|
+
function createFoamIngestLogRecordProcessor(name, environment, token) {
|
|
46
|
+
const { stamp } = prepareStamp(name, environment, token);
|
|
47
|
+
const processor = new sdk_logs_1.BatchLogRecordProcessor({
|
|
48
|
+
exporter: new exporters_js_1.FoamLogExporter(token, stamp),
|
|
49
|
+
});
|
|
50
|
+
(0, logs_js_1.ensureFoamLoggerProvider)(name, environment, token, stamp);
|
|
51
|
+
reportIngestSignal(state_js_1.Signals.logs, name, environment, token);
|
|
52
|
+
return processor;
|
|
53
|
+
}
|
|
54
|
+
function createFoamIngestMetricReader(name, environment, token) {
|
|
55
|
+
const { stamp } = prepareStamp(name, environment, token);
|
|
56
|
+
const reader = new sdk_metrics_1.PeriodicExportingMetricReader({
|
|
57
|
+
exporter: new exporters_js_1.FoamMetricExporter(token, stamp),
|
|
58
|
+
});
|
|
59
|
+
reportIngestSignal(state_js_1.Signals.metrics, name, environment, token);
|
|
60
|
+
return reader;
|
|
61
|
+
}
|
package/dist/init.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Attributes } from "@opentelemetry/api";
|
|
2
|
+
import { type Instrumentation } from "@opentelemetry/instrumentation";
|
|
3
|
+
import { type LogRecordProcessor } from "@opentelemetry/sdk-logs";
|
|
4
|
+
import { type MetricReader } from "@opentelemetry/sdk-metrics";
|
|
5
|
+
import { type SpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
6
|
+
export interface InitOptions {
|
|
7
|
+
name: string;
|
|
8
|
+
environment: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
version?: string;
|
|
11
|
+
sampleRate?: number;
|
|
12
|
+
disableLogSending?: boolean;
|
|
13
|
+
networkCapture?: "off" | "basic" | "advanced";
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
additionalInstrumentations?: readonly Instrumentation[];
|
|
16
|
+
additionalSpanProcessors?: readonly SpanProcessor[];
|
|
17
|
+
additionalLogRecordProcessors?: readonly LogRecordProcessor[];
|
|
18
|
+
additionalMetricReaders?: readonly MetricReader[];
|
|
19
|
+
additionalResourceAttributes?: Attributes;
|
|
20
|
+
ignoredOutboundHosts?: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
export declare function init(options: InitOptions): void;
|
package/dist/init.js
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.init = init;
|
|
4
|
+
const api_1 = require("@opentelemetry/api");
|
|
5
|
+
const api_logs_1 = require("@opentelemetry/api-logs");
|
|
6
|
+
const context_async_hooks_1 = require("@opentelemetry/context-async-hooks");
|
|
7
|
+
const core_1 = require("@opentelemetry/core");
|
|
8
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
9
|
+
const resource_js_1 = require("./resource.js");
|
|
10
|
+
const sdk_logs_1 = require("@opentelemetry/sdk-logs");
|
|
11
|
+
const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
|
|
12
|
+
const sdk_trace_base_1 = require("@opentelemetry/sdk-trace-base");
|
|
13
|
+
const report_js_1 = require("./report.js");
|
|
14
|
+
const exporters_js_1 = require("./exporters.js");
|
|
15
|
+
const instrumentations_js_1 = require("./instrumentations.js");
|
|
16
|
+
const logs_js_1 = require("./logs.js");
|
|
17
|
+
const state_js_1 = require("./state.js");
|
|
18
|
+
// TODO(pcga11): conflicts, redact and beforeSend handling pending.
|
|
19
|
+
function init(options) {
|
|
20
|
+
const { sampleRate = 1, disableLogSending = false, networkCapture = "basic", enabled = true, } = options;
|
|
21
|
+
// pcga11: Set params before any early return so every state is reported, including failed or disabled attempts.
|
|
22
|
+
(0, state_js_1.setParams)({ name: options.name, environment: options.environment });
|
|
23
|
+
// pcga11: We keep this option because companies often want to turn the integration off in specific envs
|
|
24
|
+
if (!enabled) {
|
|
25
|
+
(0, report_js_1.report)({
|
|
26
|
+
token: options.token,
|
|
27
|
+
severity: api_logs_1.SeverityNumber.INFO,
|
|
28
|
+
message: 'SDK disabled',
|
|
29
|
+
});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!options.token) {
|
|
33
|
+
// pcga11: Nothing can be sent without a token; report() still logs locally so this is not silent.
|
|
34
|
+
(0, report_js_1.report)({
|
|
35
|
+
severity: api_logs_1.SeverityNumber.ERROR,
|
|
36
|
+
message: 'Parameter token not provided',
|
|
37
|
+
});
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// pcga11: Re-initializing could register duplicate providers/instrumentations, so we track the initialization state and bail out on repeat calls
|
|
41
|
+
if ((0, state_js_1.getInitialized)()) {
|
|
42
|
+
(0, report_js_1.report)({
|
|
43
|
+
token: options.token,
|
|
44
|
+
severity: api_logs_1.SeverityNumber.WARN,
|
|
45
|
+
message: 'SDK already initialized',
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!options.name?.trim() || !options.environment?.trim()) {
|
|
50
|
+
(0, report_js_1.report)({
|
|
51
|
+
token: options.token,
|
|
52
|
+
severity: api_logs_1.SeverityNumber.ERROR,
|
|
53
|
+
message: 'Parameters name and environment not provided',
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// pcga11: Hoisted so the catch block can shut down providers whose batch/periodic
|
|
58
|
+
// export timers started in their constructors, even when init fails midway.
|
|
59
|
+
let tracerProvider;
|
|
60
|
+
let meterProvider;
|
|
61
|
+
try {
|
|
62
|
+
const resource = (0, resource_js_1.createFoamResource)(options.name, options.environment, options.version, options.additionalResourceAttributes);
|
|
63
|
+
// pcga11: The context manager is what makes the "current" context (active span, baggage)
|
|
64
|
+
// follow execution across await/callback boundaries, via Node's AsyncLocalStorage. Without
|
|
65
|
+
// one registered, spans would not nest and trace/log correlation would break. Registration
|
|
66
|
+
// is first-wins: if another SDK already installed one, we keep theirs and disable ours.
|
|
67
|
+
const contextManager = new context_async_hooks_1.AsyncLocalStorageContextManager();
|
|
68
|
+
contextManager.enable();
|
|
69
|
+
if (!api_1.context.setGlobalContextManager(contextManager)) {
|
|
70
|
+
contextManager.disable();
|
|
71
|
+
}
|
|
72
|
+
(0, state_js_1.setSignal)(state_js_1.Signals.baggage, api_1.propagation.setGlobalPropagator(new core_1.CompositePropagator({
|
|
73
|
+
propagators: [
|
|
74
|
+
new core_1.W3CTraceContextPropagator(),
|
|
75
|
+
new core_1.W3CBaggagePropagator(),
|
|
76
|
+
],
|
|
77
|
+
})) ? state_js_1.SignalSources.global : state_js_1.SignalSources.none);
|
|
78
|
+
// pcga11: The @opentelemetry/api setters return false when another SDK already owns a slot (registration is first-wins). So we try to register our own and if it fails or already taken, nothing happens.
|
|
79
|
+
// TODO(pcga11): Implement a way to handle piggy backing the context and propagation from another SDK.
|
|
80
|
+
tracerProvider = new sdk_trace_base_1.BasicTracerProvider({
|
|
81
|
+
resource,
|
|
82
|
+
sampler: new sdk_trace_base_1.ParentBasedSampler({
|
|
83
|
+
root: new sdk_trace_base_1.TraceIdRatioBasedSampler(sampleRate),
|
|
84
|
+
}),
|
|
85
|
+
spanProcessors: [
|
|
86
|
+
new sdk_trace_base_1.BatchSpanProcessor(new exporters_js_1.FoamTraceExporter(options.token)),
|
|
87
|
+
...(options.additionalSpanProcessors ?? []),
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
meterProvider = new sdk_metrics_1.MeterProvider({
|
|
91
|
+
resource,
|
|
92
|
+
readers: [
|
|
93
|
+
new sdk_metrics_1.PeriodicExportingMetricReader({
|
|
94
|
+
exporter: new exporters_js_1.FoamMetricExporter(options.token),
|
|
95
|
+
}),
|
|
96
|
+
...(options.additionalMetricReaders ?? []),
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
const loggerProvider = new sdk_logs_1.LoggerProvider({
|
|
100
|
+
resource,
|
|
101
|
+
processors: [
|
|
102
|
+
new sdk_logs_1.BatchLogRecordProcessor({
|
|
103
|
+
exporter: new exporters_js_1.FoamLogExporter(options.token),
|
|
104
|
+
}),
|
|
105
|
+
...(options.additionalLogRecordProcessors ?? []),
|
|
106
|
+
],
|
|
107
|
+
});
|
|
108
|
+
(0, logs_js_1.setFoamLoggerProvider)(loggerProvider);
|
|
109
|
+
// pcga11: trace/metrics/propagation setters return false when the slot is taken by another SDK. The logs setter returns whichever provider ended up registered. We use that to record the source: "global" when Foam owns the slot, "none" when another SDK does. Logs fall back to "local" because the Foam-only provider behind log() exists either way.
|
|
110
|
+
(0, state_js_1.setSignal)(state_js_1.Signals.traces, api_1.trace.setGlobalTracerProvider(tracerProvider) ? state_js_1.SignalSources.global : state_js_1.SignalSources.none);
|
|
111
|
+
(0, state_js_1.setSignal)(state_js_1.Signals.metrics, api_1.metrics.setGlobalMeterProvider(meterProvider) ? state_js_1.SignalSources.global : state_js_1.SignalSources.none);
|
|
112
|
+
(0, state_js_1.setSignal)(state_js_1.Signals.logs, api_logs_1.logs.setGlobalLoggerProvider(loggerProvider) === loggerProvider ? state_js_1.SignalSources.global : state_js_1.SignalSources.local);
|
|
113
|
+
const instrumentations = (0, instrumentations_js_1.buildInstrumentations)(networkCapture, disableLogSending, options.ignoredOutboundHosts, options.additionalInstrumentations ?? []);
|
|
114
|
+
// pcga11: registerInstrumentations turns on instrumentation "hooks". OpenTelemetry wraps supported libraries when the app imports them.
|
|
115
|
+
(0, instrumentation_1.registerInstrumentations)({ instrumentations });
|
|
116
|
+
(0, state_js_1.setInstrumentations)(instrumentations.map(instrumentations_js_1.instrumentationName));
|
|
117
|
+
process.once("beforeExit", () => {
|
|
118
|
+
void Promise.all([
|
|
119
|
+
(0, state_js_1.getSignal)(state_js_1.Signals.traces) === state_js_1.SignalSources.global ? tracerProvider?.shutdown() : undefined,
|
|
120
|
+
(0, state_js_1.getSignal)(state_js_1.Signals.metrics) === state_js_1.SignalSources.global ? meterProvider?.shutdown() : undefined,
|
|
121
|
+
loggerProvider.shutdown(),
|
|
122
|
+
]).catch(() => undefined);
|
|
123
|
+
});
|
|
124
|
+
(0, state_js_1.setInitialized)(true);
|
|
125
|
+
(0, report_js_1.report)({
|
|
126
|
+
token: options.token,
|
|
127
|
+
severity: api_logs_1.SeverityNumber.INFO,
|
|
128
|
+
message: 'SDK initialized',
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
133
|
+
for (const signal of [state_js_1.Signals.traces, state_js_1.Signals.metrics, state_js_1.Signals.logs, state_js_1.Signals.baggage]) {
|
|
134
|
+
(0, state_js_1.setSignal)(signal, state_js_1.SignalSources.none);
|
|
135
|
+
}
|
|
136
|
+
void Promise.all([
|
|
137
|
+
tracerProvider?.shutdown(),
|
|
138
|
+
meterProvider?.shutdown(),
|
|
139
|
+
(0, logs_js_1.getFoamLoggerProvider)()?.shutdown(),
|
|
140
|
+
]).catch(() => undefined);
|
|
141
|
+
(0, logs_js_1.clearFoamLoggerProvider)();
|
|
142
|
+
(0, state_js_1.setInitialized)(false);
|
|
143
|
+
(0, report_js_1.report)({
|
|
144
|
+
token: options.token,
|
|
145
|
+
severity: api_logs_1.SeverityNumber.ERROR,
|
|
146
|
+
message: `SDK initialization failed: ${errorMessage}`,
|
|
147
|
+
error: errorMessage,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Instrumentation } from "@opentelemetry/instrumentation";
|
|
2
|
+
export declare function buildInstrumentations(networkCapture?: "off" | "basic" | "advanced", disableLogSending?: boolean, ignoredOutboundHosts?: readonly string[], additionalInstrumentations?: readonly Instrumentation[]): Instrumentation[];
|
|
3
|
+
export declare const instrumentationName: (instrumentation: Instrumentation) => string;
|