Skip to content

Conversation

@isum
Copy link
Member

@isum isum commented Nov 21, 2025

Amp-powered subgraphs are a new kind of subgraphs with SQL data sources that query and index data from the Amp servers. They are significantly more efficient than the standard subgraphs, and the indexing time can be reduced from days and weeks, to minutes and hours in most cases.

Documentation

Documentation on creating Amp-powered subgraphs is available here.

Examples

Complete examples of how to create, deploy and query Amp-powered subgraphs are available in a separate repository:
https://github.com/edgeandnode/amp-subgraph-examples

@isum isum self-assigned this Nov 21, 2025
isum added 29 commits November 21, 2025 18:19
Only require block number columns and try to load
block hashes and timestamps from the source tables
@isum isum force-pushed the ion/amp-powered-subgraphs branch from 957ef3a to 3ebfc27 Compare December 2, 2025 16:22
Copy link
Collaborator

@lutter lutter left a comment

Choose a reason for hiding this comment

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

LGTM! (Been waiting to do this on a huge PR for ages)

};
}

pub(super) trait Compat<T> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a big deal, but Compat is maybe a bit of a misnomer, maybe FromAlloy would be better


use super::{Compat, Context, Error, LatestBlocks};

pub(super) async fn check_and_handle_reorg<NC>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is really important. It would be good to have a comment on how this works and why. It might also be worth explaining what the other two methods here do.

let stopwatch = StopwatchMetrics::new(
logger.cheap_clone(),
deployment,
"nozzle-process",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just make that process, it's easier on existing dashboards and it's clear from the manifest what kind of subgraph it is


let is_close_to_chain_head = latest_block.saturating_sub(block_number) <= 100;

cx.store
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be marked in the stopwatch as transact_block

})?;
}

let ModificationsAndCache {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be marked in the stopwatch as as_modifications

// Q: How to make this failure loud enough so it is not missed?
//
// println!("Subgraph panicked");
// std::process::abort();
Copy link
Collaborator

Choose a reason for hiding this comment

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

We shouldn't do that; yes, it's hard to spot a panic in lots of logs, but taking down the process would mean that one subgraph can affect lots of other subgraphs.

}

/// Tracks the target block number of a deployment.
pub(super) struct DeploymentTarget(IntGauge);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand what 'target' means here - is this basically the latest block that Amp has available?

) -> Self {
let int_gauge = metrics_registry
.new_int_gauge(
"amp_deployment_head",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that was addressed in a later commit, so ignore

I think prefixing all these with amp when they correspond to an existing metric like deployment_head makes using them in dashboards much harder. When metrics mean the same thing regardless of subgraph flavor, we should use the same metric name


## ENV variables

Amp-powered subgraphs feature introduces the following new ENV variables:
Copy link
Collaborator

Choose a reason for hiding this comment

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

While this is still experimental, it's fine to have that here, but at some point we should move this to docs/environment-variables.md

Sign up for free to 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.

3 participants