@aztec/telemetry-client 0.0.1-commit.d431d1c → 0.0.1-commit.d58ff9d0
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/dest/attributes.d.ts +17 -2
- package/dest/attributes.d.ts.map +1 -1
- package/dest/attributes.js +8 -1
- package/dest/config.d.ts +3 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +17 -9
- package/dest/lmdb_metrics.d.ts +2 -2
- package/dest/lmdb_metrics.d.ts.map +1 -1
- package/dest/metric-utils.d.ts +21 -2
- package/dest/metric-utils.d.ts.map +1 -1
- package/dest/metric-utils.js +52 -0
- package/dest/metrics.d.ts +73 -5
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +388 -19
- package/dest/monitored_batch_span_processor.d.ts +29 -0
- package/dest/monitored_batch_span_processor.d.ts.map +1 -0
- package/dest/monitored_batch_span_processor.js +75 -0
- package/dest/nodejs_metrics_monitor.d.ts +1 -1
- package/dest/nodejs_metrics_monitor.d.ts.map +1 -1
- package/dest/nodejs_metrics_monitor.js +7 -1
- package/dest/otel.d.ts +6 -1
- package/dest/otel.d.ts.map +1 -1
- package/dest/otel.js +99 -4
- package/dest/otel_propagation.d.ts +3 -1
- package/dest/otel_propagation.d.ts.map +1 -1
- package/dest/otel_propagation.js +49 -1
- package/dest/otel_resource.d.ts +1 -1
- package/dest/otel_resource.d.ts.map +1 -1
- package/dest/otel_resource.js +14 -2
- package/dest/prom_otel_adapter.d.ts +4 -4
- package/dest/prom_otel_adapter.d.ts.map +1 -1
- package/dest/prom_otel_adapter.js +4 -3
- package/dest/start.d.ts +3 -2
- package/dest/start.d.ts.map +1 -1
- package/dest/start.js +3 -3
- package/dest/telemetry.d.ts +5 -4
- package/dest/telemetry.d.ts.map +1 -1
- package/dest/telemetry.js +1 -1
- package/dest/wrappers/fetch.d.ts +3 -3
- package/dest/wrappers/fetch.d.ts.map +1 -1
- package/dest/wrappers/fetch.js +3 -2
- package/dest/wrappers/index.d.ts +1 -2
- package/dest/wrappers/index.d.ts.map +1 -1
- package/dest/wrappers/index.js +0 -1
- package/package.json +3 -3
- package/src/attributes.ts +21 -1
- package/src/config.ts +24 -9
- package/src/metric-utils.ts +64 -1
- package/src/metrics.ts +400 -19
- package/src/monitored_batch_span_processor.ts +100 -0
- package/src/nodejs_metrics_monitor.ts +4 -1
- package/src/otel.ts +69 -3
- package/src/otel_propagation.ts +42 -1
- package/src/otel_resource.ts +19 -2
- package/src/prom_otel_adapter.ts +4 -5
- package/src/start.ts +12 -4
- package/src/telemetry.ts +4 -3
- package/src/wrappers/fetch.ts +9 -3
- package/src/wrappers/index.ts +0 -1
- package/dest/wrappers/l2_block_stream.d.ts +0 -16
- package/dest/wrappers/l2_block_stream.d.ts.map +0 -1
- package/dest/wrappers/l2_block_stream.js +0 -400
- package/src/wrappers/l2_block_stream.ts +0 -41
package/dest/telemetry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,uBAAuB,EAC5B,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,qBAAqB,IAAI,yBAAyB,EACvD,KAAK,KAAK,IAAI,SAAS,EACvB,KAAK,SAAS,IAAI,aAAa,EAC/B,KAAK,eAAe,IAAI,mBAAmB,EAC3C,KAAK,gBAAgB,IAAI,oBAAoB,EAC7C,KAAK,uBAAuB,IAAI,2BAA2B,EAC3D,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,IAAI,EAET,KAAK,MAAM,EACZ,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,KAAK,UAAU,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAE,MAAM,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,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GACnC,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
|
package/dest/telemetry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SpanStatusCode } from '@opentelemetry/api';
|
|
2
2
|
import { getTelemetryClient } from './start.js';
|
|
3
|
-
export { toMetricOptions } from './metric-utils.js';
|
|
3
|
+
export { toMetricOptions, createUpDownCounterWithDefault } from './metric-utils.js';
|
|
4
4
|
export { SpanStatusCode, ValueType } from '@opentelemetry/api';
|
|
5
5
|
/**
|
|
6
6
|
* Starts a new span whenever the decorated method is called.
|
package/dest/wrappers/fetch.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { defaultFetch } from '@aztec/foundation/json-rpc/client';
|
|
|
2
2
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
3
|
/**
|
|
4
4
|
* Makes a fetch function that retries based on the given attempts and propagates trace information.
|
|
5
|
-
* @param retries - Sequence of intervals (in seconds) to retry.
|
|
5
|
+
* @param retries - Sequence of intervals (in seconds) to retry, or a factory function returning an iterator for custom/indefinite backoff.
|
|
6
6
|
* @param noRetry - Whether to stop retries on server errors.
|
|
7
7
|
* @param log - Optional logger for logging attempts.
|
|
8
8
|
* @returns A fetch function.
|
|
9
9
|
*/
|
|
10
|
-
export declare function makeTracedFetch(retries: number[], defaultNoRetry: boolean, fetch?: typeof defaultFetch, log?: Logger): (host: string, body: unknown, extraHeaders?: Record<string, string>, noRetry?: boolean | undefined) => Promise<{
|
|
10
|
+
export declare function makeTracedFetch(retries: number[] | (() => Generator<number>), defaultNoRetry: boolean, fetch?: typeof defaultFetch, log?: Logger): (host: string, body: unknown, extraHeaders?: Record<string, string>, noRetry?: boolean | undefined) => Promise<{
|
|
11
11
|
response: any;
|
|
12
12
|
headers: {
|
|
13
13
|
get: (header: string) => string | null | undefined;
|
|
14
14
|
};
|
|
15
15
|
}>;
|
|
16
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmV0Y2guZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93cmFwcGVycy9mZXRjaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDakUsT0FBTyxLQUFLLEVBQUUsTUFBTSxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFRcEQ7Ozs7OztHQU1HO0FBQ0gsd0JBQWdCLGVBQWUsQ0FDN0IsT0FBTyxFQUFFLE1BQU0sRUFBRSxHQUFHLENBQUMsTUFBTSxTQUFTLENBQUMsTUFBTSxDQUFDLENBQUMsRUFDN0MsY0FBYyxFQUFFLE9BQU8sRUFDdkIsS0FBSyxzQkFBZSxFQUNwQixHQUFHLENBQUMsRUFBRSxNQUFNOzs7OztHQThCYiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/wrappers/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQpD;;;;;;GAMG;AACH,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/wrappers/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQpD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC,EAC7C,cAAc,EAAE,OAAO,EACvB,KAAK,sBAAe,EACpB,GAAG,CAAC,EAAE,MAAM;;;;;GA8Bb"}
|
package/dest/wrappers/fetch.js
CHANGED
|
@@ -5,7 +5,7 @@ import { getTelemetryClient } from '../start.js';
|
|
|
5
5
|
import { ATTR_JSONRPC_METHOD, ATTR_JSONRPC_REQUEST_ID } from '../vendor/attributes.js';
|
|
6
6
|
/**
|
|
7
7
|
* Makes a fetch function that retries based on the given attempts and propagates trace information.
|
|
8
|
-
* @param retries - Sequence of intervals (in seconds) to retry.
|
|
8
|
+
* @param retries - Sequence of intervals (in seconds) to retry, or a factory function returning an iterator for custom/indefinite backoff.
|
|
9
9
|
* @param noRetry - Whether to stop retries on server errors.
|
|
10
10
|
* @param log - Optional logger for logging attempts.
|
|
11
11
|
* @returns A fetch function.
|
|
@@ -26,7 +26,8 @@ import { ATTR_JSONRPC_METHOD, ATTR_JSONRPC_REQUEST_ID } from '../vendor/attribut
|
|
|
26
26
|
...extraHeaders
|
|
27
27
|
};
|
|
28
28
|
propagation.inject(context.active(), headers);
|
|
29
|
-
|
|
29
|
+
const backoff = typeof retries === 'function' ? retries() : makeBackoff(retries);
|
|
30
|
+
return await retry(()=>fetch(host, body, headers, noRetry ?? defaultNoRetry), `JsonRpcClient request to ${host}`, backoff, log, false);
|
|
30
31
|
} catch (err) {
|
|
31
32
|
span.setStatus({
|
|
32
33
|
code: SpanStatusCode.ERROR,
|
package/dest/wrappers/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from './l2_block_stream.js';
|
|
2
1
|
export * from './fetch.js';
|
|
3
2
|
export * from './json_rpc_server.js';
|
|
4
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy93cmFwcGVycy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLFlBQVksQ0FBQztBQUMzQixjQUFjLHNCQUFzQixDQUFDIn0=
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wrappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/wrappers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,sBAAsB,CAAC"}
|
package/dest/wrappers/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/telemetry-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.d58ff9d0",
|
|
4
4
|
"inherits": [
|
|
5
5
|
"../package.common.json"
|
|
6
6
|
],
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"!*.test.*"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
31
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
30
|
+
"@aztec/foundation": "0.0.1-commit.d58ff9d0",
|
|
31
|
+
"@aztec/stdlib": "0.0.1-commit.d58ff9d0",
|
|
32
32
|
"@opentelemetry/api": "^1.9.0",
|
|
33
33
|
"@opentelemetry/api-logs": "^0.55.0",
|
|
34
34
|
"@opentelemetry/core": "^1.28.0",
|
package/src/attributes.ts
CHANGED
|
@@ -45,6 +45,8 @@ export const BLOCK_NUMBER = 'aztec.block.number';
|
|
|
45
45
|
export const BLOCK_HASH = 'aztec.block.hash';
|
|
46
46
|
/** The slot number */
|
|
47
47
|
export const SLOT_NUMBER = 'aztec.slot.number';
|
|
48
|
+
/** Whether an event happened before or after a slot boundary. */
|
|
49
|
+
export const SLOT_BOUNDARY_SIDE = 'aztec.slot_boundary_side';
|
|
48
50
|
/** The checkpoint number */
|
|
49
51
|
export const CHECKPOINT_NUMBER = 'aztec.checkpoint.number';
|
|
50
52
|
/** The parent's block number */
|
|
@@ -61,6 +63,8 @@ export const EPOCH_SIZE = 'aztec.epoch.size';
|
|
|
61
63
|
export const BLOCK_PROPOSER = 'aztec.block.proposer';
|
|
62
64
|
/** The epoch number */
|
|
63
65
|
export const EPOCH_NUMBER = 'aztec.epoch.number';
|
|
66
|
+
/** Kind of an EpochSession: 'full' or 'partial'. */
|
|
67
|
+
export const EPOCH_SESSION_KIND = 'aztec.epoch_session.kind';
|
|
64
68
|
/** The tx hash */
|
|
65
69
|
export const TX_HASH = 'aztec.tx.hash';
|
|
66
70
|
/** Generic attribute representing whether the action was successful or not */
|
|
@@ -69,6 +73,8 @@ export const OK = 'aztec.ok';
|
|
|
69
73
|
export const STATUS = 'aztec.status';
|
|
70
74
|
/** Generic error type attribute */
|
|
71
75
|
export const ERROR_TYPE = 'aztec.error_type';
|
|
76
|
+
/** The cause of an archiver prune (unproven / uncheckpointed / l1_conflict / orphan / l1_mismatch) */
|
|
77
|
+
export const PRUNE_TYPE = 'aztec.archiver.prune_type';
|
|
72
78
|
/** The type of the transaction */
|
|
73
79
|
export const L1_TX_TYPE = 'aztec.l1.tx_type';
|
|
74
80
|
/** The L1 address of the entity that sent a transaction to L1 */
|
|
@@ -94,7 +100,6 @@ export const VALIDATOR_STATUS = 'aztec.validator_status';
|
|
|
94
100
|
|
|
95
101
|
export const P2P_ID = 'aztec.p2p.id';
|
|
96
102
|
export const P2P_REQ_RESP_PROTOCOL = 'aztec.p2p.req_resp.protocol';
|
|
97
|
-
export const P2P_REQ_RESP_BATCH_REQUESTS_COUNT = 'aztec.p2p.req_resp.batch_requests_count';
|
|
98
103
|
/** The state of a peer (Healthy, Disconnect, Banned) */
|
|
99
104
|
export const P2P_PEER_SCORE_STATE = 'aztec.p2p.peer_score_state';
|
|
100
105
|
export const POOL_NAME = 'aztec.pool.name';
|
|
@@ -128,6 +133,9 @@ export const NODEJS_EVENT_LOOP_STATE = 'nodejs.eventloop.state';
|
|
|
128
133
|
|
|
129
134
|
export const TOPIC_NAME = 'aztec.gossip.topic_name';
|
|
130
135
|
|
|
136
|
+
/** The reason a transaction was evicted from the tx pool */
|
|
137
|
+
export const TX_POOL_EVICTION_REASON = 'aztec.mempool.eviction_reason';
|
|
138
|
+
|
|
131
139
|
export const TX_COLLECTION_METHOD = 'aztec.tx_collection.method';
|
|
132
140
|
|
|
133
141
|
/** Scope of L1 transaction (sequencer, prover, or other) */
|
|
@@ -139,8 +147,20 @@ export const IS_COMMITTEE_MEMBER = 'aztec.is_committee_member';
|
|
|
139
147
|
/** Fisherman fee analysis strategy identifier */
|
|
140
148
|
export const FISHERMAN_FEE_STRATEGY_ID = 'aztec.fisherman.strategy_id';
|
|
141
149
|
|
|
150
|
+
/** Whether the analyzed block reached 100% blob capacity */
|
|
151
|
+
export const BLOCK_FULL = 'aztec.block_full';
|
|
152
|
+
|
|
142
153
|
/** The L1 transaction target for block proposal */
|
|
143
154
|
export const L1_BLOCK_PROPOSAL_TX_TARGET = 'aztec.l1.block_proposal_tx_target';
|
|
144
155
|
|
|
145
156
|
/** Whether tracing methods were used to extract block proposal data */
|
|
146
157
|
export const L1_BLOCK_PROPOSAL_USED_TRACE = 'aztec.l1.block_proposal_used_trace';
|
|
158
|
+
|
|
159
|
+
/** HA signer duty type (e.g., BLOCK_PROPOSAL, CHECKPOINT_ATTESTATION) */
|
|
160
|
+
export const HA_DUTY_TYPE = 'aztec.ha_signer.duty_type';
|
|
161
|
+
|
|
162
|
+
/** HA signer node identifier */
|
|
163
|
+
export const HA_NODE_ID = 'aztec.ha_signer.node_id';
|
|
164
|
+
|
|
165
|
+
/** The address of an attester (validator) participating in consensus */
|
|
166
|
+
export const ATTESTER_ADDRESS = 'aztec.attester.address';
|
package/src/config.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
type ConfigMappingsType,
|
|
3
|
+
booleanConfigHelper,
|
|
4
|
+
getConfigFromMappings,
|
|
5
|
+
numberConfigHelper,
|
|
6
|
+
} from '@aztec/foundation/config';
|
|
2
7
|
|
|
3
8
|
export interface TelemetryClientConfig {
|
|
4
9
|
metricsCollectorUrl?: URL;
|
|
@@ -12,35 +17,35 @@ export interface TelemetryClientConfig {
|
|
|
12
17
|
otelExportTimeoutMs: number;
|
|
13
18
|
otelExcludeMetrics: string[];
|
|
14
19
|
otelIncludeMetrics: string[];
|
|
20
|
+
otelMinTraceDurationMs: number;
|
|
21
|
+
otelBspMaxQueueSize: number;
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
export const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientConfig> = {
|
|
18
25
|
metricsCollectorUrl: {
|
|
19
26
|
env: 'OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
|
|
20
27
|
description: 'The URL of the telemetry collector for metrics',
|
|
21
|
-
parseEnv: (val: string) =>
|
|
28
|
+
parseEnv: (val: string) => new URL(val),
|
|
22
29
|
},
|
|
23
30
|
tracesCollectorUrl: {
|
|
24
31
|
env: 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT',
|
|
25
32
|
description: 'The URL of the telemetry collector for traces',
|
|
26
|
-
parseEnv: (val: string) =>
|
|
33
|
+
parseEnv: (val: string) => new URL(val),
|
|
27
34
|
},
|
|
28
35
|
logsCollectorUrl: {
|
|
29
36
|
env: 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT',
|
|
30
37
|
description: 'The URL of the telemetry collector for logs',
|
|
31
|
-
parseEnv: (val: string) =>
|
|
38
|
+
parseEnv: (val: string) => new URL(val),
|
|
32
39
|
},
|
|
33
40
|
otelCollectIntervalMs: {
|
|
34
41
|
env: 'OTEL_COLLECT_INTERVAL_MS',
|
|
35
42
|
description: 'The interval at which to collect metrics',
|
|
36
|
-
|
|
37
|
-
parseEnv: (val: string) => parseInt(val),
|
|
43
|
+
...numberConfigHelper(60000),
|
|
38
44
|
},
|
|
39
45
|
otelExportTimeoutMs: {
|
|
40
46
|
env: 'OTEL_EXPORT_TIMEOUT_MS',
|
|
41
47
|
description: 'The timeout for exporting metrics',
|
|
42
|
-
|
|
43
|
-
parseEnv: (val: string) => parseInt(val),
|
|
48
|
+
...numberConfigHelper(30000),
|
|
44
49
|
},
|
|
45
50
|
otelExcludeMetrics: {
|
|
46
51
|
env: 'OTEL_EXCLUDE_METRICS',
|
|
@@ -54,6 +59,16 @@ export const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientCo
|
|
|
54
59
|
: [],
|
|
55
60
|
defaultValue: [],
|
|
56
61
|
},
|
|
62
|
+
otelMinTraceDurationMs: {
|
|
63
|
+
env: 'OTEL_MIN_TRACE_DURATION_MS',
|
|
64
|
+
description: 'The minimum successful trace duration to export in milliseconds. Set to 0 to export all traces.',
|
|
65
|
+
...numberConfigHelper(10),
|
|
66
|
+
},
|
|
67
|
+
otelBspMaxQueueSize: {
|
|
68
|
+
env: 'OTEL_BSP_MAX_QUEUE_SIZE',
|
|
69
|
+
description: 'The maximum number of completed spans to queue before export.',
|
|
70
|
+
...numberConfigHelper(16384),
|
|
71
|
+
},
|
|
57
72
|
otelIncludeMetrics: {
|
|
58
73
|
env: 'OTEL_INCLUDE_METRICS',
|
|
59
74
|
description: 'A list of metric prefixes to include in export (ignored if OTEL_EXCLUDE_METRICS is set)',
|
|
@@ -70,7 +85,7 @@ export const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientCo
|
|
|
70
85
|
publicMetricsCollectorUrl: {
|
|
71
86
|
env: 'PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
|
|
72
87
|
description: 'A URL to publish a subset of metrics for public consumption',
|
|
73
|
-
parseEnv: (val: string) =>
|
|
88
|
+
parseEnv: (val: string) => new URL(val),
|
|
74
89
|
},
|
|
75
90
|
publicMetricsCollectFrom: {
|
|
76
91
|
env: 'PUBLIC_OTEL_COLLECT_FROM',
|
package/src/metric-utils.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { MetricOptions } from '@opentelemetry/api';
|
|
1
|
+
import type { AttributeValue, MetricOptions } from '@opentelemetry/api';
|
|
2
2
|
|
|
3
3
|
import type { MetricDefinition } from './metrics.js';
|
|
4
|
+
import type { AllowedAttributeNames, Meter, MetricAttributesType, UpDownCounter } from './telemetry.js';
|
|
4
5
|
|
|
5
6
|
/** Extracts OpenTelemetry MetricOptions from a MetricDefinition */
|
|
6
7
|
export function toMetricOptions(def: MetricDefinition): MetricOptions {
|
|
@@ -10,3 +11,65 @@ export function toMetricOptions(def: MetricDefinition): MetricOptions {
|
|
|
10
11
|
valueType: def.valueType,
|
|
11
12
|
};
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
/** A mapping of attribute keys to their possible values */
|
|
16
|
+
export type AttributeValuesMap = Partial<Record<AllowedAttributeNames, AttributeValue[]>>;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Expands an attribute values map into all combinations of attribute objects.
|
|
20
|
+
* Example: { status: ['ok', 'fail'], type: ['a', 'b'] } =>
|
|
21
|
+
* [{ status: 'ok', type: 'a' }, { status: 'ok', type: 'b' }, { status: 'fail', type: 'a' }, { status: 'fail', type: 'b' }]
|
|
22
|
+
*/
|
|
23
|
+
export function expandAttributeCombinations(attrMap: AttributeValuesMap): MetricAttributesType[] {
|
|
24
|
+
const keys = Object.keys(attrMap) as AllowedAttributeNames[];
|
|
25
|
+
if (keys.length === 0) {
|
|
26
|
+
return [{}];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const result: MetricAttributesType[] = [];
|
|
30
|
+
|
|
31
|
+
function generate(index: number, current: MetricAttributesType) {
|
|
32
|
+
if (index === keys.length) {
|
|
33
|
+
result.push({ ...current });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const key = keys[index];
|
|
37
|
+
for (const value of attrMap[key]!) {
|
|
38
|
+
current[key] = value;
|
|
39
|
+
generate(index + 1, current);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
generate(0, {});
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates an UpDownCounter and initializes it to 0.
|
|
49
|
+
* @param meter - The meter to create the counter on
|
|
50
|
+
* @param metric - The metric definition
|
|
51
|
+
* @param attributes - Optional attributes for initialization. Can be:
|
|
52
|
+
* - AttributeValuesMap: mapping of attribute keys to arrays of possible values (generates cartesian product)
|
|
53
|
+
* - MetricAttributesType[]: explicit array of attribute objects
|
|
54
|
+
* - undefined: initializes without attributes
|
|
55
|
+
*/
|
|
56
|
+
export function createUpDownCounterWithDefault(
|
|
57
|
+
meter: Meter,
|
|
58
|
+
metric: MetricDefinition,
|
|
59
|
+
attributes: AttributeValuesMap | MetricAttributesType[] | undefined = undefined,
|
|
60
|
+
): UpDownCounter {
|
|
61
|
+
const counter = meter.createUpDownCounter(metric);
|
|
62
|
+
if (attributes === undefined) {
|
|
63
|
+
counter.add(0);
|
|
64
|
+
} else if (Array.isArray(attributes)) {
|
|
65
|
+
for (const attrs of attributes) {
|
|
66
|
+
counter.add(0, attrs);
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
const combinations = expandAttributeCombinations(attributes);
|
|
70
|
+
for (const attrs of combinations) {
|
|
71
|
+
counter.add(0, attrs);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return counter;
|
|
75
|
+
}
|