Skip to content

feat: add latency metrics to batcher - #1578

Merged
JuArce merged 10 commits into
stagingfrom
feat-batcher-latency-metrics
Dec 10, 2024
Merged

feat: add latency metrics to batcher#1578
JuArce merged 10 commits into
stagingfrom
feat-batcher-latency-metrics

Conversation

@avilagaston9

@avilagaston9avilagaston9 commented Dec 4, 2024

Copy link
Copy Markdown
Contributor

Add Latency Metrics to Batcher

Description

Adds the following metrics to the Batcher:

  • S3 Latency: Measures the time it takes to upload the batch to S3.
  • CreateNewTask Latency: Measures the time the CreateNewTask function takes. It is broken down into two:
    • create_new_task: Time it takes to send the new task to Ethereum.
    • cancel_new_task: Time it takes to cancel the new task, in case the receipt is not found.

Note

The time shown is always the latest one. cancel_new_task is set to zero since sometimes the function is not executed.

image

Note

It always takes 7 secs to get a receipt from anvil.

How to Test

  1. Start Anvil:
make anvil_start_with_block_time
  1. Start the Batcher:
make batcher_start_local
  1. Start the metrics:
make run_metrics
  1. Start sending proofs:
make batcher_send_burst_groth16
  1. Go to localhost:3000 and watch the System Data dashboard.

You can also edit the Batcher code to emit some cancel_new_task events:

  1. Edit the batcher/aligned-batcher/src/lib.rs file in line 1569 as follows:
Ok(receipt) => {ifletErr(e) = self.telemetry.task_sent(&hex::encode(batch_merkle_root), receipt.transaction_hash).await{warn!("Failed to send task status to telemetry: {:?}", e);}if start.elapsed().as_millis() % 2 == 0{self.cancel_create_new_task_tx(fee_params.gas_price).await;}Ok(receipt)}

Type of change

  • New feature

Checklist

  • “Hotfix” to testnet, everything else to staging
  • Linked to Github Issue
  • This change depends on code or research by an external entity
    • Acknowledgements were updated to give credit
  • Unit tests added
  • This change requires new documentation.
    • Documentation has been added/updated.
  • This change is an Optimization
    • Benchmarks added/run
  • Has a known issue
  • If your PR changes the Operator compatibility (Ex: Upgrade prover versions)
    • This PR adds compatibility for operator for both versions and do not change batcher/docs/examples
    • This PR updates batcher and docs/examples to the newer version. This requires the operator are already updated to be compatible

@github-actions

Copy link
Copy Markdown

Changes to gas cost

Generated at commit: 34ad21c91e46eec8b5e2dc917ad519f5c4ef144e, compared to commit: 8b6ef0c71f65d1233d392c2d58f2f1442ba27fab

🧾 Summary (10% most significant diffs)

ContractMethodAvg (+/-)%
AlignedLayerServiceManagercreateNewTask+302 ❌+0.40%

Full diff report 👇
ContractDeployment Cost (+/-)MethodMin (+/-)%Avg (+/-)%Median (+/-)%Max (+/-)%# Calls (+/-)
AlignedLayerServiceManager5,231,234 (0)createNewTask
receive
56,083 (0)
23,317 (0)
0.00%
0.00%
76,066 (+302)
46,915 (+373)
+0.40%
+0.80%
76,217 (-24)
47,195 (0)
-0.03%
0.00%
77,030 (0)
47,195 (0)
0.00%
0.00%
256 (0)
256 (0)

@avilagaston9
avilagaston9 changed the base branch from testnet to stagingDecember 4, 2024 21:05
@avilagaston9
avilagaston9 marked this pull request as ready for review December 4, 2024 21:52
@avilagaston9avilagaston9 mentioned this pull request Dec 4, 2024
14 tasks
@avilagaston9avilagaston9 self-assigned this Dec 5, 2024
Comment threadbatcher/aligned-batcher/src/lib.rs
Comment threadbatcher/aligned-batcher/src/lib.rs
Comment threadbatcher/aligned-batcher/src/lib.rs Outdated

@uri-99uri-99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also i would separate the latencies in grafana in a different section

@JulianVenturaJulianVentura left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine and seems to work as expected. I'm just leaving a comment because of curiosity

Comment threadbatcher/aligned-batcher/src/lib.rs
@JuArce
JuArce added this pull request to the merge queueDec 10, 2024
Merged via the queue into staging with commit 5b6aca1Dec 10, 2024
@JuArce
JuArce deleted the feat-batcher-latency-metrics branch December 10, 2024 18:58
PatStiles pushed a commit that referenced this pull request Jan 10, 2025
Co-authored-by: Marcos Nicolau <marcosnicolau@lambdaclass.com>
PatStiles pushed a commit that referenced this pull request Jan 10, 2025
Co-authored-by: Marcos Nicolau <marcosnicolau@lambdaclass.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@avilagaston9@Oppen@PatStiles@uri-99@JulianVentura@JuArce@MarcosNicolau