@aztec/telemetry-client 0.0.1-commit.e558bd1c → 0.0.1-commit.e5a3663dd
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 +13 -1
- package/dest/attributes.d.ts.map +1 -1
- package/dest/attributes.js +6 -0
- package/dest/config.d.ts +1 -1
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +7 -9
- package/dest/lmdb_metrics.d.ts +2 -2
- package/dest/lmdb_metrics.d.ts.map +1 -1
- package/dest/metrics.d.ts +64 -4
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +341 -11
- package/dest/monitored_batch_span_processor.d.ts +24 -0
- package/dest/monitored_batch_span_processor.d.ts.map +1 -0
- package/dest/monitored_batch_span_processor.js +59 -0
- package/dest/otel.d.ts +1 -1
- package/dest/otel.d.ts.map +1 -1
- package/dest/otel.js +59 -3
- 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/package.json +3 -3
- package/src/attributes.ts +17 -0
- package/src/config.ts +12 -9
- package/src/metrics.ts +350 -11
- package/src/monitored_batch_span_processor.ts +72 -0
- package/src/otel.ts +33 -2
- package/src/wrappers/fetch.ts +9 -3
package/dest/otel.js
CHANGED
|
@@ -5,9 +5,10 @@ import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
|
5
5
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
6
6
|
import { HostMetrics } from '@opentelemetry/host-metrics';
|
|
7
7
|
import { ExplicitBucketHistogramAggregation, InstrumentType, MeterProvider, PeriodicExportingMetricReader, View } from '@opentelemetry/sdk-metrics';
|
|
8
|
-
import {
|
|
8
|
+
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
9
9
|
import { ATTR_SERVICE_NAME, ATTR_SERVICE_VERSION } from '@opentelemetry/semantic-conventions';
|
|
10
10
|
import { toMetricOptions } from './metric-utils.js';
|
|
11
|
+
import { MonitoredBatchSpanProcessor } from './monitored_batch_span_processor.js';
|
|
11
12
|
import { NodejsMetricsMonitor } from './nodejs_metrics_monitor.js';
|
|
12
13
|
import { OtelFilterMetricExporter, PublicOtelFilterMetricExporter } from './otel_filter_metric_exporter.js';
|
|
13
14
|
import { registerOtelLoggerProvider } from './otel_logger_provider.js';
|
|
@@ -369,6 +370,61 @@ export class OpenTelemetryClient {
|
|
|
369
370
|
15_000_000,
|
|
370
371
|
30_000_000
|
|
371
372
|
], true)
|
|
373
|
+
}),
|
|
374
|
+
// L1 gas prices in gwei: priority fees ~0.01-10, base fees ~1-500, spikes to 1000+
|
|
375
|
+
new View({
|
|
376
|
+
instrumentType: InstrumentType.HISTOGRAM,
|
|
377
|
+
instrumentUnit: 'gwei',
|
|
378
|
+
aggregation: new ExplicitBucketHistogramAggregation([
|
|
379
|
+
0.1,
|
|
380
|
+
0.5,
|
|
381
|
+
1,
|
|
382
|
+
2,
|
|
383
|
+
5,
|
|
384
|
+
10,
|
|
385
|
+
20,
|
|
386
|
+
50,
|
|
387
|
+
100,
|
|
388
|
+
200,
|
|
389
|
+
500,
|
|
390
|
+
1_000
|
|
391
|
+
], true)
|
|
392
|
+
}),
|
|
393
|
+
// L1 gas consumption: tx gas 100k-30M, calldata/blob gas varies
|
|
394
|
+
new View({
|
|
395
|
+
instrumentType: InstrumentType.HISTOGRAM,
|
|
396
|
+
instrumentUnit: 'gas',
|
|
397
|
+
aggregation: new ExplicitBucketHistogramAggregation([
|
|
398
|
+
10_000,
|
|
399
|
+
50_000,
|
|
400
|
+
100_000,
|
|
401
|
+
250_000,
|
|
402
|
+
500_000,
|
|
403
|
+
1_000_000,
|
|
404
|
+
2_000_000,
|
|
405
|
+
5_000_000,
|
|
406
|
+
10_000_000,
|
|
407
|
+
15_000_000,
|
|
408
|
+
30_000_000
|
|
409
|
+
], true)
|
|
410
|
+
}),
|
|
411
|
+
// L1 tx total fee in ETH: typically 0.001 - 1 ETH
|
|
412
|
+
new View({
|
|
413
|
+
instrumentType: InstrumentType.HISTOGRAM,
|
|
414
|
+
instrumentUnit: 'eth',
|
|
415
|
+
aggregation: new ExplicitBucketHistogramAggregation([
|
|
416
|
+
0.0001,
|
|
417
|
+
0.0005,
|
|
418
|
+
0.001,
|
|
419
|
+
0.005,
|
|
420
|
+
0.01,
|
|
421
|
+
0.05,
|
|
422
|
+
0.1,
|
|
423
|
+
0.5,
|
|
424
|
+
1,
|
|
425
|
+
5,
|
|
426
|
+
10
|
|
427
|
+
], true)
|
|
372
428
|
})
|
|
373
429
|
]
|
|
374
430
|
});
|
|
@@ -378,9 +434,9 @@ export class OpenTelemetryClient {
|
|
|
378
434
|
const tracerProvider = new NodeTracerProvider({
|
|
379
435
|
resource,
|
|
380
436
|
spanProcessors: config.tracesCollectorUrl ? [
|
|
381
|
-
new
|
|
437
|
+
new MonitoredBatchSpanProcessor(new OTLPTraceExporter({
|
|
382
438
|
url: config.tracesCollectorUrl.href
|
|
383
|
-
}))
|
|
439
|
+
}), log)
|
|
384
440
|
] : []
|
|
385
441
|
});
|
|
386
442
|
tracerProvider.register({
|
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/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.e5a3663dd",
|
|
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.e5a3663dd",
|
|
31
|
+
"@aztec/stdlib": "0.0.1-commit.e5a3663dd",
|
|
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 */
|
|
@@ -128,6 +130,9 @@ export const NODEJS_EVENT_LOOP_STATE = 'nodejs.eventloop.state';
|
|
|
128
130
|
|
|
129
131
|
export const TOPIC_NAME = 'aztec.gossip.topic_name';
|
|
130
132
|
|
|
133
|
+
/** The reason a transaction was evicted from the tx pool */
|
|
134
|
+
export const TX_POOL_EVICTION_REASON = 'aztec.mempool.eviction_reason';
|
|
135
|
+
|
|
131
136
|
export const TX_COLLECTION_METHOD = 'aztec.tx_collection.method';
|
|
132
137
|
|
|
133
138
|
/** Scope of L1 transaction (sequencer, prover, or other) */
|
|
@@ -139,8 +144,20 @@ export const IS_COMMITTEE_MEMBER = 'aztec.is_committee_member';
|
|
|
139
144
|
/** Fisherman fee analysis strategy identifier */
|
|
140
145
|
export const FISHERMAN_FEE_STRATEGY_ID = 'aztec.fisherman.strategy_id';
|
|
141
146
|
|
|
147
|
+
/** Whether the analyzed block reached 100% blob capacity */
|
|
148
|
+
export const BLOCK_FULL = 'aztec.block_full';
|
|
149
|
+
|
|
142
150
|
/** The L1 transaction target for block proposal */
|
|
143
151
|
export const L1_BLOCK_PROPOSAL_TX_TARGET = 'aztec.l1.block_proposal_tx_target';
|
|
144
152
|
|
|
145
153
|
/** Whether tracing methods were used to extract block proposal data */
|
|
146
154
|
export const L1_BLOCK_PROPOSAL_USED_TRACE = 'aztec.l1.block_proposal_used_trace';
|
|
155
|
+
|
|
156
|
+
/** HA signer duty type (e.g., BLOCK_PROPOSAL, CHECKPOINT_ATTESTATION) */
|
|
157
|
+
export const HA_DUTY_TYPE = 'aztec.ha_signer.duty_type';
|
|
158
|
+
|
|
159
|
+
/** HA signer node identifier */
|
|
160
|
+
export const HA_NODE_ID = 'aztec.ha_signer.node_id';
|
|
161
|
+
|
|
162
|
+
/** The address of an attester (validator) participating in consensus */
|
|
163
|
+
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;
|
|
@@ -18,29 +23,27 @@ export const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientCo
|
|
|
18
23
|
metricsCollectorUrl: {
|
|
19
24
|
env: 'OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
|
|
20
25
|
description: 'The URL of the telemetry collector for metrics',
|
|
21
|
-
parseEnv: (val: string) =>
|
|
26
|
+
parseEnv: (val: string) => new URL(val),
|
|
22
27
|
},
|
|
23
28
|
tracesCollectorUrl: {
|
|
24
29
|
env: 'OTEL_EXPORTER_OTLP_TRACES_ENDPOINT',
|
|
25
30
|
description: 'The URL of the telemetry collector for traces',
|
|
26
|
-
parseEnv: (val: string) =>
|
|
31
|
+
parseEnv: (val: string) => new URL(val),
|
|
27
32
|
},
|
|
28
33
|
logsCollectorUrl: {
|
|
29
34
|
env: 'OTEL_EXPORTER_OTLP_LOGS_ENDPOINT',
|
|
30
35
|
description: 'The URL of the telemetry collector for logs',
|
|
31
|
-
parseEnv: (val: string) =>
|
|
36
|
+
parseEnv: (val: string) => new URL(val),
|
|
32
37
|
},
|
|
33
38
|
otelCollectIntervalMs: {
|
|
34
39
|
env: 'OTEL_COLLECT_INTERVAL_MS',
|
|
35
40
|
description: 'The interval at which to collect metrics',
|
|
36
|
-
|
|
37
|
-
parseEnv: (val: string) => parseInt(val),
|
|
41
|
+
...numberConfigHelper(60000),
|
|
38
42
|
},
|
|
39
43
|
otelExportTimeoutMs: {
|
|
40
44
|
env: 'OTEL_EXPORT_TIMEOUT_MS',
|
|
41
45
|
description: 'The timeout for exporting metrics',
|
|
42
|
-
|
|
43
|
-
parseEnv: (val: string) => parseInt(val),
|
|
46
|
+
...numberConfigHelper(30000),
|
|
44
47
|
},
|
|
45
48
|
otelExcludeMetrics: {
|
|
46
49
|
env: 'OTEL_EXCLUDE_METRICS',
|
|
@@ -70,7 +73,7 @@ export const telemetryClientConfigMappings: ConfigMappingsType<TelemetryClientCo
|
|
|
70
73
|
publicMetricsCollectorUrl: {
|
|
71
74
|
env: 'PUBLIC_OTEL_EXPORTER_OTLP_METRICS_ENDPOINT',
|
|
72
75
|
description: 'A URL to publish a subset of metrics for public consumption',
|
|
73
|
-
parseEnv: (val: string) =>
|
|
76
|
+
parseEnv: (val: string) => new URL(val),
|
|
74
77
|
},
|
|
75
78
|
publicMetricsCollectFrom: {
|
|
76
79
|
env: 'PUBLIC_OTEL_COLLECT_FROM',
|