@aztec/telemetry-client 5.0.0-private.20260319 → 5.0.0-rc.2
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 +5 -2
- package/dest/attributes.d.ts.map +1 -1
- package/dest/attributes.js +2 -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/metrics.d.ts +23 -4
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +120 -15
- 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/otel.d.ts +6 -1
- package/dest/otel.d.ts.map +1 -1
- package/dest/otel.js +73 -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/start.d.ts +1 -1
- package/dest/start.d.ts.map +1 -1
- package/dest/start.js +1 -1
- package/dest/telemetry.d.ts +2 -2
- package/dest/telemetry.d.ts.map +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 +4 -1
- package/src/config.ts +24 -9
- package/src/metrics.ts +125 -15
- package/src/monitored_batch_span_processor.ts +100 -0
- package/src/otel.ts +52 -3
- package/src/otel_propagation.ts +42 -1
- package/src/start.ts +6 -1
- package/src/telemetry.ts +0 -1
- 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,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AAEpF,OAAO,EAAE,KAAK,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAExF,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEjE,KAAK,cAAc,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC;AAElD;;;;;;GAMG;AACH,KAAK,0BAA0B,GAAG,CAAC,OAAO,UAAU,CAAC,CACjD,cAAc,GACd,eAAe,GACf,aAAa,GACb,cAAc,GACd,2BAA2B,GAC3B,iBAAiB,GACjB,YAAY,GACZ,YAAY,GACZ,cAAc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AAM,EACvB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GACnC,OAAO,CAAC,CAAC,CAAC,CAiBZ"}
|
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": "5.0.0-
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
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": "5.0.0-
|
|
31
|
-
"@aztec/stdlib": "5.0.0-
|
|
30
|
+
"@aztec/foundation": "5.0.0-rc.2",
|
|
31
|
+
"@aztec/stdlib": "5.0.0-rc.2",
|
|
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 */
|
|
@@ -94,7 +98,6 @@ export const VALIDATOR_STATUS = 'aztec.validator_status';
|
|
|
94
98
|
|
|
95
99
|
export const P2P_ID = 'aztec.p2p.id';
|
|
96
100
|
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
101
|
/** The state of a peer (Healthy, Disconnect, Banned) */
|
|
99
102
|
export const P2P_PEER_SCORE_STATE = 'aztec.p2p.peer_score_state';
|
|
100
103
|
export const POOL_NAME = 'aztec.pool.name';
|
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/metrics.ts
CHANGED
|
@@ -308,6 +308,12 @@ export const ARCHIVER_SYNC_PER_BLOCK: MetricDefinition = {
|
|
|
308
308
|
unit: 'ms',
|
|
309
309
|
valueType: ValueType.INT,
|
|
310
310
|
};
|
|
311
|
+
export const ARCHIVER_SYNC_PER_CHECKPOINT: MetricDefinition = {
|
|
312
|
+
name: 'aztec.archiver.checkpoint.sync_per_item_duration',
|
|
313
|
+
description: 'Duration to sync a checkpoint',
|
|
314
|
+
unit: 'ms',
|
|
315
|
+
valueType: ValueType.INT,
|
|
316
|
+
};
|
|
311
317
|
export const ARCHIVER_SYNC_BLOCK_COUNT: MetricDefinition = {
|
|
312
318
|
name: 'aztec.archiver.block.sync_count',
|
|
313
319
|
description: 'Number of blocks synced from L1',
|
|
@@ -357,6 +363,12 @@ export const ARCHIVER_CHECKPOINT_L1_INCLUSION_DELAY: MetricDefinition = {
|
|
|
357
363
|
valueType: ValueType.INT,
|
|
358
364
|
};
|
|
359
365
|
|
|
366
|
+
export const ARCHIVER_CHECKPOINT_PROMOTED_COUNT: MetricDefinition = {
|
|
367
|
+
name: 'aztec.archiver.checkpoint_promoted_count',
|
|
368
|
+
description: 'Number of checkpoints promoted from proposed (blob fetch skipped)',
|
|
369
|
+
valueType: ValueType.INT,
|
|
370
|
+
};
|
|
371
|
+
|
|
360
372
|
export const NODE_RECEIVE_TX_DURATION: MetricDefinition = {
|
|
361
373
|
name: 'aztec.node.receive_tx.duration',
|
|
362
374
|
description: 'The duration of the receiveTx method',
|
|
@@ -388,6 +400,12 @@ export const SEQUENCER_STATE_TRANSITION_BUFFER_DURATION: MetricDefinition = {
|
|
|
388
400
|
unit: 'ms',
|
|
389
401
|
valueType: ValueType.INT,
|
|
390
402
|
};
|
|
403
|
+
export const SEQUENCER_STATE_DURATION: MetricDefinition = {
|
|
404
|
+
name: 'aztec.sequencer.state_duration',
|
|
405
|
+
description: 'Wall-clock time spent in each sequencer state, labelled by the state being left',
|
|
406
|
+
unit: 'ms',
|
|
407
|
+
valueType: ValueType.INT,
|
|
408
|
+
};
|
|
391
409
|
export const SEQUENCER_BLOCK_BUILD_DURATION: MetricDefinition = {
|
|
392
410
|
name: 'aztec.sequencer.block.build_duration',
|
|
393
411
|
description: 'Duration to build a block',
|
|
@@ -405,6 +423,12 @@ export const SEQUENCER_BLOCK_COUNT: MetricDefinition = {
|
|
|
405
423
|
description: 'Number of blocks built by this sequencer',
|
|
406
424
|
valueType: ValueType.INT,
|
|
407
425
|
};
|
|
426
|
+
export const SEQUENCER_BLOCK_INTER_BLOCK_TIME: MetricDefinition = {
|
|
427
|
+
name: 'aztec.sequencer.block.inter_block_time',
|
|
428
|
+
description: 'Wall-clock time elapsed between consecutive blocks being built by this sequencer',
|
|
429
|
+
unit: 'ms',
|
|
430
|
+
valueType: ValueType.INT,
|
|
431
|
+
};
|
|
408
432
|
export const SEQUENCER_CURRENT_SLOT_REWARDS: MetricDefinition = {
|
|
409
433
|
name: 'aztec.sequencer.current_slot_rewards',
|
|
410
434
|
description: 'The rewards earned per filled slot',
|
|
@@ -477,6 +501,25 @@ export const SEQUENCER_CHECKPOINT_BUILD_DURATION: MetricDefinition = {
|
|
|
477
501
|
unit: 'ms',
|
|
478
502
|
valueType: ValueType.INT,
|
|
479
503
|
};
|
|
504
|
+
export const SEQUENCER_CHECKPOINT_START_TO_FIRST_BLOCK_DURATION: MetricDefinition = {
|
|
505
|
+
name: 'aztec.sequencer.checkpoint.start_to_first_block_duration',
|
|
506
|
+
description: 'Time from starting checkpoint work to the first block finishing build',
|
|
507
|
+
unit: 'ms',
|
|
508
|
+
valueType: ValueType.INT,
|
|
509
|
+
};
|
|
510
|
+
export const SEQUENCER_CHECKPOINT_LAST_BLOCK_TO_BROADCAST_DURATION: MetricDefinition = {
|
|
511
|
+
name: 'aztec.sequencer.checkpoint.last_block_to_broadcast_duration',
|
|
512
|
+
description: 'Time from the final block finishing build to the checkpoint proposal being broadcast',
|
|
513
|
+
unit: 'ms',
|
|
514
|
+
valueType: ValueType.INT,
|
|
515
|
+
};
|
|
516
|
+
export const SEQUENCER_PIPELINED_CHECKPOINT_BUILD_START_OFFSET_FROM_SLOT_BOUNDARY: MetricDefinition = {
|
|
517
|
+
name: 'aztec.sequencer.pipelined_checkpoint.build_start_offset_from_slot_boundary',
|
|
518
|
+
description:
|
|
519
|
+
'Absolute offset from the wall-clock slot boundary when a pipelined checkpoint build starts. Use aztec.slot_boundary_side to distinguish before vs after the boundary.',
|
|
520
|
+
unit: 'ms',
|
|
521
|
+
valueType: ValueType.INT,
|
|
522
|
+
};
|
|
480
523
|
export const SEQUENCER_CHECKPOINT_BLOCK_COUNT: MetricDefinition = {
|
|
481
524
|
name: 'aztec.sequencer.checkpoint.block_count',
|
|
482
525
|
description: 'Number of blocks built in a checkpoint',
|
|
@@ -499,6 +542,11 @@ export const SEQUENCER_SLASHING_ATTEMPTS_COUNT: MetricDefinition = {
|
|
|
499
542
|
description: 'The number of slashing action attempts',
|
|
500
543
|
valueType: ValueType.INT,
|
|
501
544
|
};
|
|
545
|
+
export const SLASHER_ROUND_EXECUTED_COUNT: MetricDefinition = {
|
|
546
|
+
name: 'aztec.slasher.round.executed_count',
|
|
547
|
+
description: 'The number of slashing rounds executed',
|
|
548
|
+
valueType: ValueType.INT,
|
|
549
|
+
};
|
|
502
550
|
export const SEQUENCER_CHECKPOINT_SUCCESS_COUNT: MetricDefinition = {
|
|
503
551
|
name: 'aztec.sequencer.checkpoint.success_count',
|
|
504
552
|
description: 'The number of times checkpoint publishing succeeded',
|
|
@@ -514,6 +562,11 @@ export const SEQUENCER_PIPELINE_DISCARDS_COUNT: MetricDefinition = {
|
|
|
514
562
|
description: 'The number of times a pipeline was discarded',
|
|
515
563
|
valueType: ValueType.INT,
|
|
516
564
|
};
|
|
565
|
+
export const SEQUENCER_PIPELINE_PARENT_CHECKPOINT_MISMATCH_COUNT: MetricDefinition = {
|
|
566
|
+
name: 'aztec.sequencer.pipeline.parent_checkpoint_mismatch_count',
|
|
567
|
+
description: 'The number of times a pipelined checkpoint was discarded because the parent did not match expectations',
|
|
568
|
+
valueType: ValueType.INT,
|
|
569
|
+
};
|
|
517
570
|
|
|
518
571
|
// Fisherman fee analysis metrics
|
|
519
572
|
export const FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED: MetricDefinition = {
|
|
@@ -681,6 +734,24 @@ export const L1_PUBLISHER_TX_TOTAL_FEE: MetricDefinition = {
|
|
|
681
734
|
unit: 'eth',
|
|
682
735
|
valueType: ValueType.DOUBLE,
|
|
683
736
|
};
|
|
737
|
+
export const PROVER_NODE_ESTIMATED_SUBMISSION_GAS: MetricDefinition = {
|
|
738
|
+
name: 'aztec.prover_node.estimated_submission.gas',
|
|
739
|
+
description: 'Estimated gas for a proof submission tx (proof publishing disabled, not actually sent)',
|
|
740
|
+
unit: 'gas',
|
|
741
|
+
valueType: ValueType.INT,
|
|
742
|
+
};
|
|
743
|
+
export const PROVER_NODE_ESTIMATED_SUBMISSION_GAS_PRICE: MetricDefinition = {
|
|
744
|
+
name: 'aztec.prover_node.estimated_submission.gas_price',
|
|
745
|
+
description: 'Estimated effective gas price for a proof submission tx (proof publishing disabled, not actually sent)',
|
|
746
|
+
unit: 'gwei',
|
|
747
|
+
valueType: ValueType.DOUBLE,
|
|
748
|
+
};
|
|
749
|
+
export const PROVER_NODE_ESTIMATED_SUBMISSION_TOTAL_FEE: MetricDefinition = {
|
|
750
|
+
name: 'aztec.prover_node.estimated_submission.total_fee',
|
|
751
|
+
description: 'Estimated total L1 fee for a proof submission tx (proof publishing disabled, not actually sent)',
|
|
752
|
+
unit: 'eth',
|
|
753
|
+
valueType: ValueType.DOUBLE,
|
|
754
|
+
};
|
|
684
755
|
|
|
685
756
|
export const L1_BLOCK_HEIGHT: MetricDefinition = {
|
|
686
757
|
name: 'aztec.l1.block_height',
|
|
@@ -909,6 +980,12 @@ export const P2P_GOSSIP_AGG_MESSAGE_VALIDATION_DURATION_AVG: MetricDefinition =
|
|
|
909
980
|
valueType: ValueType.INT,
|
|
910
981
|
};
|
|
911
982
|
|
|
983
|
+
export const P2P_GOSSIP_SLOW_VALIDATION_COUNT: MetricDefinition = {
|
|
984
|
+
name: 'aztec.p2p.gossip.slow_validation_count',
|
|
985
|
+
description: 'Number of gossip validations that exceeded 75% of the mcache eviction window',
|
|
986
|
+
valueType: ValueType.INT,
|
|
987
|
+
};
|
|
988
|
+
|
|
912
989
|
export const PUBLIC_PROCESSOR_TX_DURATION: MetricDefinition = {
|
|
913
990
|
name: 'aztec.public_processor.tx_duration',
|
|
914
991
|
description: 'Duration to process a public transaction',
|
|
@@ -972,6 +1049,17 @@ export const PUBLIC_PROCESSOR_TREE_INSERTION: MetricDefinition = {
|
|
|
972
1049
|
unit: 'ms',
|
|
973
1050
|
valueType: ValueType.INT,
|
|
974
1051
|
};
|
|
1052
|
+
export const PUBLIC_PROCESSOR_SILENTLY_SKIPPED_COUNT: MetricDefinition = {
|
|
1053
|
+
name: 'aztec.public_processor.silently_skipped_count',
|
|
1054
|
+
description: 'Public txs fully processed then skipped (e.g. blob-field limit); not counted as processed or failed',
|
|
1055
|
+
valueType: ValueType.INT,
|
|
1056
|
+
};
|
|
1057
|
+
export const PUBLIC_PROCESSOR_SILENTLY_SKIPPED_DURATION: MetricDefinition = {
|
|
1058
|
+
name: 'aztec.public_processor.silently_skipped_duration',
|
|
1059
|
+
description: 'Wall-clock time spent processing txs that were then silently skipped',
|
|
1060
|
+
unit: 'ms',
|
|
1061
|
+
valueType: ValueType.INT,
|
|
1062
|
+
};
|
|
975
1063
|
|
|
976
1064
|
export const PUBLIC_EXECUTOR_PREFIX = 'aztec.public_executor.';
|
|
977
1065
|
export const PUBLIC_EXECUTOR_SIMULATION_COUNT: MetricDefinition = {
|
|
@@ -1116,12 +1204,6 @@ export const PROVING_AGENT_IDLE: MetricDefinition = {
|
|
|
1116
1204
|
valueType: ValueType.DOUBLE,
|
|
1117
1205
|
};
|
|
1118
1206
|
|
|
1119
|
-
export const PROVER_NODE_EXECUTION_DURATION: MetricDefinition = {
|
|
1120
|
-
name: 'aztec.prover_node.execution.duration',
|
|
1121
|
-
description: 'Duration of execution of an epoch by the prover',
|
|
1122
|
-
unit: 'ms',
|
|
1123
|
-
valueType: ValueType.INT,
|
|
1124
|
-
};
|
|
1125
1207
|
export const PROVER_NODE_JOB_DURATION: MetricDefinition = {
|
|
1126
1208
|
name: 'aztec.prover_node.job_duration',
|
|
1127
1209
|
description: 'Duration of proving job',
|
|
@@ -1149,12 +1231,6 @@ export const PROVER_NODE_BLOB_PROCESSING_LAST_DURATION: MetricDefinition = {
|
|
|
1149
1231
|
unit: 'ms',
|
|
1150
1232
|
valueType: ValueType.INT,
|
|
1151
1233
|
};
|
|
1152
|
-
export const PROVER_NODE_CHONK_VERIFIER_LAST_DURATION: MetricDefinition = {
|
|
1153
|
-
name: 'aztec.prover_node.chonk_verifier.last_duration',
|
|
1154
|
-
description: 'Duration of chonk verifier enqueuing in epoch proving job',
|
|
1155
|
-
unit: 'ms',
|
|
1156
|
-
valueType: ValueType.INT,
|
|
1157
|
-
};
|
|
1158
1234
|
export const PROVER_NODE_BLOCK_PROCESSING_DURATION: MetricDefinition = {
|
|
1159
1235
|
name: 'aztec.prover_node.block_processing.duration',
|
|
1160
1236
|
description: 'Duration of processing a single block in epoch proving job',
|
|
@@ -1167,12 +1243,33 @@ export const PROVER_NODE_CHECKPOINT_PROCESSING_DURATION: MetricDefinition = {
|
|
|
1167
1243
|
unit: 'ms',
|
|
1168
1244
|
valueType: ValueType.INT,
|
|
1169
1245
|
};
|
|
1170
|
-
export const
|
|
1171
|
-
name: 'aztec.prover_node.
|
|
1172
|
-
description: '
|
|
1246
|
+
export const PROVER_NODE_CHECKPOINT_BLOCKS: MetricDefinition = {
|
|
1247
|
+
name: 'aztec.prover_node.checkpoint_blocks',
|
|
1248
|
+
description: 'Number of blocks in a proven checkpoint',
|
|
1249
|
+
valueType: ValueType.INT,
|
|
1250
|
+
};
|
|
1251
|
+
export const PROVER_NODE_CHECKPOINT_TRANSACTIONS: MetricDefinition = {
|
|
1252
|
+
name: 'aztec.prover_node.checkpoint_transactions',
|
|
1253
|
+
description: 'Number of transactions in a proven checkpoint',
|
|
1254
|
+
valueType: ValueType.INT,
|
|
1255
|
+
};
|
|
1256
|
+
export const PROVER_NODE_CHECKPOINT_PROVING_DURATION: MetricDefinition = {
|
|
1257
|
+
name: 'aztec.prover_node.checkpoint_proving.duration',
|
|
1258
|
+
description:
|
|
1259
|
+
'Duration from the start of checkpoint processing to its block proofs being ready (excludes tx gathering)',
|
|
1173
1260
|
unit: 'ms',
|
|
1174
1261
|
valueType: ValueType.INT,
|
|
1175
1262
|
};
|
|
1263
|
+
export const PROVER_NODE_ACTIVE_CHECKPOINTS: MetricDefinition = {
|
|
1264
|
+
name: 'aztec.prover_node.active_checkpoints',
|
|
1265
|
+
description: 'Current number of canonical CheckpointProvers in the store (i.e. checkpoints currently being proven)',
|
|
1266
|
+
valueType: ValueType.INT,
|
|
1267
|
+
};
|
|
1268
|
+
export const PROVER_NODE_ACTIVE_EPOCH_SESSIONS: MetricDefinition = {
|
|
1269
|
+
name: 'aztec.prover_node.active_epoch_sessions',
|
|
1270
|
+
description: 'Current number of live EpochSessions, broken down by kind (full|partial)',
|
|
1271
|
+
valueType: ValueType.INT,
|
|
1272
|
+
};
|
|
1176
1273
|
export const PROVER_NODE_REWARDS_TOTAL: MetricDefinition = {
|
|
1177
1274
|
name: 'aztec.prover_node.rewards_total',
|
|
1178
1275
|
description: 'The rewards earned (total)',
|
|
@@ -1286,6 +1383,19 @@ export const VALIDATOR_RE_EXECUTION_TX_COUNT: MetricDefinition = {
|
|
|
1286
1383
|
unit: 'tx',
|
|
1287
1384
|
valueType: ValueType.INT,
|
|
1288
1385
|
};
|
|
1386
|
+
export const VALIDATOR_CHECKPOINT_PROPOSAL_TO_PIPELINED_STATE_DURATION: MetricDefinition = {
|
|
1387
|
+
name: 'aztec.validator.checkpoint_proposal_to_pipelined_state_duration',
|
|
1388
|
+
description: 'Time from receiving a checkpoint proposal to setting proposed checkpoint state for pipelining',
|
|
1389
|
+
unit: 'ms',
|
|
1390
|
+
valueType: ValueType.INT,
|
|
1391
|
+
};
|
|
1392
|
+
export const VALIDATOR_CHECKPOINT_PROPOSAL_RECEIVE_OFFSET_FROM_NEXT_SLOT_BOUNDARY: MetricDefinition = {
|
|
1393
|
+
name: 'aztec.validator.checkpoint.proposal_receive_offset_from_next_slot_boundary',
|
|
1394
|
+
description:
|
|
1395
|
+
'Absolute offset from the next slot boundary when a foreign checkpoint proposal is received. Use aztec.slot_boundary_side to distinguish before vs after the boundary.',
|
|
1396
|
+
unit: 'ms',
|
|
1397
|
+
valueType: ValueType.INT,
|
|
1398
|
+
};
|
|
1289
1399
|
|
|
1290
1400
|
export const VALIDATOR_FAILED_REEXECUTION_COUNT: MetricDefinition = {
|
|
1291
1401
|
name: 'aztec.validator.failed_reexecution_count',
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Logger } from '@aztec/foundation/log';
|
|
2
|
+
|
|
3
|
+
import { type Context, SpanStatusCode } from '@opentelemetry/api';
|
|
4
|
+
import { hrTimeToMilliseconds } from '@opentelemetry/core';
|
|
5
|
+
import type { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
6
|
+
import { BatchSpanProcessor, type BufferConfig, type ReadableSpan, type Span } from '@opentelemetry/sdk-trace-node';
|
|
7
|
+
|
|
8
|
+
/** Minimum interval between drop warnings to avoid log spam. */
|
|
9
|
+
const DROP_WARNING_INTERVAL_MS = 30_000;
|
|
10
|
+
|
|
11
|
+
const DEFAULT_MIN_TRACE_DURATION_MS = 10;
|
|
12
|
+
|
|
13
|
+
const DEFAULT_MAX_QUEUE_SIZE = 16384;
|
|
14
|
+
|
|
15
|
+
/** Cap on the per-export batch size, so a large queue can actually be drained instead of dribbling out
|
|
16
|
+
* at the SDK default of 512 spans per scheduled export. Kept <= maxQueueSize per the BatchSpanProcessor contract. */
|
|
17
|
+
const DEFAULT_MAX_EXPORT_BATCH_SIZE = 2048;
|
|
18
|
+
|
|
19
|
+
export type MonitoredBatchSpanProcessorConfig = BufferConfig & {
|
|
20
|
+
minTraceDurationMs?: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Wraps BatchSpanProcessor to emit warnings when spans are dropped due to a full queue.
|
|
25
|
+
* The standard BatchSpanProcessor silently discards spans when its internal queue reaches
|
|
26
|
+
* maxQueueSize, making telemetry data loss invisible to operators.
|
|
27
|
+
*/
|
|
28
|
+
export class MonitoredBatchSpanProcessor extends BatchSpanProcessor {
|
|
29
|
+
private readonly maxQueueSize: number;
|
|
30
|
+
private readonly minTraceDurationMs: number;
|
|
31
|
+
private readonly log: Logger;
|
|
32
|
+
|
|
33
|
+
private approxQueueSize = 0;
|
|
34
|
+
private droppedSinceLastWarning = 0;
|
|
35
|
+
private totalDropped = 0;
|
|
36
|
+
private lastWarningTime = 0;
|
|
37
|
+
|
|
38
|
+
constructor(exporter: SpanExporter, log: Logger, config?: MonitoredBatchSpanProcessorConfig) {
|
|
39
|
+
const maxQueueSize = config?.maxQueueSize ?? DEFAULT_MAX_QUEUE_SIZE;
|
|
40
|
+
const maxExportBatchSize = Math.min(config?.maxExportBatchSize ?? DEFAULT_MAX_EXPORT_BATCH_SIZE, maxQueueSize);
|
|
41
|
+
super(exporter, { ...config, maxQueueSize, maxExportBatchSize });
|
|
42
|
+
this.maxQueueSize = maxQueueSize;
|
|
43
|
+
this.minTraceDurationMs = Math.max(0, config?.minTraceDurationMs ?? DEFAULT_MIN_TRACE_DURATION_MS);
|
|
44
|
+
this.log = log;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
override onStart(span: Span, parentContext: Context): void {
|
|
48
|
+
super.onStart(span, parentContext);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
override onEnd(span: ReadableSpan): void {
|
|
52
|
+
if (this.shouldDropShortSpan(span)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (this.approxQueueSize >= this.maxQueueSize) {
|
|
57
|
+
this.droppedSinceLastWarning++;
|
|
58
|
+
this.totalDropped++;
|
|
59
|
+
this.maybeLogDropWarning();
|
|
60
|
+
} else {
|
|
61
|
+
this.approxQueueSize++;
|
|
62
|
+
}
|
|
63
|
+
super.onEnd(span);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
override async forceFlush(): Promise<void> {
|
|
67
|
+
await super.forceFlush();
|
|
68
|
+
this.approxQueueSize = 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
override async shutdown(): Promise<void> {
|
|
72
|
+
if (this.totalDropped > 0) {
|
|
73
|
+
this.log.warn(`BatchSpanProcessor shutting down with ${this.totalDropped} total spans dropped`, {
|
|
74
|
+
totalDropped: this.totalDropped,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
await super.shutdown();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
private shouldDropShortSpan(span: ReadableSpan): boolean {
|
|
81
|
+
return (
|
|
82
|
+
this.minTraceDurationMs > 0 &&
|
|
83
|
+
span.status.code !== SpanStatusCode.ERROR &&
|
|
84
|
+
hrTimeToMilliseconds(span.duration) < this.minTraceDurationMs
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private maybeLogDropWarning(): void {
|
|
89
|
+
const now = Date.now();
|
|
90
|
+
if (now - this.lastWarningTime >= DROP_WARNING_INTERVAL_MS) {
|
|
91
|
+
this.log.warn(
|
|
92
|
+
`BatchSpanProcessor dropping spans: queue full (maxQueueSize=${this.maxQueueSize}). ` +
|
|
93
|
+
`${this.droppedSinceLastWarning} dropped since last warning, ${this.totalDropped} total.`,
|
|
94
|
+
{ droppedSinceLastWarning: this.droppedSinceLastWarning, totalDropped: this.totalDropped },
|
|
95
|
+
);
|
|
96
|
+
this.droppedSinceLastWarning = 0;
|
|
97
|
+
this.lastWarningTime = now;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
package/src/otel.ts
CHANGED
|
@@ -28,12 +28,13 @@ import {
|
|
|
28
28
|
type PeriodicExportingMetricReaderOptions,
|
|
29
29
|
View,
|
|
30
30
|
} from '@opentelemetry/sdk-metrics';
|
|
31
|
-
import {
|
|
31
|
+
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
32
32
|
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
|
|
33
33
|
|
|
34
34
|
import type { TelemetryClientConfig } from './config.js';
|
|
35
35
|
import { toMetricOptions } from './metric-utils.js';
|
|
36
36
|
import type { MetricDefinition } from './metrics.js';
|
|
37
|
+
import { MonitoredBatchSpanProcessor } from './monitored_batch_span_processor.js';
|
|
37
38
|
import { NodejsMetricsMonitor } from './nodejs_metrics_monitor.js';
|
|
38
39
|
import { OtelFilterMetricExporter, PublicOtelFilterMetricExporter } from './otel_filter_metric_exporter.js';
|
|
39
40
|
import { registerOtelLoggerProvider } from './otel_logger_provider.js';
|
|
@@ -95,6 +96,11 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
95
96
|
private meters: Map<string, WrappedMeter> = new Map<string, WrappedMeter>();
|
|
96
97
|
private tracers: Map<string, Tracer> = new Map<string, Tracer>();
|
|
97
98
|
|
|
99
|
+
/** Memoized shutdown promise. The telemetry client is shared between the aztec-node and an embedded prover-node,
|
|
100
|
+
* so stop() can be invoked more than once; the providers throw "shutdown may only be called once" and
|
|
101
|
+
* "invalid attempt to force flush after shutdown" if that happens. Guarding here makes stop()/flush() idempotent. */
|
|
102
|
+
private stopPromise: Promise<void> | undefined;
|
|
103
|
+
|
|
98
104
|
protected constructor(
|
|
99
105
|
private resource: IResource,
|
|
100
106
|
private meterProvider: MeterProvider,
|
|
@@ -168,6 +174,10 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
168
174
|
}
|
|
169
175
|
|
|
170
176
|
public async flush() {
|
|
177
|
+
// Flushing after the providers have been shut down throws "invalid attempt to force flush after shutdown".
|
|
178
|
+
if (this.stopPromise) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
171
181
|
await Promise.all([
|
|
172
182
|
this.meterProvider.forceFlush(),
|
|
173
183
|
this.loggerProvider?.forceFlush(),
|
|
@@ -175,7 +185,11 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
175
185
|
]);
|
|
176
186
|
}
|
|
177
187
|
|
|
178
|
-
public
|
|
188
|
+
public stop() {
|
|
189
|
+
return (this.stopPromise ??= this.doStop());
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private async doStop() {
|
|
179
193
|
this.nodejsMetricsMonitor?.stop();
|
|
180
194
|
|
|
181
195
|
const flushAndShutdown = async (provider?: { forceFlush: () => Promise<void>; shutdown: () => Promise<void> }) => {
|
|
@@ -334,6 +348,36 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
334
348
|
true,
|
|
335
349
|
),
|
|
336
350
|
}),
|
|
351
|
+
// L1 gas prices in gwei: priority fees ~0.01-10, base fees ~1-500, spikes to 1000+
|
|
352
|
+
new View({
|
|
353
|
+
instrumentType: InstrumentType.HISTOGRAM,
|
|
354
|
+
instrumentUnit: 'gwei',
|
|
355
|
+
aggregation: new ExplicitBucketHistogramAggregation(
|
|
356
|
+
[0.1, 0.5, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1_000],
|
|
357
|
+
true,
|
|
358
|
+
),
|
|
359
|
+
}),
|
|
360
|
+
// L1 gas consumption: tx gas 100k-30M, calldata/blob gas varies
|
|
361
|
+
new View({
|
|
362
|
+
instrumentType: InstrumentType.HISTOGRAM,
|
|
363
|
+
instrumentUnit: 'gas',
|
|
364
|
+
aggregation: new ExplicitBucketHistogramAggregation(
|
|
365
|
+
[
|
|
366
|
+
10_000, 50_000, 100_000, 250_000, 500_000, 1_000_000, 2_000_000, 5_000_000, 10_000_000, 15_000_000,
|
|
367
|
+
30_000_000,
|
|
368
|
+
],
|
|
369
|
+
true,
|
|
370
|
+
),
|
|
371
|
+
}),
|
|
372
|
+
// L1 tx total fee in ETH: typically 0.001 - 1 ETH
|
|
373
|
+
new View({
|
|
374
|
+
instrumentType: InstrumentType.HISTOGRAM,
|
|
375
|
+
instrumentUnit: 'eth',
|
|
376
|
+
aggregation: new ExplicitBucketHistogramAggregation(
|
|
377
|
+
[0.0001, 0.0005, 0.001, 0.005, 0.01, 0.05, 0.1, 0.5, 1, 5, 10],
|
|
378
|
+
true,
|
|
379
|
+
),
|
|
380
|
+
}),
|
|
337
381
|
],
|
|
338
382
|
});
|
|
339
383
|
}
|
|
@@ -343,7 +387,12 @@ export class OpenTelemetryClient implements TelemetryClient {
|
|
|
343
387
|
const tracerProvider = new NodeTracerProvider({
|
|
344
388
|
resource,
|
|
345
389
|
spanProcessors: config.tracesCollectorUrl
|
|
346
|
-
? [
|
|
390
|
+
? [
|
|
391
|
+
new MonitoredBatchSpanProcessor(new OTLPTraceExporter({ url: config.tracesCollectorUrl.href }), log, {
|
|
392
|
+
maxQueueSize: config.otelBspMaxQueueSize,
|
|
393
|
+
minTraceDurationMs: config.otelMinTraceDurationMs,
|
|
394
|
+
}),
|
|
395
|
+
]
|
|
347
396
|
: [],
|
|
348
397
|
});
|
|
349
398
|
|