From 03879d70bbca18cdc3254565c0e60e39d0f0522a Mon Sep 17 00:00:00 2001 From: Ekene Eze Date: Mon, 13 May 2024 21:20:56 +0400 Subject: [PATCH] Add env example files (#6) * Add uptime monitoring * remove test file * Add granular checks, uptime monitoring and latency graph * update latency & add example env files * testing a rebase * update env example files --- .DS_Store | Bin 0 -> 6148 bytes backend/.env.example | 2 ++ backend/README.md | 1 + backend/endpoints.json | 3 +-- backend/services/servicecheck.ts | 1 + frontend/.env.example | 3 +++ frontend/.gitignore | 2 +- frontend/src/app/latency/latencygraph.tsx | 17 +---------------- 8 files changed, 10 insertions(+), 19 deletions(-) create mode 100644 .DS_Store create mode 100644 backend/.env.example create mode 100644 frontend/.env.example diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..041db02e309857823245c7007fc6750117397f00 GIT binary patch literal 6148 zcmeHKO-~y!5FLlmI6{?jpn~H{ToHtpA`q8tN)KGSs69}W?y`ZdSk@@nkV6z{&+U)l z$}j2PN#EE8iSThO2+c_2Hy+Q}@>|Q^AtKcorW-^pBGORCS`*C!!sD#>q~<;IK*e+H z=jJ%cO@cm8DDv_d;BQx_H9Dn?%9-!?31e$hD|RCdN+_mdI-?#Hl+Hw7Jsq8l1{eNp zTqhTKHYnTezp6G@pMTTP4ZWa`qF-hdm2o*7bmIOY_YRE7lN&ouzGb~px3&1$6lI(h zy}nJz(jG#7e9wy1j5=mmqyw89xdGkO&2DRXJpR~juLhgj8kT z-~HM>%g+n*+wPJS&a#!a9&g|ej2R9tqkfT_;uIsCrRjwFWWY}O5JzeWFNzvuMA^DHl`3IoEx3ub`thXBeLdaNAUs{@TK0f2S5t-!Xw{=k48z|dpm z5FUtfsX&*ie2Jla<)B$bSSMbAPn4PV9s@0 z{QiG=y#BwNBt2n37tQ^7vkskp|gEYdxe`VkwkTr6T literal 0 HcmV?d00001 diff --git a/backend/.env.example b/backend/.env.example new file mode 100644 index 0000000..88fe90c --- /dev/null +++ b/backend/.env.example @@ -0,0 +1,2 @@ +# PORT = 3002 +# Port to run the server on \ No newline at end of file diff --git a/backend/README.md b/backend/README.md index f596192..fc8c564 100644 --- a/backend/README.md +++ b/backend/README.md @@ -8,6 +8,7 @@ The services and their expected responses are contained in the `endpoints.jsoon` To run this server locally, follow these steps: * Clone the repository with `git clone https://github.com/shardeum/network-status.git` +* Change into the backend directory with `cd backend` * Install the dependencies with `npm install` * Run the local dev server with: `npm start` * This should start the server on port 3002 from where it will feed data to Prometheus. diff --git a/backend/endpoints.json b/backend/endpoints.json index 7d7d06a..c3e5d97 100644 --- a/backend/endpoints.json +++ b/backend/endpoints.json @@ -57,8 +57,7 @@ { "url": "https://explorer-sphinx.shardeum.orgdfsgs/", "name": "Explorer", - "help": "This is the Shardeum Explorer", - "expectedResponse": "The Shardeum Betanet Explorer" + "help": "This is the Shardeum Explorer" }, { diff --git a/backend/services/servicecheck.ts b/backend/services/servicecheck.ts index 362f492..90a39c9 100644 --- a/backend/services/servicecheck.ts +++ b/backend/services/servicecheck.ts @@ -39,6 +39,7 @@ class HealthChecker { this.startPeriodicChecks(); } flattenEndpoints(urls: any[]) { + // If an endpoint is part of a group, it is flattened so that each service can be checked individually. // If an endpoint is part of a group, it is flattened so that each service can be checked individually. return urls.flatMap(endpoint => 'servers' in endpoint ? endpoint.servers : [endpoint]); } diff --git a/frontend/.env.example b/frontend/.env.example new file mode 100644 index 0000000..8a60017 --- /dev/null +++ b/frontend/.env.example @@ -0,0 +1,3 @@ +# http://localhost:9090 this is where your local prometheus instance is running +# NEXT_PUBLIC_PROMETHEUS_URL_RANGE = "http://localhost:9090/api/v1/query_range" +# NEXT_PUBLIC_PROMETHEUS_URL = "http://localhost:9090/api/v1/query?query=Shardeum" \ No newline at end of file diff --git a/frontend/.gitignore b/frontend/.gitignore index 20133a7..f3e685b 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -27,7 +27,7 @@ yarn-debug.log* yarn-error.log* # local env files -.env*.local +.env.local # vercel .vercel diff --git a/frontend/src/app/latency/latencygraph.tsx b/frontend/src/app/latency/latencygraph.tsx index 6aea8c1..8975325 100644 --- a/frontend/src/app/latency/latencygraph.tsx +++ b/frontend/src/app/latency/latencygraph.tsx @@ -5,7 +5,6 @@ export default function LatencyGraph({ data, name }: Readonly<{ data: any, name: const details = { chart: { id: name, - type: "line", animations: { enabled: true, @@ -14,9 +13,6 @@ export default function LatencyGraph({ data, name }: Readonly<{ data: any, name: speed: 2000 } }, - toolbar: { - show: false - }, }, @@ -26,18 +22,10 @@ export default function LatencyGraph({ data, name }: Readonly<{ data: any, name: }, yaxis: [ { - axisTicks: { - show: true - }, axisBorder: { show: true, color: "#247BA0" }, - labels: { - style: { - colors: "#247BA0" - } - }, title: { text: "Response time (s)", style: { @@ -48,14 +36,11 @@ export default function LatencyGraph({ data, name }: Readonly<{ data: any, name: } } ], - dataLabels: { - enabled: false - }, + stroke: { curve: 'straight', }, title: { - // text: 'Latency Graph', text: name, align: 'left' },