Skip to content

Commit 1594eec

Browse files
committed
chore: logging
1 parent ab87595 commit 1594eec

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

yarn-project/prover-node/src/metrics.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
type Meter,
1111
Metrics,
1212
type ObservableGauge,
13-
type ObservableUpDownCounter,
1413
type TelemetryClient,
1514
type Tracer,
1615
type UpDownCounter,
@@ -60,7 +59,7 @@ export class ProverNodeJobMetrics {
6059

6160
export class ProverNodeRewardsMetrics {
6261
private rewards: ObservableGauge;
63-
private accumulatedRewards: ObservableUpDownCounter;
62+
private accumulatedRewards: UpDownCounter;
6463
private prevEpoch = -1n;
6564
private proofSubmissionWindow = 0n;
6665

@@ -75,19 +74,19 @@ export class ProverNodeRewardsMetrics {
7574
description: 'The rewards earned',
7675
});
7776

78-
this.accumulatedRewards = this.meter.createObservableUpDownCounter(Metrics.PROVER_NODE_REWARDS_TOTAL, {
77+
this.accumulatedRewards = this.meter.createUpDownCounter(Metrics.PROVER_NODE_REWARDS_TOTAL, {
7978
valueType: ValueType.DOUBLE,
8079
description: 'The rewards earned (total)',
8180
});
8281
}
8382

8483
public async start() {
8584
this.proofSubmissionWindow = await this.rollup.getProofSubmissionWindow();
86-
this.meter.addBatchObservableCallback(this.observe, [this.rewards, this.accumulatedRewards]);
85+
this.meter.addBatchObservableCallback(this.observe, [this.rewards]);
8786
}
8887

8988
public stop() {
90-
this.meter.removeBatchObservableCallback(this.observe, [this.rewards, this.accumulatedRewards]);
89+
this.meter.removeBatchObservableCallback(this.observe, [this.rewards]);
9190
}
9291

9392
private observe = async (observer: BatchObservableResult): Promise<void> => {
@@ -101,14 +100,14 @@ export class ProverNodeRewardsMetrics {
101100
const fmt = parseFloat(formatUnits(rewards, 18));
102101

103102
observer.observe(this.rewards, fmt, {
104-
[Attributes.L1_SENDER]: this.coinbase.toString(),
103+
[Attributes.COINBASE]: this.coinbase.toString(),
105104
});
106105

107106
// only accumulate once per epoch
108107
if (closedEpoch > this.prevEpoch) {
109108
this.prevEpoch = closedEpoch;
110-
observer.observe(this.accumulatedRewards, fmt, {
111-
[Attributes.L1_SENDER]: this.coinbase.toString(),
109+
this.accumulatedRewards.add(fmt, {
110+
[Attributes.COINBASE]: this.coinbase.toString(),
112111
});
113112
}
114113
}

yarn-project/sequencer-client/src/publisher/sequencer-publisher.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ describe('SequencerPublisher', () => {
281281
expect(enqueued).toEqual(true);
282282
const result = await publisher.sendRequests();
283283

284-
expect(result?.errorMsg).toEqual('Test error');
284+
expect(result?.result?.errorMsg).toEqual('Test error');
285285
});
286286

287287
it('does not send requests if interrupted', async () => {

yarn-project/sequencer-client/src/sequencer/metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ export class SequencerMetrics {
150150

151151
const fmt = parseFloat(formatUnits(rewards, 18));
152152
observer.observe(this.rewards, fmt, {
153-
[Attributes.L1_SENDER]: this.coinbase.toString(),
153+
[Attributes.COINBASE]: this.coinbase.toString(),
154154
});
155155
};
156156

yarn-project/telemetry-client/src/attributes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export const ERROR_TYPE = 'aztec.error_type';
6464
export const L1_TX_TYPE = 'aztec.l1.tx_type';
6565
/** The L1 address of the entity that sent a transaction to L1 */
6666
export const L1_SENDER = 'aztec.l1.sender';
67+
/** The L1 address receiving rewards */
68+
export const COINBASE = 'aztec.coinbase';
6769
/** The phase of the transaction */
6870
export const TX_PHASE_NAME = 'aztec.tx.phase_name';
6971
/** The reason for disconnecting a peer */

0 commit comments

Comments
 (0)