@aztec/aztec-node 0.0.1-commit.c7c42ec → 0.0.1-commit.cf93bcc56

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.
@@ -4,7 +4,7 @@ import {
4
4
  Metrics,
5
5
  type TelemetryClient,
6
6
  type UpDownCounter,
7
- ValueType,
7
+ createUpDownCounterWithDefault,
8
8
  } from '@aztec/telemetry-client';
9
9
 
10
10
  export class NodeMetrics {
@@ -16,25 +16,14 @@ export class NodeMetrics {
16
16
 
17
17
  constructor(client: TelemetryClient, name = 'AztecNode') {
18
18
  const meter = client.getMeter(name);
19
- this.receiveTxCount = meter.createUpDownCounter(Metrics.NODE_RECEIVE_TX_COUNT, {});
20
- this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION, {
21
- description: 'The duration of the receiveTx method',
22
- unit: 'ms',
23
- valueType: ValueType.INT,
19
+ this.receiveTxCount = createUpDownCounterWithDefault(meter, Metrics.NODE_RECEIVE_TX_COUNT, {
20
+ [Attributes.OK]: [true, false],
24
21
  });
22
+ this.receiveTxDuration = meter.createHistogram(Metrics.NODE_RECEIVE_TX_DURATION);
25
23
 
26
- this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION, {
27
- description: 'How long taking a snapshot takes',
28
- unit: 'ms',
29
- valueType: ValueType.INT,
30
- });
31
-
32
- this.snapshotErrorCount = meter.createUpDownCounter(Metrics.NODE_SNAPSHOT_ERROR_COUNT, {
33
- description: 'How many snapshot errors have happened',
34
- valueType: ValueType.INT,
35
- });
24
+ this.snapshotDuration = meter.createHistogram(Metrics.NODE_SNAPSHOT_DURATION);
36
25
 
37
- this.snapshotErrorCount.add(0);
26
+ this.snapshotErrorCount = createUpDownCounterWithDefault(meter, Metrics.NODE_SNAPSHOT_ERROR_COUNT);
38
27
  }
39
28
 
40
29
  receivedTx(durationMs: number, isAccepted: boolean) {