Skip to content

Commit

Permalink
Merge pull request #916 from near/main
Browse files Browse the repository at this point in the history
Prod Release 24/07/2024
  • Loading branch information
darunrs committed Jul 24, 2024
2 parents af40c14 + 9133af4 commit 8034220
Show file tree
Hide file tree
Showing 50 changed files with 9,307 additions and 1,146 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,24 @@ With everything configured correctly, we can now start all components of QueryAp
docker compose up
```

### Developing frontend
1. Change `frontend/replacement.dev.json` to
```json
{
"REPL_ACCOUNT_ID": "dev-queryapi.dataplatform.near",
"REPL_GRAPHQL_ENDPOINT": "https://near-queryapi.dev.api.pagoda.co",
"REPL_EXTERNAL_APP_URL": "http://localhost:3000",
"REPL_REGISTRY_CONTRACT_ID": "dev-queryapi.dataplatform.near",
"REPL_QUERY_API_USAGE_URL": "https://storage.googleapis.com/databricks-near-query-runner/output/query-api-usage/indexers_dev.json"
}
```
2. `cd frontend`
3. `npm install`
4. `npm run dev`
5. `npm run serve:widgets:dev`
6. Set flags https://dev.near.org/flags to `http://127.0.0.1:3030`
7. Navigate to `https://dev.near.org/dev-queryapi.dataplatform.near/widget/QueryApi.dev-App`

### Local Configuration
- Coordinator watches the dev registry contract by default (`dev-queryapi.dataplatform.near`). To use a different contract, you can update the `REGISTRY_CONTRACT_ID` environment variable.

Expand Down
8 changes: 8 additions & 0 deletions block-streamer/src/block_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,14 @@ async fn process_bitmap_indexer_blocks(

let mut last_published_block_height: u64 = start_block_height;

let indexer_name = indexer.get_full_name();

while let Some(block_height_result) = matching_block_heights.next().await {
match block_height_result {
Ok(block_height) => {
metrics::RECEIVER_BLOCKS_FAILURE
.with_label_values(&[&indexer_name])
.set(0);
redis
.publish_block(indexer, redis_stream.clone(), block_height, MAX_STREAM_SIZE)
.await?;
Expand All @@ -422,6 +427,9 @@ async fn process_bitmap_indexer_blocks(
last_published_block_height = block_height;
}
Err(err) => {
metrics::RECEIVER_BLOCKS_FAILURE
.with_label_values(&[&indexer_name])
.inc();
tracing::error!(
"Backfill using bitmap indexer failed unexpectedly: {:?}",
err
Expand Down
6 changes: 6 additions & 0 deletions block-streamer/src/graphql/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ impl GraphQLClientImpl {
.json(&body)
.send()
.await?;
if reqwest_response.status() != 200 {
tracing::error!(
"GraphQL query failed with status code: {}",
reqwest_response.status()
);
}

reqwest_response.json().await
}
Expand Down
6 changes: 6 additions & 0 deletions block-streamer/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ lazy_static! {
&["indexer"]
)
.unwrap();
pub static ref RECEIVER_BLOCKS_FAILURE: IntGaugeVec = register_int_gauge_vec!(
"queryapi_block_streamer_receiver_blocks_failure",
"Gauge which only has a nonzero value if an error occurs during receiver block backfill",
&["indexer"]
)
.unwrap();
}

pub struct LogCounter;
Expand Down
35 changes: 35 additions & 0 deletions core-indexers/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module.exports = {
parser: '@typescript-eslint/parser',
env: {
es2021: true,
node: true
},
overrides: [
{
files: ['.eslintrc.js', 'jest.config.js'],
parser: 'espree',
extends: ['standard'],
rules: {
semi: ['error', 'always'],
quotes: ['error', 'single'],
'array-callback-return': ['error', { allowImplicit: false }]
}
},
{
files: ['**/*.ts'],
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname
},
extends: [
'standard-with-typescript'
],
rules: {
'@typescript-eslint/semi': ['error', 'always'],
'@typescript-eslint/comma-dangle': ['error', 'only-multiline'],
'@typescript-eslint/strict-boolean-expressions': 'off',
'array-callback-return': ['error', { allowImplicit: false }]
}
}
]
};
6 changes: 6 additions & 0 deletions core-indexers/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testTimeout: 10000
};
Loading

0 comments on commit 8034220

Please sign in to comment.