Skip to content

feat: add 'Dashboard Tools' section and 'Request Logs' page #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions fern/api-reference/dashboard-tools/request-logs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
title: "Request Logs"
---

Alchemy RPC API Request Logs Documentation
This guide provides a comprehensive overview of how to use the Request Logs feature in the Alchemy Dashboard to monitor and debug JSON-RPC API requests. It covers the value of request logs, step-by-step instructions for using the feature, code samples for interacting with logs, and best practices to optimize your experience.

### Why It Matters
The Request Logs feature in the Alchemy Dashboard is a powerful tool for developers building decentralized applications (dApps) on Ethereum and other supported blockchains. It solves several critical problems:

* **Debugging Made Easy**: Request Logs provides a user-friendly interface to search, filter, and analyze historical API requests, saving hours of manual debugging compared to raw log files or custom scripts.

Check warning on line 11 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces
* **Transparency and Control**: Developers gain visibility into every JSON-RPC request sent through Alchemy's infrastructure, including successes, failures, and errors, helping identify bottlenecks or misconfigured requests.

Check warning on line 12 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces
* **Performance Optimization**: By analyzing request durations, error rates, and method usage, developers can optimize dApp performance and ensure a seamless user experience.

Check warning on line 13 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces
* **Proactive Issue Resolution**: With historical data (up to 10 days), developers can investigate issues retroactively, spot patterns, and prevent recurring problems.

Check warning on line 14 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces

Request Logs empowers developers to maintain reliable dApps, reduce downtime, and improve user satisfaction with actionable insights into API interactions.

### How to Use It
#### Overview of the Request Logs Feature
The Request Logs feature, accessible via the Alchemy Dashboard's Request Explorer, allows you to view and analyze all JSON-RPC requests made to Alchemy's API endpoints for your application. Key functionalities include:

**Search and Filter**: Filter requests by parameters such as:
* **Method**: Specific JSON-RPC methods (e.g., eth_blockNumber, eth_getLogs).

Check warning on line 23 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces
* **HTTP Status**: Success (2xx) or error codes (4xx, 5xx).

Check warning on line 24 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces
* **Timestamp**: Requests from 1 second to 10 days ago.

Check warning on line 25 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces
* **Duration**: Time taken for the request to complete.

Check warning on line 26 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces
* **App or Network**: Filter by specific apps or blockchain networks (e.g., Ethereum Mainnet, Polygon).

Check warning on line 27 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `3` spaces between list item marker and content, expected `1` space, remove `2` spaces


**Detailed Request View**: Inspect individual requests to see:

Check warning on line 30 in fern/api-reference/dashboard-tools/request-logs.mdx

View workflow job for this annotation

GitHub Actions / Lint Files

Unexpected `2` blank lines before node, expected up to `1` blank line, remove `1` blank line
* Request payload and response.
* Error messages (if any).
* Node-specific details or network errors.


**Export and Analysis**: Export logs as CSV for further analysis or sharing with your team.

To access Request Logs:

1. Log in to the Alchemy Dashboard.
2. Navigate to the Apps tab and select your app.
3. Click Request Explorer under the app details to view the logs interface.

**Screenshot Example:**Caption: The Request Explorer shows a table of requests with filters for method, status, and timestamp.
#### Code Samples
Below are code samples to help you interact with Alchemy's API and troubleshoot issues using insights from Request Logs.
##### Sample 1: Fetching the Latest Nonce Before Sending a Transaction
If Request Logs show "nonce too low" errors for eth_sendRawTransaction, use this code to fetch the latest nonce:
```javascript
const { ethers } = require("ethers");
const provider = new ethers.providers.JsonRpcProvider("https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY");

async function getLatestNonce(walletAddress) {
try {
const nonce = await provider.getTransactionCount(walletAddress, "latest");
console.log(`Latest nonce: ${nonce}`);
return nonce;
} catch (error) {
console.error("Error fetching nonce:", error);
}
}

// Example usage
getLatestNonce("0xYourWalletAddress");
```
**Usage**: Run this before sending a transaction to ensure the correct nonce. Check Request Logs to confirm eth_getTransactionCount requests succeed (HTTP 200).
##### Sample 2: Batching Requests to Avoid Rate Limits
If Request Logs show HTTP 429 (Too Many Requests) errors, batch requests using the Alchemy SDK:
```javascript
const { Network, Alchemy } = require("alchemy-sdk");

const settings = {
apiKey: "YOUR_API_KEY",
network: Network.ETH_MAINNET,
};
const alchemy = new Alchemy(settings);

async function batchRequests() {
try {
const batch = [
{ method: "eth_blockNumber", params: [] },
{ method: "eth_getBalance", params: ["0xYourWalletAddress", "latest"] },
];
const responses = await alchemy.core.send("batch", batch);
console.log("Batch responses:", responses);
} catch (error) {
console.error("Batch request failed:", error);
}
}

batchRequests();
```
**Usage**: Batching reduces the number of requests, lowering the chance of hitting rate limits. Monitor Request Logs for fewer eth_blockNumber and eth_getBalance entries.
**Screenshot Example:**Caption: Detailed view of a request showing payload and response, useful for verifying code sample results.

