aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Shulyak <yashulyak@gmail.com>2018-05-29 19:46:09 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-05-29 19:46:09 +0800
commit7677ec1f3414c1e3712bf33598f8780c3b76742b (patch)
tree821fd6567acc495b35d35f73f4f12a67bb6894b7
parent84f8c0cc1fbe1ab9c128555392a82ba609820fef (diff)
downloadgo-tangerine-7677ec1f3414c1e3712bf33598f8780c3b76742b.tar.gz
go-tangerine-7677ec1f3414c1e3712bf33598f8780c3b76742b.tar.zst
go-tangerine-7677ec1f3414c1e3712bf33598f8780c3b76742b.zip
p2p/discv5: add egress/ingress traffic metrics to discv5 udp transport (#16369)
-rw-r--r--p2p/discv5/metrics.go8
-rw-r--r--p2p/discv5/udp.go5
2 files changed, 12 insertions, 1 deletions
diff --git a/p2p/discv5/metrics.go b/p2p/discv5/metrics.go
new file mode 100644
index 000000000..cb11d7eac
--- /dev/null
+++ b/p2p/discv5/metrics.go
@@ -0,0 +1,8 @@
+package discv5
+
+import "github.com/ethereum/go-ethereum/metrics"
+
+var (
+ ingressTrafficMeter = metrics.NewRegisteredMeter("discv5/InboundTraffic", nil)
+ egressTrafficMeter = metrics.NewRegisteredMeter("discv5/OutboundTraffic", nil)
+)
diff --git a/p2p/discv5/udp.go b/p2p/discv5/udp.go
index 09e5f8b37..49e1cb811 100644
--- a/p2p/discv5/udp.go
+++ b/p2p/discv5/udp.go
@@ -334,8 +334,10 @@ func (t *udp) sendPacket(toid NodeID, toaddr *net.UDPAddr, ptype byte, req inter
return hash, err
}
log.Trace(fmt.Sprintf(">>> %v to %x@%v", nodeEvent(ptype), toid[:8], toaddr))
- if _, err = t.conn.WriteToUDP(packet, toaddr); err != nil {
+ if nbytes, err := t.conn.WriteToUDP(packet, toaddr); err != nil {
log.Trace(fmt.Sprint("UDP send failed:", err))
+ } else {
+ egressTrafficMeter.Mark(int64(nbytes))
}
//fmt.Println(err)
return hash, err
@@ -374,6 +376,7 @@ func (t *udp) readLoop() {
buf := make([]byte, 1280)
for {
nbytes, from, err := t.conn.ReadFromUDP(buf)
+ ingressTrafficMeter.Mark(int64(nbytes))
if netutil.IsTemporaryError(err) {
// Ignore temporary read errors.
log.Debug(fmt.Sprintf("Temporary read error: %v", err))
Browne2018-12-061-0/+65 | * Update to use ContractWrappers + Infura instead of EtherscanAlex Browne2018-12-061-358/+53 | * Add preliminary support for scraping orders from SRA endpoints (no ↵Alex Browne2018-12-061-18/+121 | | | | pagination, only RR support for now) * Add support for decoding asset dataAlex Browne2018-12-061-3/+3 | * Add typeorm and begin inserting database recordsAlex Browne2018-12-061-9/+73 | * Add tests for etherscan eventsAlex Browne2018-12-061-1/+1 | * Remove old code. Create function for getting contract events via etherscanAlex Browne2018-12-061-599/+263 | * Rebase pipeline branch off developmentAlex Browne2018-12-061-101/+666 | * feat: create more dank sliderfragosti2018-12-061-11/+302 | * feat: have basic code syntax highlighting workingfragosti2018-12-061-390/+231 | * Merge remote-tracking branch 'upstream/development' into websiteFred Carlsen2018-12-051-142/+260 |\ | | | | | | | | | | # Conflicts: # packages/website/package.json # packages/website/ts/style/colors.ts | * Merge pull request #1295 from 0xProject/feature/instant/rollbar-envSteve Klebanoff2018-12-041-0/+15 | |\ | | | | | | [instant] Rollbar | | * Introduce rollbar pluginSteve Klebanoff2018-11-211-0/+15 | | | | * | Merge pull request #1364 from ↵Francesco Agosti2018-12-041-1/+9 | |\ \ | | | | | | | | | | | | | | | | 0xProject/feature/instant/allow-env-vars-in-env-file [instant] Add dotenv to make env dependencies more explicit | | * | feat: add dotenv to make env dependencies more explicitfragosti2018-12-011-2/+10 | | |/ | * | Update yarn.lockLeonid Logvinov2018-12-031-21/+314 | | | | * | Replace packages/contracts with contracts/coreLeonid Logvinov2018-12-031-246/+48 | |/ * | Adds ts cachingEzekiel Aquino2018-11-301-1/+2 | | * | Add styled-component typesFred Carlsen2018-11-281-0/+9 | | * | Updates styled-components, react typingsEzekiel Aquino2018-11-281-0/+34 | | * | Add svg loaderFred Carlsen2018-11-281-2/+119 |/ * feat(instant): add icons to token selectorBrandon Millman2018-11-161-2/+61 | * feat: use stable version of bowserfragosti2018-11-161-8/+4 | * Merge pull request #1265 from ↵Francesco Agosti2018-11-161-1/+5 |\ | | | | | | | | 0xProject/feature/instant/expose-webpack-dev-server [instant ] Expose webpack-dev-server content to local network | * feat: expose webpack-dev-server content to local networkfragosti2018-11-151-1/+5 | | * | chore: update yarn lockBrandon Millman2018-11-151-39/+2 |/ * feat: use capital values for enumsfragosti2018-11-151-1/+38 | * feat: display the correct provider type and change unlock / install prompt ↵fragosti2018-11-141-39/+6 | | | | content * Merge pull request #1244 from 0xProject/developerSectionNitsFabio B2018-11-141-1/+1 |\ | | | | Remaining Developer Section Design Nits | * update yarn.lockFabio Berger2018-11-121-17/+2 | | | * merge developmentFabio Berger2018-11-121-23/+134 | |\ | * | Update yarn.lockFabio Berger2018-10-261-45/+1 | | | * | | Updated CHANGELOGSLeonid Logvinov2018-11-141-1/+38 | | | * | | Updated CHANGELOGSLeonid Logvinov2018-11-121-39/+2 | | | * | | fix(website): fix code splittingBrandon Millman2018-11-121-1/+1 | |/ |/| * | Updated CHANGELOGSJacob Evans2018-11-091-8/+39 | | * | Merge pull request #1236 from 0xProject/fix/subproviders/lock-ledger-4.24.0Jacob Evans2018-11-091-5/+15 |\ \ | | | | | | [subproviders] Lock Ledger hw-transport to 4.24.0 | * | fix: Lock Ledger hw-transport to 4.24.0Jacob Evans2018-11-091-5/+15 | | | * | | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-11-091-39/+2 |\| | | | | | | | | | | feature/instant/dropdown-ui | * | feat(instant): fallback to an empty wallet provider when none is injectedBrandon Millman2018-11-081-39/+2 | | | * | | feat: implement copy-to-clipboardfragosti2018-11-081-0/+6 |/ / * | feat: break up deploy into deploy-dogfood and deploy-stagingfragosti2018-11-031-10/+47 | | * | Merge branch 'development' into feature/instant/fixed-orders-in-render-methodBrandon Millman2018-10-301-39/+2 |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * development: Has Sufficient Funds/Balance -> Has Sufficient ETH When transaction too low, treat as validation error. also modify callback: errorMessage could be AssetBuyError as well onPendingValidation -> onValidationPending linting Simpler way of validaitng has enough eth questionmark syntax instead of '| undefined' Validate enough ETH when user clicks buy acccount for no address move funct into util move imports yarn.lock changes feat(instant): Show message if user doesn't have enough ETH ethDecimals -> ETH_DECIMALS | * | yarn.lock changesSteve Klebanoff2018-10-271-2/+39 | | | * | | fix: init BigNumberInput not BigNumber when initializing statefragosti2018-10-271-1/+38 |/ / * | Merge pull request #1175 from 0xProject/feature/instant/input-fees-roundingFrancesco Agosti2018-10-271-9/+58 |\ \ | | | | | | [instant] Create a ScalingInput component and use it in the amount input and upgrade to styled-components v4 | * | fix: weird linting error that depends on typesfragosti2018-10-251-1/+38 | | | | * | feat: change to increasing input width by a constant amount per additional ↵fragosti2018-10-251-46/+2 | | | | | | | | | | | | character | * | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-251-1/+8 | |\| | | | | | | | | | feature/instant/input-fees-rounding | * | feat: upgrade to styled-components v4fragosti2018-10-201-8/+57 | | | * | | Update yarn.lockFabio Berger2018-10-261-45/+1 | |/ |/| * | Revert "commiting addtl changes to yarn.lock from running yarn"Steve Klebanoff2018-10-241-1/+45 | | | | | | | | This reverts commit c1f9f2e8d9dc97d9ac6fcb865c46e5a74118a75c. * | commiting addtl changes to yarn.lock from running yarnSteve Klebanoff2018-10-241-45/+1 | | * | feat(instant): Procesing and Success statesSteve Klebanoff2018-10-241-1/+8 |/ * Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-201-7/+106 |\ | | | | | | feature/instant/beta-render-et-al | * Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-201-875/+922 | |\ | | | | | | | | | feature/instant/discharge | | * chore: Fix scroll issue by bumping version and installing from new branchFabio Berger2018-10-191-5/+5 | | | | * | feat: create dogfood url and deployment workflowfragosti2018-10-181-4/+157 | | | * | | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-191-839/+999 |\ \ \ | | |/ | |/| | | | feature/instant/beta-render-et-al | * | chore: update yarn.lockFabio Berger2018-10-181-8/+0 | | | | * | update outdated package and tsconfig issueFabio Berger2018-10-181-338/+33 | | | | * | chore: update yarn.lockJacob Evans2018-10-181-490/+937 | | | | * | Merge pull request #1154 from 0xProject/dev-section-redesignKadinsky2018-10-181-2/+2 | |\ \ | | | | | | | | [BASE_BRANCH] Developer section redesign | | * \ merge dev-section-redesignFabio Berger2018-10-181-11/+27 | | |\ \ | | | * \ merge developmentFabio Berger2018-10-181-11/+27 | | | |\ \ | | * | | | Update react-scroll hash to avoid collision with older, unfixed branchFabio Berger2018-10-181-1/+1 | | |/ / / | | * | | merge developmentFabio Berger2018-10-161-16/+40 | | |\ \ \ | | * \ \ \ Merge branch 'development' into dev-section-redesignFabio Berger2018-10-111-884/+197 | | |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * development: (62 commits) Fix linter error Upgrade ethereum-types Lint and update deps Be more explicit with falsiness Add type to cssRuleIfExists Fix issue where we throw if non-numeric characters are used in input Upgrade to more recent types, fix yarn.lock [fix]: [testnet-faucet] Exit 1 on build fail Explains tools we want them to use Add note about button Add dev-tools-pages bundles to gitignore Improve README Fix button and center Increase max bundle size for instant Add stuff Initial project scaffolding Change tslint config to remove conflicts with prettier fix: [testnet-faucet] Signing of orders Update the CHANGELOG Add comments for expiryBuffer ... | | * \ \ \ \ merge base branchFabio Berger2018-10-051-321/+1823 | | |\ \ \ \ \ | | * | | | | | Use same Link UI component for react-scroll linksFabio Berger2018-10-031-0/+27 | | | | | | | | | | * | | | | | Update react-scroll to include fix of using `history.replaceState` instead ↵Fabio Berger2018-10-011-1/+1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of `history.pushState` | * | | | | | | Enable linter on generated abi-gen wrappersLeonid Logvinov2018-10-181-1/+1 | | |_|_|_|/ / | |/| | | | | | * | | | | | use redux dev tools from packageSteve Klebanoff2018-10-181-38/+5 | | |_|_|_|/ | |/| | | | * / | | | | feat: MVP of passing in sraApiUrl, assetData and other settings from render ↵fragosti2018-10-191-39/+17 |/ / / / / | | | | | | | | | | | | | | | method * | | | | chore: Update TypeDoc to 0.13.0 (supports TS v3.1)Fabio Berger2018-10-171-6/+10 | | | | | * | | | | Merge pull request #1143 from 0xProject/fix/monorepo-scripts/changelog-utcJacob Evans2018-10-171-6/+6 |\ \ \ \ \ | | | | | | | | | | | | [monorepo-scripts] Format changelog dates as UTC timezone +0:00 | * | | | | fix(monorepo-scripts): Format date as UTC not local time.Jacob Evans2018-10-171-7/+7 | | |_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | Down under is in the future and causes many conflicts when formatting the timestamp in the local context. All previous releases jumped a day ahead. By setting this to UTC we will have consistent formatted dates in the changelogs no matter where one publishes from. npm-cli-login fails on node 10 as a deprecation in node 9 has finished. This package appears to be unmaintained so we now have a fork with a fix * | | | | Add tests for format and use toFixed instead of round for usdfragosti2018-10-171-0/+4 | | | | | * | | | | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-171-15/+0 |\| | | | | | | | | | | | | | | | | | | feature/instant/move-features-over-from-zrx-buyer | * | | | Remove unused copyfiles dependenciesAlex Browne2018-10-161-15/+0 | | | | | * | | | | Add ts-optchain and use it instead of lodash getfragosti2018-10-161-1/+42 | | | | | * | | | | feat: add changelog entries for changed packagesfragosti2018-10-161-16/+1 | | | | | * | | | | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-161-40/+49 |\| | | | | | | | | | | | | | | | | | | feature/instant/move-features-over-from-zrx-buyer | * | | | Update yarn.lockFabio Berger2018-10-111-7/+0 | | | | | | * | | | fix(website): replace Rollbar UMD with regular npm packageFabio Berger2018-10-111-1/+47 | | |_|/ | |/| | | * | | Merge pull request #1125 from 0xProject/feature/starter-dev-tools-pagesLeonid Logvinov2018-10-111-39/+9 | |\ \ \ | | | | | | | | | | Initial project scaffolding for dev tools pages | | * | | Add stuffFabio Berger2018-10-101-39/+9 | | | | | | | * | | Initial project scaffoldingLeonid Logvinov2018-10-101-91/+3 | | | | | * | | | | feat: model asset meta data and add dynamic assetData statefragosti2018-10-131-0/+15 |/ / / / * | | | Upgrade to more recent types, fix yarn.lockfragosti2018-10-111-9/+4 | | | | * | | | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-101-868/+201 |\| | | | | | | | | | | | | | | feature/instant/redux-styles-container | * | | Fix merge conflictsLeonid Logvinov2018-10-091-0/+39 | | | | | * | | Fix ethers build issueLeonid Logvinov2018-10-091-43/+8 | | | | | * | | Use bundlewatch instead of bundlesizeLeonid Logvinov2018-10-091-4/+70 | | | | | * | | Throw and handle errors from Providers.Jacob Evans2018-10-091-61/+3 | | | | | | | | | | | | | | | | | | | | | | | | | | | | In web3 wrapper when a response contains an error field we throw this rather than return response.result which is often undefined. In Signature Utils we handle the error thrown when a user rejects the signing dialogue to prevent double signing. Exposed the ZeroExTransaction JSON schema. In Website only use the MetamaskSubprovider if we can detect the provider is Metamask | * | | Introduce Metamask Subprovider.Jacob Evans2018-10-051-225/+52 | | | | | | | | | | | | | | | | MM has a number of inconsistencies with other providers when implementing the JSON RPC interface. This subprovider wraps those nuances so they do not leak into the rest of our code | * | | Expose eth_signTypedData functionality for order signingJacob Evans2018-10-051-514/+100 | | |/ | |/| * | | Fix currupted yarn lock filefragosti2018-10-051-6/+6 | | | * | | Remove deps we probably dont needfragosti2018-10-051-47/+35 | | | * | | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-051-380/+195 |\| | | | | | | | | | | feature/instant/redux-styles-container | * | Upgrade webpackFabio Berger2018-10-041-380/+195 | | | * | | Add some ui componentsfragosti2018-10-041-0/+6 | | | * | | Add redux to 0x instantfragosti2018-10-041-22/+11 | | | * | | Add styled-components with themefragosti2018-10-041-0/+32 |/ / * | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-10-031-18/+162 |\ \ | | | | | | | | | feature/instant/init | * | Add a command to run bundle size reporterLeonid Logvinov2018-10-021-35/+134 | | | | * | Add missing yarn.lock changesFabio Berger2018-10-021-0/+27 | |/ * | Add dev environmentfragosti2018-10-031-18/+125 | | * | Clean up package jsonfragosti2018-10-031-42/+1174 | | * | Have React setup with basic build workingfragosti2018-09-281-40/+371 |/ * Remove yarn postinstall hack (#1098)Alex Browne2018-09-281-2/+2 | * Merge pull request #1069 from 0xProject/feature/ts-ethersLeonid Logvinov2018-09-271-4/+23 |\ | | | | Upgrade to TS version of ethers | * Merge branch 'development' into feature/ts-ethersLeonid Logvinov2018-09-261-34/+38 | |\ | * | Upgrade to TS version of ethersLeonid Logvinov2018-09-191-4/+23 | | | * | | Update everything to Coinbase Wallet instead of Toshifragosti2018-09-261-1/+54 | |/ |/| * | Update yarn.lockFabio Berger2018-09-261-33/+29 | | * | Upgrade blockstream to version that supports fetching logs by blockHash, ↵Fabio Berger2018-09-211-1/+9 |/ | | | fixing reliability issues * [testnet-faucets] update to v2Jacob Evans2018-09-051-91/+16 | * Run linterfragosti2018-09-051-3/+3 | * Use order parser utils from order utilsfragosti2018-09-051-35/+75 | * Merge https://github.com/0xProject/0x-monorepo into ↵fragosti2018-09-051-34/+36 |\ | | | | | | feature/website/update-portal-v2 | * Update yarn.lockFabio Berger2018-09-041-33/+29 | | | * Update yarn lockBrandon Millman2018-08-311-30/+34 | | | * Final tweaks for landing pagefragosti2018-08-311-34/+30 | | | * Update yarn lockBrandon Millman2018-08-311-4/+4 | | | * Add TypedText component and use it on landing pagefragosti2018-08-311-1/+7 | | * | Update yarn lockBrandon Millman2018-08-311-25/+4 | | * | Token registry from old 0x versionBrandon Millman2018-08-311-2/+60 | | * | Initial changes for v2 portalBrandon Millman2018-08-311-89/+22 |/ * Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-08-301-60/+1 |\ | | | | | | website/feature/react-16 | * feat: Add support for TypeScript project references (#991)Alex Browne2018-08-301-60/+1 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Update all package.json and tsconfig.json * fix(contracts): Make test/utils/web3_wrapper.ts compatible with project refs * Fix webpack config for 0x.js * Fix linter errors by adding rootDir to tsconfig.json as needed * Add build:ts and watch:ts commands to package.json * Update sra-spec to work with project references * Update tsconfig.json with latest new/removed packages * Add TypeScript as devDependency at root * Add missing rootDir to forwarder-helper package * Use a separate tsconfig file for typedoc * Fix linter errors * Apply PR feedback (add comments) * Fix 0x.js tsconfig * | Change VersionDropDown to use material-ui 3fragosti2018-08-291-3/+208 | | * | Upgrade version of react-shared in websitefragosti2018-08-291-37/+1 | | * | Upgrade react-copy-to-clipboardfragosti2018-08-291-16/+7 | | * | Remove react-tap-event-plugin from react-sharedfragosti2018-08-291-10/+4 | | * | Upgrade material ui in react-docsfragosti2018-08-291-60/+7 | | * | Update lockfilefragosti2018-08-291-3/+3 | | * | Update material-ui in react-sharedfragosti2018-08-291-1/+37 | | * | Upgrade material ui to 0.20.0fragosti2018-08-291-2/+62 | | * | Bump react-highlight in react-shared once morefragosti2018-08-251-5/+5 | | * | Upgrade react-shared used by website to one that depends on react 16fragosti2018-08-251-154/+9 | | * | Upgrade react-highlight to version that depends on React 16fragosti2018-08-251-0/+9 | | * | Update react and remove tap event plugin [deprecated]fragosti2018-08-251-32/+36 | | * | Merge branch 'development' of https://github.com/0xProject/0x-monorepo into ↵fragosti2018-08-251-3195/+3458 |\| | | | | | | website/feature/react-16 | * Merge pull request #997 from 0xProject/feature/forwarder-helper/initBrandon Millman2018-08-241-2/+72 | |\ | | | | | | [forwarder-helper] Initial scaffolding for the forwarder-helper package | | * Remove legacy docs stuffBrandon Millman2018-08-241-5/+56 | | | | | * Merge branch 'development' into feature/forwarder-helper/initBrandon Millman2018-08-241-191/+226 | | |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * development: (187 commits) Remove trailing slash Fix linter Stop nesting interfaces and add necessary type exports Remove duplicate type and remove nested interface Add support for rending the Tuple type Add missing keyu Remove excessive timestamp Improve doc commebnt Remove docs catch-all endpoint Fix comments Look for all TS mapped types Add catch and exit with non-zero Remove superfluous dep Fix CHANGELOG entry Fix double assignment Upgrade Typedoc to 0.12.0, which works with TS 3.x Fix prettier issues Enable dry run of release publishing and handle git tags existing update yarn.lock Missing/superfluous type exports from connect ... | | * | Update yarn lockBrandon Millman2018-08-241-0/+4 | | | | | | * | Merge branch 'development' into feature/forwarder-helper/initBrandon Millman2018-08-24