From d4aa05d96b40bb82e2a0ce6410df8e2841fb2f9d Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Wed, 10 Jul 2019 15:48:19 -0700 Subject: [PATCH] fix: correctly set metrics database for current endpoint --- src/EndpointConfig.js | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/EndpointConfig.js b/src/EndpointConfig.js index 8536f76c..8581f0cd 100644 --- a/src/EndpointConfig.js +++ b/src/EndpointConfig.js @@ -110,24 +110,15 @@ export function getApiWebsocketUrl() { } export function getMetricsDashboardUrl() { - let matches; - + let testnet = endpointName; if (endpointName === 'local') { - matches = window.location.hostname.match('(.*).solana.com'); - } else { - const endpointUrl = endpointUrlMap[endpointName]; - matches = endpointUrl.match('/([^/]*).solana.com'); + testnet = endpointHostnameMap[window.location.hostname]; } let url = 'https://metrics.solana.com:3000/d/testnet-beta/testnet-monitor-beta?refresh=5s&from=now-5m&to=now'; - if (matches) { - console.log('getMetricsDashboardUrl matches:', matches); - const testnet = endpointHostnameMap[matches[1]]; - console.log('getMetricsDashboardUrl testnet:', testnet); - if (testnet) { - url += `&var-testnet=${testnet}`; - } + if (testnet) { + url += `&var-testnet=${testnet}`; } return url; }