@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
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { type Attributes } from '@opentelemetry/api';
|
|
2
|
-
/**
|
|
3
|
-
* Increments a counter metric by the given value (default 1).
|
|
4
|
-
*
|
|
5
|
-
* Counters are monotonically increasing — use for things like request counts,
|
|
6
|
-
* items processed, or errors encountered.
|
|
7
|
-
*
|
|
8
|
-
* Safe to call before `init()` — silently no-ops via the OTel noop meter.
|
|
9
|
-
*/
|
|
10
|
-
export declare const incrementCounter: (name: string, value?: number, attributes?: Attributes) => void;
|
|
11
|
-
/**
|
|
12
|
-
* Records a value on a histogram metric.
|
|
13
|
-
*
|
|
14
|
-
* Histograms capture distributions — use for latencies, request sizes,
|
|
15
|
-
* or any measurement where percentiles and averages matter.
|
|
16
|
-
*
|
|
17
|
-
* Safe to call before `init()` — silently no-ops via the OTel noop meter.
|
|
18
|
-
*/
|
|
19
|
-
export declare const recordHistogram: (name: string, value: number, attributes?: Attributes) => void;
|
|
20
|
-
/**
|
|
21
|
-
* Records a point-in-time gauge value.
|
|
22
|
-
*
|
|
23
|
-
* Gauges represent a current measurement that can go up or down — use for
|
|
24
|
-
* things like queue depth, active connections, or memory usage.
|
|
25
|
-
*
|
|
26
|
-
* Safe to call before `init()` — silently no-ops via the OTel noop meter.
|
|
27
|
-
*/
|
|
28
|
-
export declare const recordGauge: (name: string, value: number, attributes?: Attributes) => void;
|
package/dist/node/src/metrics.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.recordGauge = exports.recordHistogram = exports.incrementCounter = void 0;
|
|
4
|
-
const api_1 = require("@opentelemetry/api");
|
|
5
|
-
const util_1 = require("../../shared/util");
|
|
6
|
-
const METER_NAME = 'foam';
|
|
7
|
-
const counters = new Map();
|
|
8
|
-
const histograms = new Map();
|
|
9
|
-
const gauges = new Map();
|
|
10
|
-
function getMeter() {
|
|
11
|
-
return api_1.metrics.getMeter(METER_NAME);
|
|
12
|
-
}
|
|
13
|
-
function getOrCreateCounter(name) {
|
|
14
|
-
let counter = counters.get(name);
|
|
15
|
-
if (!counter) {
|
|
16
|
-
counter = getMeter().createCounter(name);
|
|
17
|
-
counters.set(name, counter);
|
|
18
|
-
}
|
|
19
|
-
return counter;
|
|
20
|
-
}
|
|
21
|
-
function getOrCreateHistogram(name) {
|
|
22
|
-
let histogram = histograms.get(name);
|
|
23
|
-
if (!histogram) {
|
|
24
|
-
histogram = getMeter().createHistogram(name);
|
|
25
|
-
histograms.set(name, histogram);
|
|
26
|
-
}
|
|
27
|
-
return histogram;
|
|
28
|
-
}
|
|
29
|
-
function getOrCreateGauge(name) {
|
|
30
|
-
let gauge = gauges.get(name);
|
|
31
|
-
if (!gauge) {
|
|
32
|
-
gauge = getMeter().createGauge(name);
|
|
33
|
-
gauges.set(name, gauge);
|
|
34
|
-
}
|
|
35
|
-
return gauge;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Increments a counter metric by the given value (default 1).
|
|
39
|
-
*
|
|
40
|
-
* Counters are monotonically increasing — use for things like request counts,
|
|
41
|
-
* items processed, or errors encountered.
|
|
42
|
-
*
|
|
43
|
-
* Safe to call before `init()` — silently no-ops via the OTel noop meter.
|
|
44
|
-
*/
|
|
45
|
-
exports.incrementCounter = (0, util_1.safe)((name, value, attributes) => {
|
|
46
|
-
getOrCreateCounter(name).add(value ?? 1, attributes);
|
|
47
|
-
});
|
|
48
|
-
/**
|
|
49
|
-
* Records a value on a histogram metric.
|
|
50
|
-
*
|
|
51
|
-
* Histograms capture distributions — use for latencies, request sizes,
|
|
52
|
-
* or any measurement where percentiles and averages matter.
|
|
53
|
-
*
|
|
54
|
-
* Safe to call before `init()` — silently no-ops via the OTel noop meter.
|
|
55
|
-
*/
|
|
56
|
-
exports.recordHistogram = (0, util_1.safe)((name, value, attributes) => {
|
|
57
|
-
getOrCreateHistogram(name).record(value, attributes);
|
|
58
|
-
});
|
|
59
|
-
/**
|
|
60
|
-
* Records a point-in-time gauge value.
|
|
61
|
-
*
|
|
62
|
-
* Gauges represent a current measurement that can go up or down — use for
|
|
63
|
-
* things like queue depth, active connections, or memory usage.
|
|
64
|
-
*
|
|
65
|
-
* Safe to call before `init()` — silently no-ops via the OTel noop meter.
|
|
66
|
-
*/
|
|
67
|
-
exports.recordGauge = (0, util_1.safe)((name, value, attributes) => {
|
|
68
|
-
getOrCreateGauge(name).record(value, attributes);
|
|
69
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const FOAM_OTEL_ENDPOINT = "https://otel.api.foam.ai";
|
package/dist/shared/constants.js
DELETED
package/dist/shared/util.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Wraps a function to ensure it never throws by swallowing errors.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* export const init = safe((options: Options) => {
|
|
6
|
-
* // Implementation that might throw
|
|
7
|
-
* });
|
|
8
|
-
*/
|
|
9
|
-
export declare function safe<T extends (...args: any[]) => any>(fn: T): T;
|
package/dist/shared/util.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.safe = safe;
|
|
4
|
-
/**
|
|
5
|
-
* Wraps a function to ensure it never throws by swallowing errors.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* export const init = safe((options: Options) => {
|
|
9
|
-
* // Implementation that might throw
|
|
10
|
-
* });
|
|
11
|
-
*/
|
|
12
|
-
function safe(fn) {
|
|
13
|
-
return ((...args) => {
|
|
14
|
-
try {
|
|
15
|
-
return fn(...args);
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return undefined;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|