@aztec/telemetry-client 0.0.0-test.0
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 +99 -0
- package/dest/attributes.d.ts.map +1 -0
- package/dest/attributes.js +67 -0
- package/dest/bench.d.ts +29 -0
- package/dest/bench.d.ts.map +1 -0
- package/dest/bench.js +98 -0
- package/dest/config.d.ts +12 -0
- package/dest/config.d.ts.map +1 -0
- package/dest/config.js +39 -0
- package/dest/event_loop_monitor.d.ts +18 -0
- package/dest/event_loop_monitor.d.ts.map +1 -0
- package/dest/event_loop_monitor.js +93 -0
- package/dest/index.d.ts +10 -0
- package/dest/index.d.ts.map +1 -0
- package/dest/index.js +9 -0
- package/dest/lmdb_metrics.d.ts +16 -0
- package/dest/lmdb_metrics.d.ts.map +1 -0
- package/dest/lmdb_metrics.js +42 -0
- package/dest/metrics.d.ts +129 -0
- package/dest/metrics.d.ts.map +1 -0
- package/dest/metrics.js +126 -0
- package/dest/noop.d.ts +14 -0
- package/dest/noop.d.ts.map +1 -0
- package/dest/noop.js +71 -0
- package/dest/otel.d.ts +32 -0
- package/dest/otel.d.ts.map +1 -0
- package/dest/otel.js +319 -0
- package/dest/otel_filter_metric_exporter.d.ts +12 -0
- package/dest/otel_filter_metric_exporter.d.ts.map +1 -0
- package/dest/otel_filter_metric_exporter.js +33 -0
- package/dest/otel_logger_provider.d.ts +4 -0
- package/dest/otel_logger_provider.d.ts.map +1 -0
- package/dest/otel_logger_provider.js +25 -0
- package/dest/otel_propagation.d.ts +3 -0
- package/dest/otel_propagation.d.ts.map +1 -0
- package/dest/otel_propagation.js +44 -0
- package/dest/otel_resource.d.ts +3 -0
- package/dest/otel_resource.d.ts.map +1 -0
- package/dest/otel_resource.js +12 -0
- package/dest/prom_otel_adapter.d.ts +127 -0
- package/dest/prom_otel_adapter.d.ts.map +1 -0
- package/dest/prom_otel_adapter.js +183 -0
- package/dest/start.d.ts +6 -0
- package/dest/start.d.ts.map +1 -0
- package/dest/start.js +24 -0
- package/dest/telemetry.d.ts +118 -0
- package/dest/telemetry.d.ts.map +1 -0
- package/dest/telemetry.js +116 -0
- package/dest/vendor/attributes.d.ts +5 -0
- package/dest/vendor/attributes.d.ts.map +1 -0
- package/dest/vendor/attributes.js +5 -0
- package/dest/vendor/otel-pino-stream.d.ts +41 -0
- package/dest/vendor/otel-pino-stream.d.ts.map +1 -0
- package/dest/vendor/otel-pino-stream.js +229 -0
- package/dest/with_tracer.d.ts +33 -0
- package/dest/with_tracer.d.ts.map +1 -0
- package/dest/with_tracer.js +32 -0
- package/dest/wrappers/fetch.d.ts +16 -0
- package/dest/wrappers/fetch.d.ts.map +1 -0
- package/dest/wrappers/fetch.js +39 -0
- package/dest/wrappers/index.d.ts +4 -0
- package/dest/wrappers/index.d.ts.map +1 -0
- package/dest/wrappers/index.js +3 -0
- package/dest/wrappers/json_rpc_server.d.ts +4 -0
- package/dest/wrappers/json_rpc_server.d.ts.map +1 -0
- package/dest/wrappers/json_rpc_server.js +11 -0
- package/dest/wrappers/l2_block_stream.d.ts +15 -0
- package/dest/wrappers/l2_block_stream.d.ts.map +1 -0
- package/dest/wrappers/l2_block_stream.js +26 -0
- package/package.json +89 -0
- package/src/attributes.ts +115 -0
- package/src/bench.ts +147 -0
- package/src/config.ts +56 -0
- package/src/event_loop_monitor.ts +119 -0
- package/src/index.ts +9 -0
- package/src/lmdb_metrics.ts +45 -0
- package/src/metrics.ts +153 -0
- package/src/noop.ts +91 -0
- package/src/otel.ts +286 -0
- package/src/otel_filter_metric_exporter.ts +38 -0
- package/src/otel_logger_provider.ts +31 -0
- package/src/otel_propagation.ts +50 -0
- package/src/otel_resource.ts +16 -0
- package/src/prom_otel_adapter.ts +326 -0
- package/src/start.ts +33 -0
- package/src/telemetry.ts +267 -0
- package/src/vendor/attributes.ts +5 -0
- package/src/vendor/otel-pino-stream.ts +282 -0
- package/src/with_tracer.ts +35 -0
- package/src/wrappers/fetch.ts +52 -0
- package/src/wrappers/index.ts +3 -0
- package/src/wrappers/json_rpc_server.ts +15 -0
- package/src/wrappers/l2_block_stream.ts +37 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview This file contains the custom attributes used in telemetry events.
|
|
3
|
+
* Attribute names exist in a global namespace, alongside metric names. Use this file to ensure that attribute names are unique.
|
|
4
|
+
*
|
|
5
|
+
* To define a new attribute follow these steps:
|
|
6
|
+
* 1. Make sure it's not a semantic attribute that's already been defined by {@link @opentelemetry/semantic-conventions | OpenTelemetry} (e.g. `service.name`)
|
|
7
|
+
* 2. Come up with a unique name for it so that it doesn't clash with other attributes or metrics.
|
|
8
|
+
* 3. Prefix the attribute name with `aztec` to make it clear that it's a custom attribute.
|
|
9
|
+
* 4. Add a description of what the attribute represents and examples of what it might contain.
|
|
10
|
+
* 5. Start using it.
|
|
11
|
+
*
|
|
12
|
+
* @note Attributes and metric names exist in a hierarchy of namespaces. If a name has been used as a namespace, then it can not be used as a name for an attribute or metric.
|
|
13
|
+
* @example If `aztec.circuit.name` has been defined as an attribute then `aztec.circuit` alone can not be re-used for a metric or attribute because it is already a namespace.
|
|
14
|
+
* @see {@link https://opentelemetry.io/docs/specs/semconv/general/attribute-naming/}
|
|
15
|
+
*/
|
|
16
|
+
/** The Aztec network identifier */
|
|
17
|
+
export declare const NETWORK_NAME = "aztec.network_name";
|
|
18
|
+
/**
|
|
19
|
+
* The name of the protocol circuit being run (e.g. public-kernel-setup or base-rollup)
|
|
20
|
+
* @see {@link @aztec/stdlib/stats:CircuitName}
|
|
21
|
+
*/
|
|
22
|
+
export declare const PROTOCOL_CIRCUIT_NAME = "aztec.circuit.protocol_circuit_name";
|
|
23
|
+
/**
|
|
24
|
+
* The type of protocol circuit being run: server or client
|
|
25
|
+
*/
|
|
26
|
+
export declare const PROTOCOL_CIRCUIT_TYPE = "aztec.circuit.protocol_circuit_type";
|
|
27
|
+
/**
|
|
28
|
+
* For an app circuit, the contract:function being run (e.g. Token:transfer)
|
|
29
|
+
*/
|
|
30
|
+
export declare const APP_CIRCUIT_NAME = "aztec.circuit.app_circuit_name";
|
|
31
|
+
/**
|
|
32
|
+
* The type of app circuit being run: server or client
|
|
33
|
+
*/
|
|
34
|
+
export declare const APP_CIRCUIT_TYPE = "aztec.circuit.app_circuit_type";
|
|
35
|
+
/** The block archive */
|
|
36
|
+
export declare const BLOCK_ARCHIVE = "aztec.block.archive";
|
|
37
|
+
/** The block number */
|
|
38
|
+
export declare const BLOCK_NUMBER = "aztec.block.number";
|
|
39
|
+
/** The slot number */
|
|
40
|
+
export declare const SLOT_NUMBER = "aztec.slot.number";
|
|
41
|
+
/** The parent's block number */
|
|
42
|
+
export declare const BLOCK_PARENT = "aztec.block.parent";
|
|
43
|
+
/** How many txs are being processed to build this block */
|
|
44
|
+
export declare const BLOCK_CANDIDATE_TXS_COUNT = "aztec.block.candidate_txs_count";
|
|
45
|
+
/** How many actual txs were included in this block */
|
|
46
|
+
export declare const BLOCK_TXS_COUNT = "aztec.block.txs_count";
|
|
47
|
+
/** The block size */
|
|
48
|
+
export declare const BLOCK_SIZE = "aztec.block.size";
|
|
49
|
+
/** How many blocks are included in this epoch */
|
|
50
|
+
export declare const EPOCH_SIZE = "aztec.epoch.size";
|
|
51
|
+
/** The proposer of a block */
|
|
52
|
+
export declare const BLOCK_PROPOSER = "aztec.block.proposer";
|
|
53
|
+
/** The epoch number */
|
|
54
|
+
export declare const EPOCH_NUMBER = "aztec.epoch.number";
|
|
55
|
+
/** The tx hash */
|
|
56
|
+
export declare const TX_HASH = "aztec.tx.hash";
|
|
57
|
+
/** Generic attribute representing whether the action was successful or not */
|
|
58
|
+
export declare const OK = "aztec.ok";
|
|
59
|
+
/** Generic status attribute */
|
|
60
|
+
export declare const STATUS = "aztec.status";
|
|
61
|
+
/** Generic error type attribute */
|
|
62
|
+
export declare const ERROR_TYPE = "aztec.error_type";
|
|
63
|
+
/** The type of the transaction */
|
|
64
|
+
export declare const L1_TX_TYPE = "aztec.l1.tx_type";
|
|
65
|
+
/** The L1 address of the entity that sent a transaction to L1 */
|
|
66
|
+
export declare const L1_SENDER = "aztec.l1.sender";
|
|
67
|
+
/** The phase of the transaction */
|
|
68
|
+
export declare const TX_PHASE_NAME = "aztec.tx.phase_name";
|
|
69
|
+
/** The reason for disconnecting a peer */
|
|
70
|
+
export declare const P2P_GOODBYE_REASON = "aztec.p2p.goodbye.reason";
|
|
71
|
+
/** The proving job type */
|
|
72
|
+
export declare const PROVING_JOB_TYPE = "aztec.proving.job_type";
|
|
73
|
+
/** The proving job id */
|
|
74
|
+
export declare const PROVING_JOB_ID = "aztec.proving.job_id";
|
|
75
|
+
export declare const MERKLE_TREE_NAME = "aztec.merkle_tree.name";
|
|
76
|
+
/** The prover-id in a root rollup proof. */
|
|
77
|
+
export declare const ROLLUP_PROVER_ID = "aztec.rollup.prover_id";
|
|
78
|
+
/** Whether the proof submission was timed out (delayed more than 20 min) */
|
|
79
|
+
export declare const PROOF_TIMED_OUT = "aztec.proof.timed_out";
|
|
80
|
+
export declare const P2P_ID = "aztec.p2p.id";
|
|
81
|
+
export declare const P2P_REQ_RESP_PROTOCOL = "aztec.p2p.req_resp.protocol";
|
|
82
|
+
export declare const P2P_REQ_RESP_BATCH_REQUESTS_COUNT = "aztec.p2p.req_resp.batch_requests_count";
|
|
83
|
+
export declare const POOL_NAME = "aztec.pool.name";
|
|
84
|
+
export declare const SEQUENCER_STATE = "aztec.sequencer.state";
|
|
85
|
+
export declare const SIMULATOR_PHASE = "aztec.simulator.phase";
|
|
86
|
+
export declare const TARGET_ADDRESS = "aztec.address.target";
|
|
87
|
+
export declare const SENDER_ADDRESS = "aztec.address.sender";
|
|
88
|
+
export declare const MANA_USED = "aztec.mana.used";
|
|
89
|
+
/** Whether a sync process is the initial run, which is usually slower than iterative ones. */
|
|
90
|
+
export declare const INITIAL_SYNC = "aztec.initial_sync";
|
|
91
|
+
/** Identifier for the tables in a world state DB */
|
|
92
|
+
export declare const WS_DB_DATA_TYPE = "aztec.world_state.db_type";
|
|
93
|
+
/** Identifier for component database (e.g. archiver, tx pool) */
|
|
94
|
+
export declare const DB_DATA_TYPE = "aztec.db_type";
|
|
95
|
+
export declare const REVERTIBILITY = "aztec.revertibility";
|
|
96
|
+
export declare const GAS_DIMENSION = "aztec.gas_dimension";
|
|
97
|
+
export declare const WORLD_STATE_REQUEST_TYPE = "aztec.world_state_request";
|
|
98
|
+
export declare const NODEJS_EVENT_LOOP_STATE = "nodejs.eventloop.state";
|
|
99
|
+
//# sourceMappingURL=attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attributes.d.ts","sourceRoot":"","sources":["../src/attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mCAAmC;AACnC,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,qBAAqB,wCAAwC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,qBAAqB,wCAAwC,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,gBAAgB,mCAAmC,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,gBAAgB,mCAAmC,CAAC;AAEjE,wBAAwB;AACxB,eAAO,MAAM,aAAa,wBAAwB,CAAC;AACnD,uBAAuB;AACvB,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,sBAAsB;AACtB,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,gCAAgC;AAChC,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,2DAA2D;AAC3D,eAAO,MAAM,yBAAyB,oCAAoC,CAAC;AAC3E,sDAAsD;AACtD,eAAO,MAAM,eAAe,0BAA0B,CAAC;AACvD,qBAAqB;AACrB,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAC7C,iDAAiD;AACjD,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAC7C,8BAA8B;AAC9B,eAAO,MAAM,cAAc,yBAAyB,CAAC;AACrD,uBAAuB;AACvB,eAAO,MAAM,YAAY,uBAAuB,CAAC;AACjD,kBAAkB;AAClB,eAAO,MAAM,OAAO,kBAAkB,CAAC;AACvC,8EAA8E;AAC9E,eAAO,MAAM,EAAE,aAAa,CAAC;AAC7B,+BAA+B;AAC/B,eAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,mCAAmC;AACnC,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAC7C,kCAAkC;AAClC,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAC7C,iEAAiE;AACjE,eAAO,MAAM,SAAS,oBAAoB,CAAC;AAC3C,mCAAmC;AACnC,eAAO,MAAM,aAAa,wBAAwB,CAAC;AACnD,0CAA0C;AAC1C,eAAO,MAAM,kBAAkB,6BAA6B,CAAC;AAC7D,2BAA2B;AAC3B,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AACzD,yBAAyB;AACzB,eAAO,MAAM,cAAc,yBAAyB,CAAC;AAErD,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AACzD,4CAA4C;AAC5C,eAAO,MAAM,gBAAgB,2BAA2B,CAAC;AACzD,4EAA4E;AAC5E,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,eAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,eAAO,MAAM,qBAAqB,gCAAgC,CAAC;AACnE,eAAO,MAAM,iCAAiC,4CAA4C,CAAC;AAC3F,eAAO,MAAM,SAAS,oBAAoB,CAAC;AAE3C,eAAO,MAAM,eAAe,0BAA0B,CAAC;AAEvD,eAAO,MAAM,eAAe,0BAA0B,CAAC;AACvD,eAAO,MAAM,cAAc,yBAAyB,CAAC;AACrD,eAAO,MAAM,cAAc,yBAAyB,CAAC;AACrD,eAAO,MAAM,SAAS,oBAAoB,CAAC;AAE3C,8FAA8F;AAC9F,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAEjD,oDAAoD;AACpD,eAAO,MAAM,eAAe,8BAA8B,CAAC;AAE3D,iEAAiE;AACjE,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAEnD,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAEnD,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AAEpE,eAAO,MAAM,uBAAuB,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @overview This file contains the custom attributes used in telemetry events.
|
|
3
|
+
* Attribute names exist in a global namespace, alongside metric names. Use this file to ensure that attribute names are unique.
|
|
4
|
+
*
|
|
5
|
+
* To define a new attribute follow these steps:
|
|
6
|
+
* 1. Make sure it's not a semantic attribute that's already been defined by {@link @opentelemetry/semantic-conventions | OpenTelemetry} (e.g. `service.name`)
|
|
7
|
+
* 2. Come up with a unique name for it so that it doesn't clash with other attributes or metrics.
|
|
8
|
+
* 3. Prefix the attribute name with `aztec` to make it clear that it's a custom attribute.
|
|
9
|
+
* 4. Add a description of what the attribute represents and examples of what it might contain.
|
|
10
|
+
* 5. Start using it.
|
|
11
|
+
*
|
|
12
|
+
* @note Attributes and metric names exist in a hierarchy of namespaces. If a name has been used as a namespace, then it can not be used as a name for an attribute or metric.
|
|
13
|
+
* @example If `aztec.circuit.name` has been defined as an attribute then `aztec.circuit` alone can not be re-used for a metric or attribute because it is already a namespace.
|
|
14
|
+
* @see {@link https://opentelemetry.io/docs/specs/semconv/general/attribute-naming/}
|
|
15
|
+
*/ /** The Aztec network identifier */ export const NETWORK_NAME = 'aztec.network_name';
|
|
16
|
+
/**
|
|
17
|
+
* The name of the protocol circuit being run (e.g. public-kernel-setup or base-rollup)
|
|
18
|
+
* @see {@link @aztec/stdlib/stats:CircuitName}
|
|
19
|
+
*/ export const PROTOCOL_CIRCUIT_NAME = 'aztec.circuit.protocol_circuit_name';
|
|
20
|
+
/**
|
|
21
|
+
* The type of protocol circuit being run: server or client
|
|
22
|
+
*/ export const PROTOCOL_CIRCUIT_TYPE = 'aztec.circuit.protocol_circuit_type';
|
|
23
|
+
/**
|
|
24
|
+
* For an app circuit, the contract:function being run (e.g. Token:transfer)
|
|
25
|
+
*/ export const APP_CIRCUIT_NAME = 'aztec.circuit.app_circuit_name';
|
|
26
|
+
/**
|
|
27
|
+
* The type of app circuit being run: server or client
|
|
28
|
+
*/ export const APP_CIRCUIT_TYPE = 'aztec.circuit.app_circuit_type';
|
|
29
|
+
/** The block archive */ export const BLOCK_ARCHIVE = 'aztec.block.archive';
|
|
30
|
+
/** The block number */ export const BLOCK_NUMBER = 'aztec.block.number';
|
|
31
|
+
/** The slot number */ export const SLOT_NUMBER = 'aztec.slot.number';
|
|
32
|
+
/** The parent's block number */ export const BLOCK_PARENT = 'aztec.block.parent';
|
|
33
|
+
/** How many txs are being processed to build this block */ export const BLOCK_CANDIDATE_TXS_COUNT = 'aztec.block.candidate_txs_count';
|
|
34
|
+
/** How many actual txs were included in this block */ export const BLOCK_TXS_COUNT = 'aztec.block.txs_count';
|
|
35
|
+
/** The block size */ export const BLOCK_SIZE = 'aztec.block.size';
|
|
36
|
+
/** How many blocks are included in this epoch */ export const EPOCH_SIZE = 'aztec.epoch.size';
|
|
37
|
+
/** The proposer of a block */ export const BLOCK_PROPOSER = 'aztec.block.proposer';
|
|
38
|
+
/** The epoch number */ export const EPOCH_NUMBER = 'aztec.epoch.number';
|
|
39
|
+
/** The tx hash */ export const TX_HASH = 'aztec.tx.hash';
|
|
40
|
+
/** Generic attribute representing whether the action was successful or not */ export const OK = 'aztec.ok';
|
|
41
|
+
/** Generic status attribute */ export const STATUS = 'aztec.status';
|
|
42
|
+
/** Generic error type attribute */ export const ERROR_TYPE = 'aztec.error_type';
|
|
43
|
+
/** The type of the transaction */ export const L1_TX_TYPE = 'aztec.l1.tx_type';
|
|
44
|
+
/** The L1 address of the entity that sent a transaction to L1 */ export const L1_SENDER = 'aztec.l1.sender';
|
|
45
|
+
/** The phase of the transaction */ export const TX_PHASE_NAME = 'aztec.tx.phase_name';
|
|
46
|
+
/** The reason for disconnecting a peer */ export const P2P_GOODBYE_REASON = 'aztec.p2p.goodbye.reason';
|
|
47
|
+
/** The proving job type */ export const PROVING_JOB_TYPE = 'aztec.proving.job_type';
|
|
48
|
+
/** The proving job id */ export const PROVING_JOB_ID = 'aztec.proving.job_id';
|
|
49
|
+
export const MERKLE_TREE_NAME = 'aztec.merkle_tree.name';
|
|
50
|
+
/** The prover-id in a root rollup proof. */ export const ROLLUP_PROVER_ID = 'aztec.rollup.prover_id';
|
|
51
|
+
/** Whether the proof submission was timed out (delayed more than 20 min) */ export const PROOF_TIMED_OUT = 'aztec.proof.timed_out';
|
|
52
|
+
export const P2P_ID = 'aztec.p2p.id';
|
|
53
|
+
export const P2P_REQ_RESP_PROTOCOL = 'aztec.p2p.req_resp.protocol';
|
|
54
|
+
export const P2P_REQ_RESP_BATCH_REQUESTS_COUNT = 'aztec.p2p.req_resp.batch_requests_count';
|
|
55
|
+
export const POOL_NAME = 'aztec.pool.name';
|
|
56
|
+
export const SEQUENCER_STATE = 'aztec.sequencer.state';
|
|
57
|
+
export const SIMULATOR_PHASE = 'aztec.simulator.phase';
|
|
58
|
+
export const TARGET_ADDRESS = 'aztec.address.target';
|
|
59
|
+
export const SENDER_ADDRESS = 'aztec.address.sender';
|
|
60
|
+
export const MANA_USED = 'aztec.mana.used';
|
|
61
|
+
/** Whether a sync process is the initial run, which is usually slower than iterative ones. */ export const INITIAL_SYNC = 'aztec.initial_sync';
|
|
62
|
+
/** Identifier for the tables in a world state DB */ export const WS_DB_DATA_TYPE = 'aztec.world_state.db_type';
|
|
63
|
+
/** Identifier for component database (e.g. archiver, tx pool) */ export const DB_DATA_TYPE = 'aztec.db_type';
|
|
64
|
+
export const REVERTIBILITY = 'aztec.revertibility';
|
|
65
|
+
export const GAS_DIMENSION = 'aztec.gas_dimension';
|
|
66
|
+
export const WORLD_STATE_REQUEST_TYPE = 'aztec.world_state_request';
|
|
67
|
+
export const NODEJS_EVENT_LOOP_STATE = 'nodejs.eventloop.state';
|
package/dest/bench.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Context, ValueType } from '@opentelemetry/api';
|
|
2
|
+
import type { AttributesType, Meter, TelemetryClient, Tracer } from './telemetry.js';
|
|
3
|
+
export type BenchmarkMetricsType = {
|
|
4
|
+
name: string;
|
|
5
|
+
metrics: {
|
|
6
|
+
name: string;
|
|
7
|
+
type: 'gauge' | 'counter' | 'histogram';
|
|
8
|
+
description?: string;
|
|
9
|
+
unit?: string;
|
|
10
|
+
valueType?: ValueType;
|
|
11
|
+
points: BenchmarkDataPoint[];
|
|
12
|
+
}[];
|
|
13
|
+
}[];
|
|
14
|
+
export declare class BenchmarkTelemetryClient implements TelemetryClient {
|
|
15
|
+
private meters;
|
|
16
|
+
getMeter(name: string): Meter;
|
|
17
|
+
getTracer(): Tracer;
|
|
18
|
+
stop(): Promise<void>;
|
|
19
|
+
flush(): Promise<void>;
|
|
20
|
+
isEnabled(): boolean;
|
|
21
|
+
getMeters(): BenchmarkMetricsType;
|
|
22
|
+
clear(): void;
|
|
23
|
+
}
|
|
24
|
+
export type BenchmarkDataPoint = {
|
|
25
|
+
value: number;
|
|
26
|
+
attributes?: AttributesType;
|
|
27
|
+
context?: Context;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=bench.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bench.d.ts","sourceRoot":"","sources":["../src/bench.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,OAAO,EAA6B,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGjH,OAAO,KAAK,EACV,cAAc,EAGd,KAAK,EAIL,eAAe,EACf,MAAM,EAEP,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;QACxC,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,SAAS,CAAC,EAAE,SAAS,CAAC;QACtB,MAAM,EAAE,kBAAkB,EAAE,CAAC;KAC9B,EAAE,CAAC;CACL,EAAE,CAAC;AAEJ,qBAAa,wBAAyB,YAAW,eAAe;IAC9D,OAAO,CAAC,MAAM,CAA4B;IAE1C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK;IAM7B,SAAS,IAAI,MAAM;IAInB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,SAAS;IAIT,SAAS,IAAI,oBAAoB;IAIjC,KAAK;CAGN;AAgDD,MAAM,MAAM,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,cAAc,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC"}
|
package/dest/bench.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { NoopTracer } from './noop.js';
|
|
2
|
+
export class BenchmarkTelemetryClient {
|
|
3
|
+
meters = [];
|
|
4
|
+
getMeter(name) {
|
|
5
|
+
const meter = new InMemoryPlainMeter(name);
|
|
6
|
+
this.meters.push(meter);
|
|
7
|
+
return meter;
|
|
8
|
+
}
|
|
9
|
+
getTracer() {
|
|
10
|
+
return new NoopTracer();
|
|
11
|
+
}
|
|
12
|
+
stop() {
|
|
13
|
+
return Promise.resolve();
|
|
14
|
+
}
|
|
15
|
+
flush() {
|
|
16
|
+
return Promise.resolve();
|
|
17
|
+
}
|
|
18
|
+
isEnabled() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
getMeters() {
|
|
22
|
+
return this.meters;
|
|
23
|
+
}
|
|
24
|
+
clear() {
|
|
25
|
+
this.meters.forEach((meter)=>meter.clear());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
class InMemoryPlainMeter {
|
|
29
|
+
name;
|
|
30
|
+
metrics;
|
|
31
|
+
constructor(name){
|
|
32
|
+
this.name = name;
|
|
33
|
+
this.metrics = [];
|
|
34
|
+
}
|
|
35
|
+
clear() {
|
|
36
|
+
this.metrics.forEach((metric)=>metric.clear());
|
|
37
|
+
}
|
|
38
|
+
createGauge(name, options) {
|
|
39
|
+
return this.createMetric('gauge', name, options);
|
|
40
|
+
}
|
|
41
|
+
createObservableGauge(name, options) {
|
|
42
|
+
return this.createMetric('gauge', name, options);
|
|
43
|
+
}
|
|
44
|
+
createHistogram(name, options) {
|
|
45
|
+
return this.createMetric('histogram', name, options);
|
|
46
|
+
}
|
|
47
|
+
createUpDownCounter(name, options) {
|
|
48
|
+
return this.createMetric('counter', name, options);
|
|
49
|
+
}
|
|
50
|
+
createObservableUpDownCounter(name, options) {
|
|
51
|
+
return this.createMetric('counter', name, options);
|
|
52
|
+
}
|
|
53
|
+
createMetric(type, name, options) {
|
|
54
|
+
const metric = new InMemoryPlainMetric(type, name, options);
|
|
55
|
+
this.metrics.push(metric);
|
|
56
|
+
return metric;
|
|
57
|
+
}
|
|
58
|
+
addBatchObservableCallback(_callback, _observables) {}
|
|
59
|
+
removeBatchObservableCallback(_callback, _observables) {}
|
|
60
|
+
}
|
|
61
|
+
class InMemoryPlainMetric {
|
|
62
|
+
type;
|
|
63
|
+
name;
|
|
64
|
+
points;
|
|
65
|
+
description;
|
|
66
|
+
unit;
|
|
67
|
+
valueType;
|
|
68
|
+
constructor(type, name, options){
|
|
69
|
+
this.type = type;
|
|
70
|
+
this.name = name;
|
|
71
|
+
this.points = [];
|
|
72
|
+
this.description = options?.description;
|
|
73
|
+
this.unit = options?.unit;
|
|
74
|
+
this.valueType = options?.valueType;
|
|
75
|
+
}
|
|
76
|
+
add(value, attributes, context) {
|
|
77
|
+
this.points.push({
|
|
78
|
+
value,
|
|
79
|
+
attributes,
|
|
80
|
+
context
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
record(value, attributes, context) {
|
|
84
|
+
this.points.push({
|
|
85
|
+
value,
|
|
86
|
+
attributes,
|
|
87
|
+
context
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
addCallback() {}
|
|
91
|
+
removeCallback() {}
|
|
92
|
+
getPoints() {
|
|
93
|
+
return this.points;
|
|
94
|
+
}
|
|
95
|
+
clear() {
|
|
96
|
+
this.points.splice(0, this.points.length);
|
|
97
|
+
}
|
|
98
|
+
}
|
package/dest/config.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ConfigMappingsType } from '@aztec/foundation/config';
|
|
2
|
+
export interface TelemetryClientConfig {
|
|
3
|
+
metricsCollectorUrl?: URL;
|
|
4
|
+
tracesCollectorUrl?: URL;
|
|
5
|
+
logsCollectorUrl?: URL;
|
|
6
|
+
otelCollectIntervalMs: number;
|
|
7
|
+
otelExportTimeoutMs: number;
|
|
8
|
+
otelExcludeMetrics?: string[];
|
|
9
|
+
}
|
|
10
|
+
export declare const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientConfig>;
|
|
11
|
+
export declare function getConfigEnvVars(): TelemetryClientConfig;
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAyB,MAAM,0BAA0B,CAAC;AAE1F,MAAM,WAAW,qBAAqB;IACpC,mBAAmB,CAAC,EAAE,GAAG,CAAC;IAC1B,kBAAkB,CAAC,EAAE,GAAG,CAAC;IACzB,gBAAgB,CAAC,EAAE,GAAG,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,eAAO,MAAM,6BAA6B,EAAE,kBAAkB,CAAC,qBAAqB,CAwCnF,CAAC;AAEF,wBAAgB,gBAAgB,IAAI,qBAAqB,CAExD"}
|
package/dest/config.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { getConfigFromMappings } from '@aztec/foundation/config';
|
|
2
|
+
export const telemetryClientConfigMappings = {
|
|
3
|
+
metricsCollectorUrl: {
|
|
4
|
+
env: 'OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
|
|
5
|
+
description: 'The URL of the telemetry collector for metrics',
|
|
6
|
+
parseEnv: (val)=>val && new URL(val)
|
|
7
|
+
},
|
|
8
|
+
tracesCollectorUrl: {
|
|
9
|
+
env: 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT',
|
|
10
|
+
description: 'The URL of the telemetry collector for traces',
|
|
11
|
+
parseEnv: (val)=>val && new URL(val)
|
|
12
|
+
},
|
|
13
|
+
logsCollectorUrl: {
|
|
14
|
+
env: 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT',
|
|
15
|
+
description: 'The URL of the telemetry collector for logs',
|
|
16
|
+
parseEnv: (val)=>val && new URL(val)
|
|
17
|
+
},
|
|
18
|
+
otelCollectIntervalMs: {
|
|
19
|
+
env: 'OTEL_COLLECT_INTERVAL_MS',
|
|
20
|
+
description: 'The interval at which to collect metrics',
|
|
21
|
+
defaultValue: 60000,
|
|
22
|
+
parseEnv: (val)=>parseInt(val)
|
|
23
|
+
},
|
|
24
|
+
otelExportTimeoutMs: {
|
|
25
|
+
env: 'OTEL_EXPORT_TIMEOUT_MS',
|
|
26
|
+
description: 'The timeout for exporting metrics',
|
|
27
|
+
defaultValue: 30000,
|
|
28
|
+
parseEnv: (val)=>parseInt(val)
|
|
29
|
+
},
|
|
30
|
+
otelExcludeMetrics: {
|
|
31
|
+
env: 'OTEL_EXCLUDE_METRICS',
|
|
32
|
+
description: 'A list of metric prefixes to exclude from export',
|
|
33
|
+
parseEnv: (val)=>val ? val.split(',').map((s)=>s.trim()).filter((s)=>s.length > 0) : [],
|
|
34
|
+
defaultValue: []
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
export function getConfigEnvVars() {
|
|
38
|
+
return getConfigFromMappings(telemetryClientConfigMappings);
|
|
39
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Meter } from './telemetry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Detector for custom Aztec attributes
|
|
4
|
+
*/
|
|
5
|
+
export declare class EventLoopMonitor {
|
|
6
|
+
private meter;
|
|
7
|
+
private eventLoopDelayGauges;
|
|
8
|
+
private eventLoopUilization;
|
|
9
|
+
private eventLoopTime;
|
|
10
|
+
private started;
|
|
11
|
+
private lastELU;
|
|
12
|
+
private eventLoopDelay;
|
|
13
|
+
constructor(meter: Meter);
|
|
14
|
+
start(): void;
|
|
15
|
+
stop(): void;
|
|
16
|
+
private measure;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=event_loop_monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event_loop_monitor.d.ts","sourceRoot":"","sources":["../src/event_loop_monitor.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,KAAK,EAIX,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,qBAAa,gBAAgB;IAmBf,OAAO,CAAC,KAAK;IAlBzB,OAAO,CAAC,oBAAoB,CAQ1B;IAEF,OAAO,CAAC,mBAAmB,CAAkB;IAC7C,OAAO,CAAC,aAAa,CAAgB;IAErC,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,OAAO,CAAmC;IAClD,OAAO,CAAC,cAAc,CAAoB;gBAEtB,KAAK,EAAE,KAAK;IAgChC,KAAK,IAAI,IAAI;IAab,IAAI,IAAI,IAAI;IAaZ,OAAO,CAAC,OAAO,CAyBb;CACH"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { monitorEventLoopDelay, performance } from 'node:perf_hooks';
|
|
2
|
+
import * as Attributes from './attributes.js';
|
|
3
|
+
import * as Metrics from './metrics.js';
|
|
4
|
+
import { ValueType } from './telemetry.js';
|
|
5
|
+
/**
|
|
6
|
+
* Detector for custom Aztec attributes
|
|
7
|
+
*/ export class EventLoopMonitor {
|
|
8
|
+
meter;
|
|
9
|
+
eventLoopDelayGauges;
|
|
10
|
+
eventLoopUilization;
|
|
11
|
+
eventLoopTime;
|
|
12
|
+
started;
|
|
13
|
+
lastELU;
|
|
14
|
+
eventLoopDelay;
|
|
15
|
+
constructor(meter){
|
|
16
|
+
this.meter = meter;
|
|
17
|
+
this.started = false;
|
|
18
|
+
this.measure = (obs)=>{
|
|
19
|
+
const newELU = performance.eventLoopUtilization();
|
|
20
|
+
const delta = performance.eventLoopUtilization(newELU, this.lastELU);
|
|
21
|
+
this.lastELU = newELU;
|
|
22
|
+
// `utilization` [0,1] represents how much the event loop is busy vs waiting for new events to come in
|
|
23
|
+
// This should be corelated with CPU usage to gauge the performance characteristics of services
|
|
24
|
+
// 100% utilization leads to high latency because the event loop is _always_ busy, there's no breathing room for events to be processed quickly.
|
|
25
|
+
// Docs and examples:
|
|
26
|
+
// - https://nodesource.com/blog/event-loop-utilization-nodejs
|
|
27
|
+
// - https://youtu.be/WetXnEPraYM
|
|
28
|
+
obs.observe(this.eventLoopUilization, delta.utilization);
|
|
29
|
+
this.eventLoopTime.add(Math.floor(delta.idle), {
|
|
30
|
+
[Attributes.NODEJS_EVENT_LOOP_STATE]: 'idle'
|
|
31
|
+
});
|
|
32
|
+
this.eventLoopTime.add(Math.floor(delta.active), {
|
|
33
|
+
[Attributes.NODEJS_EVENT_LOOP_STATE]: 'active'
|
|
34
|
+
});
|
|
35
|
+
obs.observe(this.eventLoopDelayGauges.min, Math.floor(this.eventLoopDelay.min));
|
|
36
|
+
obs.observe(this.eventLoopDelayGauges.mean, Math.floor(this.eventLoopDelay.mean));
|
|
37
|
+
obs.observe(this.eventLoopDelayGauges.max, Math.floor(this.eventLoopDelay.max));
|
|
38
|
+
obs.observe(this.eventLoopDelayGauges.stddev, Math.floor(this.eventLoopDelay.stddev));
|
|
39
|
+
obs.observe(this.eventLoopDelayGauges.p50, Math.floor(this.eventLoopDelay.percentile(50)));
|
|
40
|
+
obs.observe(this.eventLoopDelayGauges.p90, Math.floor(this.eventLoopDelay.percentile(90)));
|
|
41
|
+
obs.observe(this.eventLoopDelayGauges.p99, Math.floor(this.eventLoopDelay.percentile(99)));
|
|
42
|
+
this.eventLoopDelay.reset();
|
|
43
|
+
};
|
|
44
|
+
const nsObsGauge = (name, description)=>meter.createObservableGauge(name, {
|
|
45
|
+
unit: 'ns',
|
|
46
|
+
valueType: ValueType.INT,
|
|
47
|
+
description
|
|
48
|
+
});
|
|
49
|
+
this.eventLoopDelayGauges = {
|
|
50
|
+
min: nsObsGauge(Metrics.NODEJS_EVENT_LOOP_DELAY_MIN, 'Minimum delay of the event loop'),
|
|
51
|
+
mean: nsObsGauge(Metrics.NODEJS_EVENT_LOOP_DELAY_MEAN, 'Mean delay of the event loop'),
|
|
52
|
+
max: nsObsGauge(Metrics.NODEJS_EVENT_LOOP_DELAY_MAX, 'Max delay of the event loop'),
|
|
53
|
+
stddev: nsObsGauge(Metrics.NODEJS_EVENT_LOOP_DELAY_STDDEV, 'Stddev delay of the event loop'),
|
|
54
|
+
p50: nsObsGauge(Metrics.NODEJS_EVENT_LOOP_DELAY_P50, 'P50 delay of the event loop'),
|
|
55
|
+
p90: nsObsGauge(Metrics.NODEJS_EVENT_LOOP_DELAY_P90, 'P90 delay of the event loop'),
|
|
56
|
+
p99: nsObsGauge(Metrics.NODEJS_EVENT_LOOP_DELAY_P99, 'P99 delay of the event loop')
|
|
57
|
+
};
|
|
58
|
+
this.eventLoopUilization = meter.createObservableGauge(Metrics.NODEJS_EVENT_LOOP_UTILIZATION, {
|
|
59
|
+
valueType: ValueType.DOUBLE,
|
|
60
|
+
description: 'How busy is the event loop'
|
|
61
|
+
});
|
|
62
|
+
this.eventLoopTime = meter.createUpDownCounter(Metrics.NODEJS_EVENT_LOOP_TIME, {
|
|
63
|
+
unit: 'ms',
|
|
64
|
+
valueType: ValueType.INT,
|
|
65
|
+
description: 'How much time the event loop has spent in a given state'
|
|
66
|
+
});
|
|
67
|
+
this.eventLoopDelay = monitorEventLoopDelay();
|
|
68
|
+
}
|
|
69
|
+
start() {
|
|
70
|
+
if (this.started) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
this.lastELU = performance.eventLoopUtilization();
|
|
74
|
+
this.eventLoopDelay.enable();
|
|
75
|
+
this.meter.addBatchObservableCallback(this.measure, [
|
|
76
|
+
this.eventLoopUilization,
|
|
77
|
+
...Object.values(this.eventLoopDelayGauges)
|
|
78
|
+
]);
|
|
79
|
+
}
|
|
80
|
+
stop() {
|
|
81
|
+
if (!this.started) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.meter.removeBatchObservableCallback(this.measure, [
|
|
85
|
+
this.eventLoopUilization,
|
|
86
|
+
...Object.values(this.eventLoopDelayGauges)
|
|
87
|
+
]);
|
|
88
|
+
this.eventLoopDelay.disable();
|
|
89
|
+
this.eventLoopDelay.reset();
|
|
90
|
+
this.lastELU = undefined;
|
|
91
|
+
}
|
|
92
|
+
measure;
|
|
93
|
+
}
|
package/dest/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './telemetry.js';
|
|
2
|
+
export * as Metrics from './metrics.js';
|
|
3
|
+
export * as Attributes from './attributes.js';
|
|
4
|
+
export * from './with_tracer.js';
|
|
5
|
+
export * from './prom_otel_adapter.js';
|
|
6
|
+
export * from './lmdb_metrics.js';
|
|
7
|
+
export * from './wrappers/index.js';
|
|
8
|
+
export * from './start.js';
|
|
9
|
+
export * from './otel_propagation.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
|
package/dest/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './telemetry.js';
|
|
2
|
+
export * as Metrics from './metrics.js';
|
|
3
|
+
export * as Attributes from './attributes.js';
|
|
4
|
+
export * from './with_tracer.js';
|
|
5
|
+
export * from './prom_otel_adapter.js';
|
|
6
|
+
export * from './lmdb_metrics.js';
|
|
7
|
+
export * from './wrappers/index.js';
|
|
8
|
+
export * from './start.js';
|
|
9
|
+
export * from './otel_propagation.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Meter } from './telemetry.js';
|
|
2
|
+
export type LmdbStatsCallback = () => Promise<{
|
|
3
|
+
mappingSize: number;
|
|
4
|
+
numItems: number;
|
|
5
|
+
actualSize: number;
|
|
6
|
+
}>;
|
|
7
|
+
export declare class LmdbMetrics {
|
|
8
|
+
private attributes?;
|
|
9
|
+
private getStats?;
|
|
10
|
+
private dbMapSize;
|
|
11
|
+
private dbUsedSize;
|
|
12
|
+
private dbNumItems;
|
|
13
|
+
constructor(meter: Meter, attributes?: Partial<Record<"aztec.network_name" | "aztec.circuit.protocol_circuit_name" | "aztec.circuit.protocol_circuit_type" | "aztec.circuit.app_circuit_name" | "aztec.circuit.app_circuit_type" | "aztec.block.archive" | "aztec.block.number" | "aztec.slot.number" | "aztec.block.parent" | "aztec.block.candidate_txs_count" | "aztec.block.txs_count" | "aztec.block.size" | "aztec.epoch.size" | "aztec.block.proposer" | "aztec.epoch.number" | "aztec.tx.hash" | "aztec.ok" | "aztec.status" | "aztec.error_type" | "aztec.l1.tx_type" | "aztec.l1.sender" | "aztec.tx.phase_name" | "aztec.p2p.goodbye.reason" | "aztec.proving.job_type" | "aztec.proving.job_id" | "aztec.merkle_tree.name" | "aztec.rollup.prover_id" | "aztec.proof.timed_out" | "aztec.p2p.id" | "aztec.p2p.req_resp.protocol" | "aztec.p2p.req_resp.batch_requests_count" | "aztec.pool.name" | "aztec.sequencer.state" | "aztec.simulator.phase" | "aztec.address.target" | "aztec.address.sender" | "aztec.mana.used" | "aztec.initial_sync" | "aztec.world_state.db_type" | "aztec.db_type" | "aztec.revertibility" | "aztec.gas_dimension" | "aztec.world_state_request" | "nodejs.eventloop.state", import("@opentelemetry/api").AttributeValue>> | undefined, getStats?: LmdbStatsCallback | undefined);
|
|
14
|
+
private recordDBMetrics;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=lmdb_metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lmdb_metrics.d.ts","sourceRoot":"","sources":["../src/lmdb_metrics.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,KAAK,EAGX,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE7G,qBAAa,WAAW;IAKI,OAAO,CAAC,UAAU,CAAC;IAAkB,OAAO,CAAC,QAAQ,CAAC;IAJhF,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,UAAU,CAAkB;gBAExB,KAAK,EAAE,KAAK,EAAU,UAAU,CAAC,4qCAAgB,EAAU,QAAQ,CAAC,+BAAmB;IAmBnG,OAAO,CAAC,eAAe,CAQrB;CACH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as Metrics from './metrics.js';
|
|
2
|
+
import { ValueType } from './telemetry.js';
|
|
3
|
+
export class LmdbMetrics {
|
|
4
|
+
attributes;
|
|
5
|
+
getStats;
|
|
6
|
+
dbMapSize;
|
|
7
|
+
dbUsedSize;
|
|
8
|
+
dbNumItems;
|
|
9
|
+
constructor(meter, attributes, getStats){
|
|
10
|
+
this.attributes = attributes;
|
|
11
|
+
this.getStats = getStats;
|
|
12
|
+
this.recordDBMetrics = async (observable)=>{
|
|
13
|
+
if (!this.getStats) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const metrics = await this.getStats();
|
|
17
|
+
observable.observe(this.dbMapSize, metrics.mappingSize, this.attributes);
|
|
18
|
+
observable.observe(this.dbNumItems, metrics.numItems, this.attributes);
|
|
19
|
+
observable.observe(this.dbUsedSize, metrics.actualSize, this.attributes);
|
|
20
|
+
};
|
|
21
|
+
this.dbMapSize = meter.createObservableGauge(Metrics.DB_MAP_SIZE, {
|
|
22
|
+
description: 'LMDB Map Size',
|
|
23
|
+
valueType: ValueType.INT,
|
|
24
|
+
unit: 'By'
|
|
25
|
+
});
|
|
26
|
+
this.dbUsedSize = meter.createObservableGauge(Metrics.DB_USED_SIZE, {
|
|
27
|
+
description: 'LMDB Used Size',
|
|
28
|
+
valueType: ValueType.INT,
|
|
29
|
+
unit: 'By'
|
|
30
|
+
});
|
|
31
|
+
this.dbNumItems = meter.createObservableGauge(Metrics.DB_NUM_ITEMS, {
|
|
32
|
+
description: 'LMDB Num Items',
|
|
33
|
+
valueType: ValueType.INT
|
|
34
|
+
});
|
|
35
|
+
meter.addBatchObservableCallback(this.recordDBMetrics, [
|
|
36
|
+
this.dbMapSize,
|
|
37
|
+
this.dbUsedSize,
|
|
38
|
+
this.dbNumItems
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
recordDBMetrics;
|
|
42
|
+
}
|