Giter VIP home page Giter VIP logo

solana-ping-api's Introduction

Solana Ping Service

Functions Provided

  • High frequently send transactions and record results
  • provide http API service
  • generate a report and submit to slack periodically
  • actively check confirmation losses and send an alert to slack
  • Spam Filter of slack alert

Server Setup

API Service

API service for getting the results of ping service. Use APIServer: Enabled: true to turn on in in config-{cluster}.yaml.

PingService

This is similar to "solana ping" tool in solana tool but can do concurrent rpc query. It send transactions to rpc endpoint and wait for transactions is confirmed. Use PingServiceEnabled: true to turn on in config-{cluster}.yaml.

RetensionService

Use Retension: Enabled: true in config.yaml to turn on. Default is Off. Clean database data periodically.

ReportService

Use Report: Enabled:true in config-{cluster}.yaml to turn on. ping-api service supports sedning report & alert to both slack and discord. Use Report: Slack: Report: Enabled:true to turn on Slack Report. This sends summary of ping result to a slack channel periodically. Use Report: Slack: Alert: Enabled:true to turn on Slack Alert. This will send alert when a event is triggered. See Alert Spam Filter for more info. Use Report: Discord: Report: Enabled:true to turn on Discord Report. Use Report: Discord: Alert: Enabled:true to turn on Discord Alert.

  • Example:Run only API Query Server In config.yaml ServerSetup:
(config.yaml)
Retension:
 Enabled: false
(config-{cluster}.yaml)
PingEnabled: true     
Report:
 Enabled: true
 Slack:
  Report:
   Enabled: true
  Alert: 
   Enabled: true   
 Discord:
  Enabled: true
  Report:
   Enabled: false
  Alert: 
   Enabled: true                  

Installation

  • download executable file
  • or build from source
    • Install golang
    • clone from github.com/solana-labs/solana-ping-api
    • go mod tidy to download packages
    • go build
  • mkdir ~/.config/ping-api
  • put config.yaml in ~/.config/ping-api/config.yaml

Using GCP Database

  • Install & Setup google cloud CLI
  • download Cloud SQL Auth proxy
  • chmod +x cloud_sql_proxy
  • run cloud_sql_proxy

setup recommendation

  • mkdir ~/ping-api-server
  • cp scripts in script to ~/ping-api-server
  • make solana-ping-api system service
    • create a /etc/systemd/system/solana-ping-api.service
    • remember to reload by sudo systemctl daemon-reload
[Unit]
Description=Solana Ping API Service
After=network.target
StartLimitIntervalSec=1

[Service]
Type=simple
Restart=always
RestartSec=30
User=sol
LogRateLimitIntervalSec=0
ExecStart=/home/sol/ping-api-server/solana-ping-restart.sh

[Install]
WantedBy=multi-user.target

  • put executable file in ~/ping-api-server
  • cp config.yaml.samle to ~/ping-api-server/config.yaml and modify it
  • use cp-to-real-config.sh to copy config.yaml to ~/.config/ping-api/config.yaml
  • start service by sudo sysmtemctl start solana-ping-api.service
  • you can check log by sudo tail -f /var/log/syslog | grep ping-api

Alert Spam Filter

Alert Spam Filter could be changed frequently. The updte to date (4/18/2022) setting is as below.

    Threshold increases when
    Loss > 20 % -> new threshold = 50% -> send alert
    Loss > 50 % -> new threshold = 75% -> send alert
    Loss > 75 % -> new threshold = 100% -> send alert
    Threshold decreases when
    Loss > 75 % to < 75%  -> new threshold = 75% -> send alert
    Loss > 50 % to < 50%  -> new threshold = 50% -> send alert
    Loss > 20 % to < 20%  -> new threshold = 20% -> NOT send alert

solana-ping-api's People

Contributors

bw-solana avatar pieceofr avatar yihau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

solana-ping-api's Issues

devnet receive AccountNotFound error

Devnet received the following information
{"code":-32002,"message":"Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.","data":{"accounts":null,"err":"AccountNotFound","logs":[],"unitsConsumed":0}}(75)}

Avoid rpc endpoint token leak

When the failover alert channel become public, the token may leak because endpoint in current code contains token.
The endpoint url and token should be store in different variable so that when alert is sent, only the endpoint url is sent.

In alert and report message , token is showed

Problem

rpc token shows in some errors which is not a typical error so it does not filter out by short() function.
The token should be hided

Possible solution

Filter out error messages before message is sent

Enahnce TX Retry & Timeout Strategies

Issue

On Sunday, Apr 10 around 12:00 UTC, the cluster is running well, but the Solana Ping Stats chart shows many errors.

Screen Shot 2022-04-10 at 6 00 37 AM

In comparison, the validators.app Ping Thing shows average confirmation times, from 3 points on the cluster, of around 5 seconds.

Screen Shot 2022-04-10 at 6 01 28 AM

Source: https://www.validators.app/ping-thing

I believe the low success rate shown on the explorer is due to the TX retry strategies used on the ping client or the RPC node.

A TX is valid for up to 150 blocks after the submitted block hash. -- about 60-75 seconds on a wall clock. So, the 35-second WaitConfirmationTimeout threshold may be too short (depending on your retry strategy).

Suggestion

  • Retry TXs from the client or the RPC node every 2 seconds until confirmation or the block hash expires.
  • Increase WaitConfirmationTimeout to 60 or 75 seconds (or rely on the block hash expiration error).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.