### Best Practices
#### Pro Tips

* **Use Specific Filters**: Combine filters (e.g., method + error code) to quickly isolate issues in Request Explorer.
* **Monitor Regularly**: Check Request Logs daily or use Alchemy's Notify API for real-time alerts on errors.
* **Leverage Timestamps**: Filter by timestamp to focus on specific timeframes when debugging reported issues.
* **Combine with Other Tools**: Pair Request Logs with Alchemy's Mempool Watcher to diagnose transaction delays or gas issues.

#### Limits

* **Data Retention**: Logs are available for up to 10 days. Export logs regularly for longer-term analysis.
* **Rate Limits**: HTTP 429 errors indicate rate limit breaches. Optimize with batching or upgrade your plan.
* **Block Range for eth_getLogs**: Limit eth_getLogs block ranges (e.g., 5,000 blocks) to avoid timeouts.

#### Common Issues and Solutions

* **Issue**: HTTP 429 (Too Many Requests) in logs.
* **Solution**: Use batch requests (see Sample 2) or reduce request frequency.


* **Issue**: "Nonce too low" errors in eth_sendRawTransaction.
* **Solution**: Fetch the latest nonce before each transaction (see Sample 1).


* **Issue**: Empty or missing logs.
* **Solution**: Verify API key, app, and network filters. Check for dashboard delays during high network congestion.



#### Additional Notes

* **Security**: Avoid exposing API keys in client-side code. Use HTTP header-based authentication.
* **Documentation**: See Alchemy's Error Reference for JSON-RPC error codes.
* **Support**: Contact Alchemy Support via the dashboard or check the FAQ.

By leveraging Request Logs and these practices, you can monitor, debug, and optimize your dApp's API interactions for a reliable user experience.
13 changes: 5 additions & 8 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,11 @@ navigation:
api-reference/alchemy-sdk/sdk-v2-methods/sdk-getnftsforcontract.mdx
slug: sdk-v2-methods
slug: alchemy-sdk
- section: Dashboard Tools
contents:
- page: Request Logs
path: fern/api-reference/dashboard-tools/request-logs.mdx
slug: request-logs
- section: Blast RPC API
contents:
- page: Introduction to Blast
Expand Down Expand Up @@ -4784,10 +4789,6 @@ redirects:
destination: /docs/alchemy-notify
- source: /introduction/core-products/alchemy-supernode
destination: /docs/alchemy-supernode
- source: /guides/eip-1559
destination: /docs/eip-1559-resource-and-tutorial-hub
- source: /guides/eip-1559/gas-estimator
destination: /docs/how-to-build-a-gas-fee-estimator-using-eip-1559
- source: /guides/eip-1559/maxpriorityfeepergas-vs-maxfeepergas
destination: /docs/maxpriorityfeepergas-vs-maxfeepergas
- source: /guides/eip-1559/retry-eip-1559-tx
Expand Down Expand Up @@ -5284,10 +5285,6 @@ redirects:
destination: /docs/reference/getinflationreward
- source: /apis/solana-api/getlargestaccounts
destination: /docs/reference/getlargestaccounts
- source: /apis/solana-api/getmaxretransmitslot
destination: /docs/reference/getmaxretransmitslot
- source: /apis/solana-api/getmaxshredinsertslot
destination: /docs/reference/getmaxshredinsertslot
- source: /apis/solana-api/getminimumbalanceforrentexemption
destination: /docs/reference/getminimumbalanceforrentexemption
- source: /apis/solana-api/getmultipleaccounts
Expand Down
Loading